make makefile generic
[nedit-bw.git] / backward_word_tail.patch
blob47f44830de92a7943efabbb9b6f45db0c83bec61
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 @@ -2691,11 +2691,24 @@ static void backwardWordAP(Widget w, XEv
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 diff --quilt old/doc/help.etx new/doc/help.etx
53 --- old/doc/help.etx
54 +++ new/doc/help.etx
55 @@ -3312,11 +3312,12 @@ Action Routines
56 the beginning of the previous paragraph. Paragraphs are defined as regions
57 of text delimited by one or more blank lines.
59 -**backward_word( ["nobell"] )**
60 +**backward_word( ["tail"] ["nobell"] )**
61 Moves the cursor to the beginning of a word, or, if the
62 cursor is already at the beginning of a word, moves the cursor to the
63 beginning of the previous word. Word delimiters are user-settable, and
64 - defined by the X resource wordDelimiters.
65 + defined by the X resource wordDelimiters. If the "tail" argument is supplied
66 + the cursor is moved to the end of the next previous word.
68 **beginning_of_file( ["scrollbar"] )**
69 Moves the cursor to the beginning of the file.