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