import fix-for-SF1869862-searchline.patch
[nedit-bw.git] / backward_word_tail.patch
blobf346776b97a5c8b372d491bdb39e992f232d494c
1 Subject: "tail" option for backward_word()
3 NEdit*text.translations: #override \
4 Alt Shift Ctrl<KeyPress>osfLeft: backward_word("extend", "tail")\n\
5 Meta Shift Ctrl<KeyPress>osfLeft: backward_word("extend", "tail")\n\
6 Alt Ctrl<KeyPress>osfLeft: backward_word("tail")\n\
7 Meta Ctrl<KeyPress>osfLeft: backward_word("tail")\n\
8 Alt Shift Ctrl<KeyPress>osfRight: forward_word("extend", "tail")\n\
9 Meta Shift Ctrl<KeyPress>osfRight: forward_word("extend", "tail")\n\
10 Alt Ctrl<KeyPress>osfRight: forward_word("tail")\n\
11 Meta Ctrl<KeyPress>osfRight: forward_word("tail")\n\
12 ...
14 ---
16 doc/help.etx | 5 +++--
17 source/text.c | 21 +++++++++++++++++----
18 2 files changed, 20 insertions(+), 6 deletions(-)
20 diff --quilt old/source/text.c new/source/text.c
21 --- old/source/text.c
22 +++ new/source/text.c
23 @@ -2689,15 +2689,28 @@ static void backwardWordAP(Widget w, XEv
24 cancelDrag(w);
25 if (insertPos == 0) {
26 ringIfNecessary(silent, w);
27 return;
30 pos = max(insertPos - 1, 0);
31 - while (strchr(delimiters, BufGetCharacter(buf, pos)) != NULL && pos > 0)
32 - pos--;
33 - pos = startOfWord((TextWidget)w, pos);
35 + if (hasKey("tail", args, nArgs)) {
36 + pos = max(startOfWord((TextWidget)w, pos) - 1, 0);
37 + while (pos > 0) {
38 + if (strchr(delimiters, BufGetCharacter(buf, pos)) == NULL)
39 + break;
40 + pos--;
41 + }
42 + if (pos)
43 + pos++;
44 + }
45 + else {
46 + while (strchr(delimiters, BufGetCharacter(buf, pos)) != NULL && pos > 0)
47 + pos--;
48 + pos = startOfWord((TextWidget)w, pos);
49 + }
51 TextDSetInsertPosition(textD, pos);
52 checkMoveSelectionChange(w, event, insertPos, args, nArgs);
53 checkAutoShowInsertPos(w);
54 callCursorMovementCBs(w, event);
56 diff --quilt old/doc/help.etx new/doc/help.etx
57 --- old/doc/help.etx
58 +++ new/doc/help.etx
59 @@ -3310,15 +3310,16 @@ Action Routines
60 Moves the cursor to the beginning of the paragraph, or
61 if the cursor is already at the beginning of a paragraph, moves the cursor to
62 the beginning of the previous paragraph. Paragraphs are defined as regions
63 of text delimited by one or more blank lines.
65 -**backward_word( ["nobell"] )**
66 +**backward_word( ["tail"] ["nobell"] )**
67 Moves the cursor to the beginning of a word, or, if the
68 cursor is already at the beginning of a word, moves the cursor to the
69 beginning of the previous word. Word delimiters are user-settable, and
70 - defined by the X resource wordDelimiters.
71 + defined by the X resource wordDelimiters. If the "tail" argument is supplied
72 + the cursor is moved to the end of the next previous word.
74 **beginning_of_file( ["scrollbar"] )**
75 Moves the cursor to the beginning of the file.
77 **beginning_of_line( ["absolute"] )**