Rev 9175 | Rev 9181 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9175 | Rev 9180 | ||
---|---|---|---|
Line 73... | Line 73... | ||
73 | search, cs, whole: BOOLEAN; |
73 | search, cs, whole: BOOLEAN; |
74 | curLine: tLine; |
74 | curLine: tLine; |
75 | fileName*: RW.tFileName; |
75 | fileName*: RW.tFileName; |
76 | lang*: INTEGER; |
76 | lang*: INTEGER; |
77 | enc*: INTEGER; |
77 | enc*: INTEGER; |
- | 78 | eol*: INTEGER; |
|
78 | table: Search.IdxTable; |
79 | table: Search.IdxTable; |
79 | foundList: List.tList; |
80 | foundList: List.tList; |
80 | idxData: Search.tBuffer; |
81 | idxData: Search.tBuffer; |
81 | foundSel: INTEGER; |
82 | foundSel: INTEGER; |
82 | searchText: tString; |
83 | searchText: tString; |
Line 1335... | Line 1336... | ||
1335 | text.scroll.X := MIN(MAX(text.scroll.X, 0), text.maxLength); |
1336 | text.scroll.X := MIN(MAX(text.scroll.X, 0), text.maxLength); |
1336 | text.scroll.Y := MIN(MAX(text.scroll.Y, 0), text.count - 1) |
1337 | text.scroll.Y := MIN(MAX(text.scroll.Y, 0), text.count - 1) |
1337 | END scroll; |
1338 | END scroll; |
Line 1338... | Line 1339... | ||
1338 | 1339 | ||
1339 | 1340 | ||
1340 | PROCEDURE save* (text: tText; name: RW.tFileName; enc, nl: INTEGER): BOOLEAN; |
1341 | PROCEDURE save* (text: tText; name: RW.tFileName): BOOLEAN; |
1341 | CONST |
1342 | CONST |
1342 | tempFile = "/tmp0/1/cedit~.tmp"; |
1343 | tempFile = "/tmp0/1/cedit~.tmp"; |
1343 | VAR |
1344 | VAR |
1344 | line: tLine; |
1345 | line: tLine; |
1345 | file: RW.tOutput; |
1346 | file: RW.tOutput; |
1346 | res: BOOLEAN; |
1347 | res: BOOLEAN; |
1347 | Len: INTEGER; |
1348 | Len: INTEGER; |
1348 | BEGIN |
1349 | BEGIN |
1349 | ChangeLog.setGuard(text.edition); |
1350 | ChangeLog.setGuard(text.edition); |
1350 | res := TRUE; |
1351 | res := TRUE; |
1351 | file := RW.create(tempFile, enc, nl); |
1352 | file := RW.create(tempFile, text.enc, text.eol); |
1352 | IF file # NIL THEN |
1353 | IF file # NIL THEN |
1353 | ChangeLog.delSaved; |
1354 | ChangeLog.delSaved; |
1354 | line := text.first(tLine); |
1355 | line := text.first(tLine); |
Line 2302... | Line 2303... | ||
2302 | 2303 | ||
2303 | PROCEDURE open* (name: RW.tFileName; VAR errno: INTEGER): tText; |
2304 | PROCEDURE open* (name: RW.tFileName; VAR errno: INTEGER): tText; |
2304 | VAR |
2305 | VAR |
2305 | text: tText; |
2306 | text: tText; |
2306 | file: RW.tInput; |
2307 | file: RW.tInput; |
2307 | n, enc: INTEGER; |
2308 | n, enc, eol: INTEGER; |
2308 | eol: BOOLEAN; |
2309 | _eol: BOOLEAN; |
2309 | line: tLine; |
2310 | line: tLine; |
2310 | BEGIN |
2311 | BEGIN |
2311 | errno := 0; |
2312 | errno := 0; |
2312 | text := NIL; |
2313 | text := NIL; |
2313 | file := RW.load(name, enc); |
2314 | file := RW.load(name, enc, eol); |
2314 | IF file # NIL THEN |
2315 | IF file # NIL THEN |
2315 | text := create(name); |
2316 | text := create(name); |
- | 2317 | text.enc := enc; |
|
- | 2318 | text.eol := eol; |
|
- | 2319 | line := Lines.create(FALSE); |
|
2316 | text.enc := enc; |
2320 | List._append(text, line); |
- | 2321 | REPEAT |
|
- | 2322 | n := RW.getString(file, line, Lines.tabs, _eol); |
|
2317 | REPEAT |
2323 | IF _eol THEN |
2318 | line := Lines.create(FALSE); |
- | |
2319 | n := RW.getString(file, line, Lines.tabs, eol); |
- | |
2320 | IF n >= 0 THEN |
2324 | line := Lines.create(FALSE); |
2321 | List._append(text, line) |
- | |
2322 | ELSE |
- | |
2323 | Lines.destroy(line) |
2325 | List._append(text, line) |
2324 | END |
2326 | END |
2325 | UNTIL n < 0; |
2327 | UNTIL ~_eol; |
2326 | RW.destroy(file); |
- | |
2327 | IF n = -1 THEN |
- | |
2328 | IF text.count = 0 THEN |
- | |
2329 | List._append(text, Lines.create(FALSE)) |
- | |
2330 | END; |
2328 | RW.destroy(file); |
2331 | text.curLine := text.first(tLine); |
2329 | text.curLine := text.first(tLine); |
2332 | SetPos(text, 0, 0); |
2330 | SetPos(text, 0, 0); |
2333 | resetSelect(text) |
- | |
2334 | END |
2331 | resetSelect(text) |
2335 | ELSE |
2332 | ELSE |
2336 | errno := 1 |
2333 | errno := 1 |
2337 | END; |
2334 | END; |
2338 | IF (text # NIL) & (text.lang # Lang.langNone) THEN |
2335 | IF (text # NIL) & (text.lang # Lang.langNone) THEN |
Line 2475... | Line 2472... | ||
2475 | BEGIN |
2472 | BEGIN |
2476 | text := create(""); |
2473 | text := create(""); |
2477 | List._append(text, Lines.create(FALSE)); |
2474 | List._append(text, Lines.create(FALSE)); |
2478 | text.curLine := text.first(tLine); |
2475 | text.curLine := text.first(tLine); |
2479 | text.enc := E.CP866; |
2476 | text.enc := E.CP866; |
- | 2477 | text.eol := RW.EOL_CRLF; |
|
2480 | SetPos(text, 0, 0); |
2478 | SetPos(text, 0, 0); |
2481 | resetSelect(text) |
2479 | resetSelect(text) |
2482 | RETURN text |
2480 | RETURN text |
2483 | END New; |
2481 | END New; |