Rev 8584 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8584 | Rev 8913 | ||
---|---|---|---|
Line 7... | Line 7... | ||
7 | void Parse() |
7 | void Parse() |
8 | { |
8 | { |
9 | dword ptr; |
9 | dword ptr; |
10 | int line_end; |
10 | int line_end; |
11 | dword line_length = 0; |
- | |
12 | dword line_start = textbuf.p; |
- | |
Line 13... | Line 11... | ||
13 | 11 | ||
14 | list.count=0; |
12 | list.count=0; |
15 | selection.cancel(); |
13 | selection.cancel(); |
Line 16... | Line 14... | ||
16 | if (list.w != canvas.bufw) canvas.Init(list.x, list.y, list.w, screen.height); |
14 | if (list.w != canvas.bufw) canvas.Init(list.x, list.y, list.w, screen.height); |
17 | 15 | ||
Line 18... | Line 16... | ||
18 | lines.drop(); |
16 | lines.drop(); |
19 | lines.add(textbuf.p); |
17 | lines.add(textbuf.p); |
20 | - | ||
21 | for (ptr = textbuf.p; ptr < textbuf.p + textbuf.len; ptr++) |
18 | |
22 | { |
19 | for (ptr = textbuf.p; ptr < textbuf.p + textbuf.len; ptr++) |
23 | line_length += list.font_w; |
- | |
24 | if (line_length + 30 >= list.w) || (ESBYTE[ptr] == '\n') |
- | |
25 | { |
20 | { |
26 | //if (ESBYTE[ptr+1] == '\r') ptr++; |
21 | if (ptr - lines.get_last() * list.font_w + 16 >= list.w) |
- | 22 | { |
|
- | 23 | //searching a 'white' for a normal word-break |
|
- | 24 | for(line_end = ptr; line_end != lines.get_last(); line_end--) { |
|
27 | 25 | if (__isWhite(ESBYTE[line_end])) { |
|
28 | //searching a 'white' for a normal word-break |
- | |
29 | for(line_end = ptr; line_end != line_start; line_end--) |
26 | ptr = line_end + 1; |
30 | { |
- | |
31 | if (__isWhite(ESBYTE[line_end])) { ptr=line_end+1; break; } |
27 | break; |
32 | } |
28 | } |
- | 29 | } |
|
- | 30 | list.count++; |
|
- | 31 | lines.add(ptr); |
|
33 | line_length = ptr - line_start * list.font_w; |
32 | } else if (ESBYTE[ptr] == '\x0D') { |
- | 33 | if (ESBYTE[ptr+1] == '\x0A') ptr++; |
|
- | 34 | list.count++; |
|
34 | list.count++; |
35 | lines.add(ptr+1); |
35 | lines.add(ptr); |
36 | } else if (ESBYTE[ptr] == '\x0A') { |
36 | line_start = ptr; |
37 | list.count++; |
37 | line_length = 0; |
38 | lines.add(ptr+1); |
38 | } |
39 | } |
39 | } |
40 | } |