Commit graph

324 commits

Author SHA1 Message Date
Riccardo Mottola
85155fd64f Fix click on TextAttachmentCells, where the left side was not respected.
This was because index was respecting fraction and thus loosing the attachment when clicking on the right part, only for this case, recalculate character index without respectFraction.
2022-10-11 23:26:51 +02:00
Fred Kiefer
7c1af2c874
Merge pull request #140 from williameveretteggplant/autoreleasepool_NSTextView
Fix memory leak in NSTextView
2022-02-14 23:42:08 +01:00
williameveretteggplant
b70fad26a6
Use autorelease pool macros 2022-02-14 15:35:37 -07:00
williameveretteggplant
2403c21978
Fix memory leak of tool tips
Prevents the creation of tool tips where they don't already exist. Tool tips only need to be removed in the rect if there are tool tips.
2022-02-14 14:03:49 -07:00
williameveretteggplant
f37e93a440
Fix memory leak in NSTextView
On Windows, there is an occasional sporadic failure of autorelease to work correctly. In particular, this seems to happen when autorelease is invoked on an object while a call stack is in the middle of draining an autorelease pool. So, for example, when dealloc is called on an NSTextContainer, it then calls setTextContainer: on the associated NSTextView, which in turn calls textContainers on the layoutManager, which returns an autoreleased array of NSTextContainers. This array is sometimes released and sometimes it isn't.
Wrapping the setTextContainer: in an autorelease pool, which will then drain at the end of the method, rather than relying on the main autorelease pool in the run loop (which is in the middle of being drained), appears to fix this problem. This adds a small amount of overhead, but also makes the memory usage a little more efficient, since anything autoretained during the course of this method is released more quickly.
2022-02-11 17:12:50 -07:00
Gregory John Casamento
7023c7d06d Add remaining changes contributed by testplant. 2021-10-27 15:18:23 -04:00
fredkiefer
4cb2b0693f * Source/NSTextView.m (-initWithCoder:): Make sure text container is
in sync with the text view resize behaviour.
* Source/NSScrollView.m (-initWithCoder:): Add scrollers as
subviews when decoded.
2020-09-12 21:59:16 +02:00
Gregory John Casamento
ebafa1786d implemented changes suggested by review 2020-08-18 20:23:39 -04:00
Gregory John Casamento
65ba6fb8f9 Adding attribution for my changes to .m file 2020-08-18 15:57:38 -04:00
Gregory John Casamento
867e7879ac Call layoutManager from drawCharactersInRange:forContentView: 2020-08-18 14:53:40 -04:00
Gregory John Casamento
a02336f84f Implement rectsForCharacterRange: per example for firstRectForCharacterRange: 2020-08-14 12:34:49 -04:00
Gregory John Casamento
fe50e9f40a Correct previous change 2020-08-14 12:24:03 -04:00
Gregory John Casamento
553d81071d Return entire string for NSTextView in stringAtIndex:... 2020-08-14 11:58:29 -04:00
Gregory John Casamento
d72e9e6ced Remove uneeded instance var. 2020-08-09 10:21:52 -04:00
Gregory John Casamento
03fd244708 Remove method which is already implemented 2020-08-04 15:51:12 -04:00
Gregory John Casamento
b6983955f6 Eliminate warnings 2020-08-04 14:45:04 -04:00
Gregory John Casamento
8c36246dca Add encoding. 2020-08-04 06:32:19 -04:00
Gregory John Casamento
6bfdb64ef4 Implementation of NSTextFinderClient protocol 2020-08-03 07:50:47 -04:00
Gregory John Casamento
405b9bae2f Implement NSTextFinder protocol on NSTextView. 2020-08-03 07:11:38 -04:00
Gregory John Casamento
ecea8da743 Migrate NSFileWraper to base. 2019-09-10 09:55:07 -04:00
Fred Kiefer
a33b4c5073 * Source/GSLayoutManager.m (-usedRectForTextContainer:): Add extra
line rect when needed.
	* Source/NSTextView.m (sizeToFit): Don't add extra line rect, as
	it is now already included.
	* Source/NSStringDrawing.m (cache_lookup): Remove hack for empty string.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@40346 72102866-910b-0410-8b05-ffd578937521
