update
[nedit-bw.git] / fix-tipsfile-parser-at-eof.patch
blobc0704c1404d0e264f1c3f9148cde774ffc0a5437
1 To: develop@nedit.org
2 Subject: [PATCH] Fix tipsfile parser wrt to eof
4 For include and alias blocks, the parser missed the last content line, if no
5 explicit empty line is at the end of file. I.e.:
7 --------8<--------
8 * language *
11 hello
12 world
14 * alias *
15 hello
16 hallo
17 welt
18 juhu
19 -------->8--------
21 'juhu' would not be an alias to 'hello'. You get a parser error if the alias
22 block has only one alias:
24 --------8<--------
25 * language *
28 hello
29 world
31 * alias *
32 hello
33 hallo
34 -------->8--------
36 The current workaround is to add one explicit empty line:
37 --------8<--------
38 * language *
41 hello
42 world
44 * alias *
45 hello
46 hallo
48 -------->8--------
50 This patch should fix it.
52 Regards,
53 Bert Wesarg
55 ---
57 source/tags.c | 4 ++--
58 1 file changed, 2 insertions(+), 2 deletions(-)
60 diff --quilt old/source/tags.c new/source/tags.c
61 --- old/source/tags.c
62 +++ new/source/tags.c
63 @@ -1811,9 +1811,9 @@ static int nextTFBlock(FILE *fp, char *h
64 if (incPos < 0)
65 return TF_ERROR;
66 /* Figure out how long the block is */
67 - while((status=fgets(line, MAXLINE, fp))) {
68 + while((status=fgets(line, MAXLINE, fp)) || feof(fp)) {
69 ++(*currLine);
70 - if(lineEmpty( line ))
71 + if(feof(fp) || lineEmpty( line ))
72 break;
74 incLen = ftell(fp) - incPos;