add cast to XtCalloc() call
[nedit-bw.git] / extended-paragraph-end.patch
blob664f1db857d46df23a767623c9d3387da8572667
1 Subject: "end" option for paragraph jumping
3 With the "end" option paragraph jumping stops at the first blank line after
4 a paragraph.
6 ---
8 doc/help.etx | 13 +++++++++----
9 source/text.c | 16 +++++++++-------
10 2 files changed, 18 insertions(+), 11 deletions(-)
12 diff --quilt old/source/text.c new/source/text.c
13 --- old/source/text.c
14 +++ new/source/text.c
15 @@ -2771,31 +2771,32 @@ static void forwardParagraphAP(Widget w,
17 textDisp *textD = ((TextWidget)w)->text.textD;
18 int pos, insertPos = TextDGetInsertPosition(textD);
19 textBuffer *buf = textD->buffer;
20 int silent = hasKey("nobell", args, nArgs);
21 + int not_end = !hasKey("end", args, nArgs);
23 cancelDrag(w);
25 /* check if we are at the end of the file, than return */
26 if (insertPos == buf->length) {
27 ringIfNecessary(silent, w);
28 return;
31 /* need to skip current paragraph? */
32 - if (!lineIsBlank(buf, insertPos, &pos)) {
33 + if (not_end != lineIsBlank(buf, insertPos, &pos)) {
34 while (pos < buf->length) {
35 - if (nextLineIsBlank(buf, pos, &pos)) {
36 + if (not_end == nextLineIsBlank(buf, pos, &pos)) {
37 break;
42 /* skip all blank lines */
43 while (pos < buf->length) {
44 - if (!nextLineIsBlank(buf, pos, &pos)) {
45 + if (not_end != nextLineIsBlank(buf, pos, &pos)) {
46 break;
50 TextDSetInsertPosition(textD, min(pos, buf->length));
51 @@ -2809,32 +2810,33 @@ static void backwardParagraphAP(Widget w
53 textDisp *textD = ((TextWidget)w)->text.textD;
54 int parStart, pos, insertPos = TextDGetInsertPosition(textD);
55 textBuffer *buf = textD->buffer;
56 int silent = hasKey("nobell", args, nArgs);
57 + int not_end = !hasKey("end", args, nArgs);
59 cancelDrag(w);
61 /* check if we are at the beginning of the file, than return */
62 if (0 == insertPos) {
63 ringIfNecessary(silent, w);
64 return;
67 - if (lineIsBlank(buf, insertPos, &parStart)
68 + if (not_end == lineIsBlank(buf, insertPos, &parStart)
69 || (insertPos == parStart
70 - && prevLineIsBlank(buf, parStart, &parStart))) {
71 + && not_end == prevLineIsBlank(buf, parStart, &parStart))) {
72 while (parStart > 0) {
73 - if (!prevLineIsBlank(buf, parStart, &pos)) {
74 + if (not_end != prevLineIsBlank(buf, parStart, &pos)) {
75 break;
77 parStart = pos;
81 while (parStart > 0) {
82 - if (prevLineIsBlank(buf, parStart, &pos)) {
83 + if (not_end == prevLineIsBlank(buf, parStart, &pos)) {
84 break;
86 parStart = pos;
89 diff --quilt old/doc/help.etx new/doc/help.etx
90 --- old/doc/help.etx
91 +++ new/doc/help.etx
92 @@ -3304,15 +3304,17 @@ Action Routines
93 is supplied.
95 **backward_character( ["nobell"] )**
96 Moves the cursor one character to the left.
98 -**backward_paragraph(["nobell"] )**
99 +**backward_paragraph( ["end"] ["nobell"] )**
100 Moves the cursor to the beginning of the paragraph, or
101 if the cursor is already at the beginning of a paragraph, moves the cursor to
102 the beginning of the previous paragraph. Paragraphs are defined as regions
103 - of text delimited by one or more blank lines.
104 + of text delimited by one or more blank lines. If the "end" option is given
105 + the cursor is moved to the end of previous paragraph. The end of a paragraph
106 + is the first blank line after the paragraph, if any.
108 **backward_word( ["tail"] ["nobell"] )**
109 Moves the cursor to the beginning of a word, or, if the
110 cursor is already at the beginning of a word, moves the cursor to the
111 beginning of the previous word. Word delimiters are user-settable, and
112 @@ -3429,14 +3431,17 @@ Action Routines
113 negative-index (numbers less than 0, -1 is the same as "last").
115 **forward_character()**
116 Moves the cursor one character to the right.
118 -**forward_paragraph( ["nobell"] )**
119 +**forward_paragraph( ["end"] ["nobell"] )**
120 Moves the cursor to the beginning of the next paragraph.
121 Paragraphs are defined as regions of text delimited by one or more blank
122 - lines.
123 + lines. If the "end" optione is given, the cursor is moved to the end of the
124 + current paragraph, or to the end of the next paragraph if the current line
125 + is a blank line. The end of a paragraph is the first blank line after the
126 + paragraph, if any.
128 **forward_word( ["tail"] ["nobell"] )**
129 Moves the cursor to the beginning of the next word. Word
130 delimiters are user-settable, and defined by the X resource wordDelimiters.
131 If the "tail" argument is supplied the cursor will be moved to