2017-02-17 19:44:25 +00:00
Fred Kiefer
ff61d4c642 2015-09-13 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextView.m: Invalidate insertion point timer in
        dealloc.
        * Source/NSToolbarItem.m: Check for drawing rect within bounds
        before drawing toolbar item.
        Patch by Marcian Lytwyn <gna@advcsi.com>.

2015-09-10  Doug Simons <doug.simons@testplant.com> and Paul Landers
<paul.landers@testplant.com>

        * Source/NSLayoutManager.m: Fix a bug that would try to adjust
        the length of the selected range to a negative number, leading
        to an exception and eventual crashes.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38986 72102866-910b-0410-8b05-ffd578937521
2015-09-13 21:36:40 +00:00
Fred Kiefer
221a51e14e Clean up last change.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38875 72102866-910b-0410-8b05-ffd578937521
2015-08-12 21:16:37 +00:00
Fred Kiefer
a3ca885ec8 * Source/NSTextView.m: Rewrite
writeSelectionToPasteboard:... methods.
        Based on patch by Adam Fox <adam.fox@testplant.com>


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38871 72102866-910b-0410-8b05-ffd578937521
2015-08-11 21:46:11 +00:00
Fred Kiefer
a8f35bbb94 * Source/NSTextView.m: Fix bizarre behavior with undo/redo
actions carrying across between different fields with the
        fieldEditor.
        Patch by Doug Simons <doug.simons@testplant.com>


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38288 72102866-910b-0410-8b05-ffd578937521
2015-01-11 21:53:19 +00:00
Fred Kiefer
6b0a46b215 * Source/NSTextView.m: Protect usages of sharedSpellChecker with
nil tests.
  Patch by Eric Wasylishen <ewasylishen@gmail.com>


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38283 72102866-910b-0410-8b05-ffd578937521
2015-01-08 20:36:40 +00:00
Fred Kiefer
cbc00992bf * Source/NSTextView.m (-insertText:): Ignore nil argument.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37694 72102866-910b-0410-8b05-ffd578937521
2014-02-18 20:38:31 +00:00
Wolfgang Lux
1549ee2fa9 Pass nil argument to selector called by NSTextView -doCommandBySelector:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37633 72102866-910b-0410-8b05-ffd578937521
2014-01-24 09:07:31 +00:00
Riccardo Mottola
d472adfbb1 * Source/NSTextView.m (-mouseDown:): Use container origin for attachment cells.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37283 72102866-910b-0410-8b05-ffd578937521
2013-10-26 15:50:02 +00:00
Germán Arias
70b54d1f0d Add autocomplete in NSTextView.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36733 72102866-910b-0410-8b05-ffd578937521
2013-06-19 18:40:28 +00:00
Fred Kiefer
28ff5825aa Add the timers for NSModalPanelRunLoopMode as well.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36187 72102866-910b-0410-8b05-ffd578937521
2013-02-22 11:28:06 +00:00
Fred Kiefer
941afdac86 Fix compiler warnings reported by
Sebastian Reitenbach <sebastia@l00-bugdead-prods.de>


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36165 72102866-910b-0410-8b05-ffd578937521
2013-02-18 20:29:10 +00:00
Fred Kiefer
7ef53c8232 More CGFloat, NSUInteger and NSInteger changes.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36153 72102866-910b-0410-8b05-ffd578937521
2013-02-16 21:37:29 +00:00
David Chisnall
4850a9feac Fix all current compiler warnings on FreeBSD/x86-64.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36038 72102866-910b-0410-8b05-ffd578937521
2013-01-30 09:48:54 +00:00
Fred Kiefer
0f3af93a92 Reworked version of patches by Marcian Lytwyn
<marcian.lytwyn@advcsi.com>


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35899 72102866-910b-0410-8b05-ffd578937521
2012-12-16 22:51:23 +00:00
Wolfgang Lux
1dd7be22f7 Update text storage directly when undoing text changes in a NSTextView
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35175 72102866-910b-0410-8b05-ffd578937521
2012-06-02 22:31:54 +00:00
Fred Kiefer
2d2026e7fc Revert last change and replace with something a little bit better. The
whole ruler handling will need some deeper inspection.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34636 72102866-910b-0410-8b05-ffd578937521
2012-01-26 09:25:29 +00:00
Doug Simons
3e7c9bceef Call setClientView: before calling setMarkers: to fix a problem when a textView's text is set or changed when the textView is not the first responder, such as at windowControllerDidLoadNib: time.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34633 72102866-910b-0410-8b05-ffd578937521
2012-01-25 23:28:51 +00:00
Wolfgang Lux
cc31ecbeda Change the default text container inset for NSTextView to (0,0) to
reduce blank space around text.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34367 72102866-910b-0410-8b05-ffd578937521
2011-12-29 22:16:50 +00:00
Wolfgang Lux
0da1b1f034 Adjust the minimum and maximum sizes of a NSTextView to ensure that
the minimum size is not greater than the current size and the maximum
size is not smaller than the current size.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34362 72102866-910b-0410-8b05-ffd578937521
2011-12-29 16:48:17 +00:00
Fred Kiefer
e740f7b0cc * Source/NSTextView.m (-setFieldEditor:): Use different values for
both cases.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34347 72102866-910b-0410-8b05-ffd578937521
2011-12-22 22:00:42 +00:00
Eric Wasylishen
e395fe88d7 * Source/NSPrinter.m:
* Source/NSPrintOperation.m:
* Source/NSPageLayout.m:
* Source/NSPrintInfo.m:
* Headers/AppKit/NSPrintInfo.h: Migrate printing code to CGFloat
or double.
* Source/NSTextView.m: Rewrite -adjustPageHeightNew🔝bottom:limit:


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34288 72102866-910b-0410-8b05-ffd578937521
2011-12-15 06:51:02 +00:00
Wolfgang Lux
6365fa5127 Reinstate Fred's change with the additional correction to the string
drawing code he proposed on the mailing list.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34241 72102866-910b-0410-8b05-ffd578937521
2011-12-02 21:36:58 +00:00
Eric Wasylishen
f218a41010 * Source/NSTextView.m
(-_scheduleTextCheckingInVisibleRectIfNeeded): Check for
nil before sending -rectValue to avoid crash


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34238 72102866-910b-0410-8b05-ffd578937521
2011-12-02 05:10:54 +00:00
Gregory John Casamento
14d5d889be revert change by fred.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34230 72102866-910b-0410-8b05-ffd578937521
2011-11-30 15:43:04 +00:00
Fred Kiefer
865c22357b * Source/NSTextView.m (-buildUpTextNetwork:): Move setting the
default line framgent padding from here ...
* Source/NSTextContainer.m (-initWithContainerSize:): ... to here.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34227 72102866-910b-0410-8b05-ffd578937521
2011-11-28 17:20:45 +00:00
Gregory John Casamento
e9aaaf4b61 Changes to correct bug#34919. NSTextView should now correctly show the padding set in the lineFragmentPadding attribute of NSTextContainer.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34222 72102866-910b-0410-8b05-ffd578937521
2011-11-28 02:37:58 +00:00
Eric Wasylishen
26567e31d8 * Source/NSColorPanel.m: Always send action and colorChanged: when
the color changes. NSColorPanel is always "continuous" for now...
to support -isContinuous == NO, we need to augment the API between
the color panel and the pickers so they can send a message when
the mouse is released.
* Source/NSTextView.m: Change typing attributes in response to
colorChanged:


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34105 72102866-910b-0410-8b05-ffd578937521
2011-11-01 20:31:24 +00:00
Fred Kiefer
8240c3bb55 * Source/NSTextView.m(currentVersion, -encodeWithCoder:,
-initWithCoder:): Archive missing attributes in non-keyed
mode. This required updating the NSTextView version to 4.
Should fix bug #33884.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33962 72102866-910b-0410-8b05-ffd578937521
2011-10-11 08:21:13 +00:00
Eric Wasylishen
d919131abb * Source/NSTextView.m (-view:stringForToolTip:point:userData:):
Ensure this returns an NSString, even if NSToolTipAttributeName
is set to something else (it calls -description on the value).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33597 72102866-910b-0410-8b05-ffd578937521
2011-07-21 04:56:02 +00:00