Rev 9295 | Rev 9410 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9295 | Rev 9336 | ||
---|---|---|---|
Line 70... | Line 70... | ||
70 | edition*: tGuard; |
70 | edition*: tGuard; |
71 | comments, numbers*, guard, |
71 | comments, numbers*, guard, |
72 | search, cs, whole: BOOLEAN; |
72 | search, cs, whole: BOOLEAN; |
73 | curLine: tLine; |
73 | curLine: tLine; |
74 | lang*: INTEGER; |
74 | lang*: INTEGER; |
75 | enc*, eol*: INTEGER; |
75 | enc, eol: INTEGER; |
76 | table: Search.IdxTable; |
76 | table: Search.IdxTable; |
77 | foundList: List.tList; |
77 | foundList: List.tList; |
78 | idxData: Search.tBuffer; |
78 | idxData: Search.tBuffer; |
79 | foundSel: INTEGER; |
79 | foundSel: INTEGER; |
80 | searchText: tString; |
80 | searchText: tString; |
Line 881... | Line 881... | ||
881 | text.search := TRUE; |
881 | text.search := TRUE; |
882 | text.guard := TRUE |
882 | text.guard := TRUE |
883 | END modify; |
883 | END modify; |
Line -... | Line 884... | ||
- | 884 | ||
- | 885 | ||
- | 886 | PROCEDURE setEnc* (text: tText; enc: INTEGER); |
|
- | 887 | BEGIN |
|
- | 888 | IF text.enc # enc THEN |
|
- | 889 | ChangeLog.changeInt(text.enc, enc); |
|
- | 890 | text.enc := enc; |
|
- | 891 | modify(text) |
|
- | 892 | END |
|
- | 893 | END setEnc; |
|
- | 894 | ||
- | 895 | ||
- | 896 | PROCEDURE setEol* (text: tText; eol: INTEGER); |
|
- | 897 | BEGIN |
|
- | 898 | IF text.eol # eol THEN |
|
- | 899 | ChangeLog.changeInt(text.eol, eol); |
|
- | 900 | text.eol := eol; |
|
- | 901 | modify(text) |
|
- | 902 | END |
|
- | 903 | END setEol; |
|
- | 904 | ||
- | 905 | ||
- | 906 | PROCEDURE getEnc* (text: tText): INTEGER; |
|
- | 907 | RETURN text.enc |
|
- | 908 | END getEnc; |
|
- | 909 | ||
- | 910 | ||
- | 911 | PROCEDURE getEol* (text: tText): INTEGER; |
|
- | 912 | RETURN text.eol |
|
- | 913 | END getEol; |
|
884 | 914 | ||
885 | 915 | ||
886 | PROCEDURE DelLine (text: tText; line: tLine); |
916 | PROCEDURE DelLine (text: tText; line: tLine); |
887 | BEGIN |
917 | BEGIN |
888 | List._delete(text, line); |
918 | List._delete(text, line); |
Line 1799... | Line 1829... | ||
1799 | END; |
1829 | END; |
1800 | IF search(text, str, Lang.isCS(text.lang), TRUE) THEN END |
1830 | IF search(text, str, Lang.isCS(text.lang), TRUE) THEN END |
1801 | END wordSel; |
1831 | END wordSel; |
Line -... | Line 1832... | ||
- | 1832 | ||
- | 1833 | ||
- | 1834 | PROCEDURE getWordPos (line: tLine; pos: INTEGER): INTEGER; |
|
- | 1835 | VAR |
|
- | 1836 | c: WCHAR; |
|
- | 1837 | ||
- | 1838 | BEGIN |
|
- | 1839 | c := getChar(line, pos); |
|
- | 1840 | IF isWordChar(c) THEN |
|
- | 1841 | WHILE (pos < line.length) & isWordChar(getChar(line, pos)) DO |
|
- | 1842 | INC(pos) |
|
- | 1843 | END |
|
- | 1844 | ELSIF Lines.isSpace(c) THEN |
|
- | 1845 | WHILE (pos < line.length) & Lines.isSpace(getChar(line, pos)) DO |
|
- | 1846 | INC(pos) |
|
- | 1847 | END |
|
- | 1848 | ELSE |
|
- | 1849 | WHILE (pos < line.length) & ~Lines.isSpace(getChar(line, pos)) & ~isWordChar(getChar(line, pos)) DO |
|
- | 1850 | INC(pos) |
|
- | 1851 | END |
|
- | 1852 | END |
|
- | 1853 | RETURN pos |
|
- | 1854 | END getWordPos; |
|
1802 | 1855 | ||
1803 | 1856 | ||
1804 | PROCEDURE key* (text: tText; code: INTEGER; shift, ctrl: BOOLEAN); |
1857 | PROCEDURE key* (text: tText; code: INTEGER; shift, ctrl: BOOLEAN); |
1805 | VAR |
1858 | VAR |
1806 | n: INTEGER; |
1859 | n, wPos: INTEGER; |
1807 | BEGIN |
1860 | BEGIN |
1808 | IF shift THEN |
1861 | IF shift THEN |
1809 | setSelect(text) |
1862 | setSelect(text) |
Line 1847... | Line 1900... | ||
1847 | END |
1900 | END |
1848 | |37: |
1901 | |37: |
1849 | IF (text.cursor.X = 0) & (text.curLine.prev # NIL) THEN |
1902 | IF (text.cursor.X = 0) & (text.curLine.prev # NIL) THEN |
1850 | SetPos(text, text.curLine.prev(tLine).length, text.cursor.Y - 1) |
1903 | SetPos(text, text.curLine.prev(tLine).length, text.cursor.Y - 1) |
1851 | ELSE |
1904 | ELSE |
- | 1905 | IF ctrl THEN |
|
- | 1906 | wPos := 0; |
|
- | 1907 | REPEAT |
|
- | 1908 | n := wPos; |
|
- | 1909 | wPos := getWordPos(text.curLine, wPos) |
|
- | 1910 | UNTIL wPos >= text.cursor.X; |
|
- | 1911 | move(text, n - text.cursor.X) |
|
- | 1912 | ELSE |
|
1852 | move(text, -1) |
1913 | move(text, -1) |
1853 | END |
1914 | END |
- | 1915 | END |
|
1854 | |38: |
1916 | |38: |
1855 | IF ctrl THEN |
1917 | IF ctrl THEN |
1856 | upLine(text) |
1918 | upLine(text) |
1857 | ELSE |
1919 | ELSE |
1858 | UpDown(text, -1) |
1920 | UpDown(text, -1) |
1859 | END |
1921 | END |
1860 | |39: |
1922 | |39: |
1861 | IF (text.cursor.X = text.curLine.length) & (text.curLine.next # NIL) THEN |
1923 | IF (text.cursor.X = text.curLine.length) & (text.curLine.next # NIL) THEN |
1862 | SetPos(text, 0, text.cursor.Y + 1) |
1924 | SetPos(text, 0, text.cursor.Y + 1) |
1863 | ELSE |
1925 | ELSE |
- | 1926 | IF ctrl THEN |
|
- | 1927 | move(text, getWordPos(text.curLine, text.cursor.X) - text.cursor.X) |
|
- | 1928 | ELSE |
|
1864 | move(text, 1) |
1929 | move(text, 1) |
1865 | END |
1930 | END |
- | 1931 | END |
|
1866 | |40: |
1932 | |40: |
1867 | IF ctrl THEN |
1933 | IF ctrl THEN |
1868 | downLine(text) |
1934 | downLine(text) |
1869 | ELSE |
1935 | ELSE |
1870 | UpDown(text, 1) |
1936 | UpDown(text, 1) |
Line 2290... | Line 2356... | ||
2290 | errno := 0; |
2356 | errno := 0; |
2291 | text := NIL; |
2357 | text := NIL; |
2292 | file := RW.load(name, enc, eol); |
2358 | file := RW.load(name, enc, eol); |
2293 | IF file # NIL THEN |
2359 | IF file # NIL THEN |
2294 | text := create(name); |
2360 | text := create(name); |
- | 2361 | ChangeLog.changeInt(text.enc, enc); |
|
- | 2362 | ChangeLog.changeInt(text.eol, eol); |
|
2295 | text.enc := enc; |
2363 | text.enc := enc; |
2296 | text.eol := eol; |
2364 | text.eol := eol; |
2297 | line := Lines.create(FALSE); |
2365 | line := Lines.create(FALSE); |
2298 | List._append(text, line); |
2366 | List._append(text, line); |
2299 | REPEAT |
2367 | REPEAT |
Line 2449... | Line 2517... | ||
2449 | text: tText; |
2517 | text: tText; |
2450 | BEGIN |
2518 | BEGIN |
2451 | text := create(""); |
2519 | text := create(""); |
2452 | List._append(text, Lines.create(FALSE)); |
2520 | List._append(text, Lines.create(FALSE)); |
2453 | text.curLine := text.first(tLine); |
2521 | text.curLine := text.first(tLine); |
- | 2522 | ChangeLog.changeInt(text.enc, E.CP866); |
|
- | 2523 | ChangeLog.changeInt(text.eol, RW.EOL_CRLF); |
|
2454 | text.enc := E.CP866; |
2524 | text.enc := E.CP866; |
2455 | text.eol := RW.EOL_CRLF; |
2525 | text.eol := RW.EOL_CRLF; |
2456 | SetPos(text, 0, 0); |
2526 | SetPos(text, 0, 0); |
2457 | resetSelect(text) |
2527 | resetSelect(text) |
2458 | RETURN text |
2528 | RETURN text |