mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:50:48 +00:00
Implement the NSText kill buffer. Ctrl-k and Ctrl-y in a text view now
work as under Emacs and OS X. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29585 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f61bf18e28
commit
bb6792671e
3 changed files with 22 additions and 1 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2010-02-12 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
|
* Source/NSTextView_actions.m (killBuffer, -deleteToEndOfLine:,
|
||||||
|
-yank:): Implement the NSText kill buffer; -deleteToEndOfLine:
|
||||||
|
saves the deleted text to the kill buffer, -yank: inserts the
|
||||||
|
contents of the kill buffer.
|
||||||
|
* KeyBindings/DefaultKeyBindings.dict: Enable the keybinding for
|
||||||
|
the yank: command.
|
||||||
|
|
||||||
2010-02-12 Wolfgang Lux <wolfgang.lux@gmail.com>
|
2010-02-12 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
* Source/NSTextView.m (-_characterIndexForPoint:respectFraction:):
|
* Source/NSTextView.m (-_characterIndexForPoint:respectFraction:):
|
||||||
|
|
|
@ -69,5 +69,5 @@
|
||||||
"Control-p" = "moveUp:";
|
"Control-p" = "moveUp:";
|
||||||
"Control-t" = "transpose:";
|
"Control-t" = "transpose:";
|
||||||
"Control-v" = "pageDown:";
|
"Control-v" = "pageDown:";
|
||||||
/* "Control-y" = "yank:"; */
|
"Control-y" = "yank:";
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,6 +115,12 @@ send -shouldChangeTextInRange:replacementString: or -didChangeText.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* global kill buffer shared between all text views */
|
||||||
|
/* Note: I'm not using an attributed string here because Apple apparently is
|
||||||
|
using a plain string either. Maybe this is because NeXT was using the X11
|
||||||
|
cut buffer for the kill buffer, which can hold only plain strings? */
|
||||||
|
static NSString *killBuffer = @"";
|
||||||
|
|
||||||
/** First some helpers **/
|
/** First some helpers **/
|
||||||
|
|
||||||
@interface NSTextView (UserActionHelpers)
|
@interface NSTextView (UserActionHelpers)
|
||||||
|
@ -697,12 +703,18 @@ static NSNumber *float_plus_one(NSNumber *cur)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ASSIGN(killBuffer, [[_textStorage string] substringWithRange: range]);
|
||||||
[_textStorage beginEditing];
|
[_textStorage beginEditing];
|
||||||
[_textStorage deleteCharactersInRange: range];
|
[_textStorage deleteCharactersInRange: range];
|
||||||
[_textStorage endEditing];
|
[_textStorage endEditing];
|
||||||
[self didChangeText];
|
[self didChangeText];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) yank: (id)sender
|
||||||
|
{
|
||||||
|
[self insertText: killBuffer];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO: find out what affinity is supposed to mean
|
TODO: find out what affinity is supposed to mean
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue