mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 13:30:37 +00:00
Usability improvements: When setting the cursor to the beginning of a
line, set the typing attributes to the attributes of the first character of that line rather than the preceding newline. When deleting text, set the typing attributes to those of the first deleted character rather than those of the character preceding the deleted range. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30055 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
21b251d643
commit
d0a7bfda42
3 changed files with 25 additions and 1 deletions
|
@ -1,5 +1,14 @@
|
|||
2010-03-27 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/NSTextView.m (-setSelectedRange:affinity:stillSelecting:):
|
||||
* Source/NSTextView_actions.m (-deleteForward:, -deleteBackward:,
|
||||
-deleteToEndOfLine:): Usability improvements: When setting the
|
||||
cursor to the beginning of a line, set the typing attributes to
|
||||
the attributes of the first character of that line rather than the
|
||||
preceding newline. When deleting text, set the typing attributes
|
||||
to those of the first deleted character rather than those of the
|
||||
character preceding the deleted range.
|
||||
|
||||
* Source/NSTextView.m (-mouseDown:): Allow shift-clicking to
|
||||
shrink the current selection. Comes handy when you accidentally
|
||||
select a few characters too much.
|
||||
|
|
|
@ -3597,7 +3597,9 @@ afterString in order over charRange.
|
|||
{
|
||||
NSDictionary *dict;
|
||||
|
||||
if (charRange.location > 0)
|
||||
if (charRange.location > 0 &&
|
||||
[[_textStorage string] characterAtIndex:
|
||||
(charRange.location - 1)] != '\n')
|
||||
{
|
||||
/* If the insertion point is after a bold word, for
|
||||
example, we need to use bold for further
|
||||
|
|
|
@ -569,6 +569,7 @@ static NSNumber *float_plus_one(NSNumber *cur)
|
|||
- (void) deleteForward: (id)sender
|
||||
{
|
||||
NSRange range = [self rangeForUserTextChange];
|
||||
NSDictionary *attributes;
|
||||
|
||||
if (range.location == NSNotFound)
|
||||
{
|
||||
|
@ -603,15 +604,20 @@ static NSNumber *float_plus_one(NSNumber *cur)
|
|||
return;
|
||||
}
|
||||
|
||||
attributes = RETAIN([_textStorage attributesAtIndex: range.location
|
||||
effectiveRange: NULL]);
|
||||
[_textStorage beginEditing];
|
||||
[_textStorage deleteCharactersInRange: range];
|
||||
[_textStorage endEditing];
|
||||
[self setTypingAttributes: attributes];
|
||||
RELEASE(attributes);
|
||||
[self didChangeText];
|
||||
}
|
||||
|
||||
- (void) deleteBackward: (id)sender
|
||||
{
|
||||
NSRange range = [self rangeForUserTextChange];
|
||||
NSDictionary *attributes;
|
||||
|
||||
if (range.location == NSNotFound)
|
||||
{
|
||||
|
@ -647,6 +653,8 @@ static NSNumber *float_plus_one(NSNumber *cur)
|
|||
return;
|
||||
}
|
||||
|
||||
attributes = RETAIN([_textStorage attributesAtIndex: range.location
|
||||
effectiveRange: NULL]);
|
||||
[_textStorage beginEditing];
|
||||
[_textStorage deleteCharactersInRange: range];
|
||||
[_textStorage endEditing];
|
||||
|
@ -659,6 +667,7 @@ static NSNumber *float_plus_one(NSNumber *cur)
|
|||
NSRange linerange;
|
||||
unsigned maxRange;
|
||||
unsigned endCorrection = 0;
|
||||
NSDictionary *attributes;
|
||||
|
||||
if (range.location == NSNotFound)
|
||||
{
|
||||
|
@ -704,9 +713,13 @@ static NSNumber *float_plus_one(NSNumber *cur)
|
|||
}
|
||||
|
||||
ASSIGN(killBuffer, [[_textStorage string] substringWithRange: range]);
|
||||
attributes = RETAIN([_textStorage attributesAtIndex: range.location
|
||||
effectiveRange: NULL]);
|
||||
[_textStorage beginEditing];
|
||||
[_textStorage deleteCharactersInRange: range];
|
||||
[_textStorage endEditing];
|
||||
[self setTypingAttributes: attributes];
|
||||
RELEASE(attributes);
|
||||
[self didChangeText];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue