/programs/develop/cedit/CEDIT |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/programs/develop/cedit/SRC/CEdit.ob07 |
---|
1,5 → 1,5 |
(* |
Copyright 2021 Anton Krotov |
Copyright 2021, 2022 Anton Krotov |
This file is part of CEdit. |
28,7 → 28,7 |
RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar; |
CONST |
HEADER = "CEdit (30-dec-2021)"; |
HEADER = "CEdit (02-jan-2022)"; |
ShellFilter = ""; |
EditFilter = "SH|INC|TXT|ASM|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON"; |
1793,10 → 1793,12 |
|btnFindNext: |
IF searchText # "" THEN |
notFound := ~T.findNext(text, BKW.value); |
SetFocus(FindEdit, FALSE); |
repaint |
END |
|btnReplace: |
T.replace(text, replaceText, LENGTH(searchText)); |
SetFocus(FindEdit, FALSE); |
repaint |
|btnReplaceAll: |
notFound := ~T.search(text, searchText, cs, whole); |
1803,6 → 1805,7 |
IF ~notFound THEN |
replaced := T.replaceAll(text, replaceText, LENGTH(searchText)); |
END; |
SetFocus(FindEdit, FALSE); |
repaint |
|btnGoto: |
goto; |
/programs/develop/cedit/SRC/Clipboard.ob07 |
---|
1,5 → 1,5 |
(* |
Copyright 2021 Anton Krotov |
Copyright 2021, 2022 Anton Krotov |
This file is part of CEdit. |
24,7 → 24,6 |
CONST |
TTEXT = 0; |
lenEOL* = 2; |
TAB = 9X; |
TYPE |
tBuffer* = POINTER TO RECORD |
60,11 → 59,14 |
ptr := buffer.dataPtr; |
WHILE cnt > 0 DO |
SYSTEM.GET(ptr, wch); |
IF wch # Lines.TAB1 THEN |
IF wch = Lines.TAB1 THEN |
DEC(size) |
ELSIF wch = Lines.NUL THEN |
SYSTEM.PUT(pchar, 0X); |
INC(pchar) |
ELSE |
SYSTEM.PUT(pchar, CHR(E.UNI[ORD(wch), E.CP866] MOD 256)); |
INC(pchar) |
ELSE |
DEC(size); |
END; |
INC(ptr, 2); |
DEC(cnt) |
/programs/develop/cedit/SRC/Graph.ob07 |
---|
1,5 → 1,5 |
(* |
Copyright 2021 Anton Krotov |
Copyright 2021, 2022 Anton Krotov |
This file is part of CEdit. |
282,6 → 282,9 |
ELSE |
color := canvas.textColor |
END; |
IF c = Lines.NUL THEN |
c := 0X |
END; |
KOSAPI.sysfunc6(4, x*65536 + y, font + color, SYSTEM.ADR(c), 1, canvas.bitmap - 8) |
END; |
INC(x, canvas.font.width); |
/programs/develop/cedit/SRC/Lines.ob07 |
---|
1,5 → 1,5 |
(* |
Copyright 2021 Anton Krotov |
Copyright 2021, 2022 Anton Krotov |
This file is part of CEdit. |
26,7 → 26,8 |
WCHAR_SIZE = 2; |
SPACE* = 20X; |
TAB* = 9X; |
TAB1* = 0FFFEX; |
NUL* = 0FDD0X; |
TAB1* = 0FDD1X; |
TYPE |
/programs/develop/cedit/SRC/List.ob07 |
---|
1,5 → 1,5 |
(* |
Copyright 2021 Anton Krotov |
Copyright 2021, 2022 Anton Krotov |
This file is part of CEdit. |
151,6 → 151,7 |
VAR |
next: tItem; |
BEGIN |
IF item # NIL THEN |
next := item.next; |
IF next # NIL THEN |
movPtr(next.prev, newItem); |
161,40 → 162,15 |
ELSE |
_append(list, newItem) |
END |
END _insert; |
PROCEDURE _exchange* (list: tList; a, b: tItem); |
VAR |
a0, b0: tItem; |
BEGIN |
IF (a # NIL) & (b # NIL) THEN |
ASSERT((a.next = b) & (b.prev = a)); |
a0 := a.prev; |
b0 := b.next; |
movPtr(b.prev, a0); |
movPtr(a.next, b0); |
movPtr(b.next, a); |
movPtr(a.prev, b); |
IF a0 # NIL THEN |
IF b0 # NIL THEN |
movPtr(a0.next, b); |
movPtr(b0.prev, a); |
ELSE |
movPtr(a0.next, b); |
movPtr(list.last, a) |
ASSERT(list.first # NIL); |
movPtr(newItem.prev, NIL); |
movPtr(newItem.next, list.first); |
movPtr(list.first.prev, newItem); |
movPtr(list.first, newItem); |
movInt(list.count, list.count + 1) |
END |
ELSE |
IF b0 # NIL THEN |
movPtr(b0.prev, a); |
movPtr(list.first, b) |
ELSE |
movPtr(list.first, b); |
movPtr(list.last, a) |
END |
END |
END |
END _exchange; |
END _insert; |
PROCEDURE append* (list: tList; item: tItem); |
/programs/develop/cedit/SRC/RW.ob07 |
---|
1,5 → 1,5 |
(* |
Copyright 2021 Anton Krotov |
Copyright 2021, 2022 Anton Krotov |
This file is part of CEdit. |
178,11 → 178,14 |
c := WCHR(file.getChar(file) MOD 65536); |
IF c = Lines.TAB1 THEN |
c := SPACE |
ELSIF c = 0X THEN |
c := Lines.NUL |
END; |
IF c = CR THEN |
eol := TRUE; |
file.CR := TRUE |
ELSIF (c = LF) OR (c = 0X) THEN |
ELSIF c = LF THEN |
IF ~file.CR THEN |
eol := TRUE |
END; |
424,7 → 427,11 |
BEGIN |
FOR i := 0 TO n - 1 DO |
c := Lines.getChar(line, i); |
IF c # Lines.TAB1 THEN |
IF c = Lines.TAB1 THEN |
(* nothing to do *) |
ELSIF c = Lines.NUL THEN |
file.putChar(file, 0) |
ELSE |
file.putChar(file, ORD(c)) |
END |
END |
/programs/develop/cedit/SRC/Text.ob07 |
---|
1,5 → 1,5 |
(* |
Copyright 2021 Anton Krotov |
Copyright 2021, 2022 Anton Krotov |
This file is part of CEdit. |
1805,48 → 1805,20 |
END dupLine; |
PROCEDURE exchange (text: tText; first, second: tLine); |
BEGIN |
List._exchange(text, first, second); |
Lines.modify(text.curLine); |
modify(text); |
UpDown(text, 0) |
END exchange; |
PROCEDURE upLine (text: tText); |
BEGIN |
DEC(text.cursor.Y); |
exchange(text, text.curLine.prev(tLine), text.curLine) |
END upLine; |
PROCEDURE downLine (text: tText); |
BEGIN |
INC(text.cursor.Y); |
exchange(text, text.curLine, text.curLine.next(tLine)) |
END downLine; |
PROCEDURE MoveLines* (text: tText; down: BOOLEAN); |
VAR |
last: tLine; |
last, first, line: tLine; |
selBeg, selEnd, temp: tPoint; |
n, step: INTEGER; |
step: INTEGER; |
frw: BOOLEAN; |
moveLine: PROCEDURE (text: tText); |
BEGIN |
getSelect(text, selBeg, selEnd); |
IF (selBeg.Y > 0) & ~down OR (selEnd.Y < text.count - 1) & down THEN |
IF down THEN |
step := -2; |
moveLine := downLine |
ELSE |
step := 2; |
moveLine := upLine |
END; |
IF ((selBeg.Y > 0) & ~down OR (selEnd.Y < text.count - 1) & down) THEN |
modify(text); |
step := ORD(down)*2 - 1; |
IF selBeg.Y # selEnd.Y THEN |
frw := (text.cursor.X = selEnd.X) & (text.cursor.Y = selEnd.Y); |
IF selEnd.Y # selBeg.Y THEN |
IF down # frw THEN |
temp := text.cursor^; |
SetPos(text, 0, text.select.Y); |
1853,30 → 1825,59 |
setSelect(text); |
text.select^ := temp |
END; |
ASSERT(selBeg.Y < selEnd.Y); |
first := getLine(text, selBeg.Y); |
last := getLine(text, selEnd.Y); |
line := first; |
Lines.modify(line); |
REPEAT |
NextLine(line); |
Lines.modify(line) |
UNTIL line = last; |
IF down THEN |
text.curLine := last.prev(tLine) |
ELSE |
text.curLine := first.next(tLine) |
END; |
selBeg.X := 0; |
selEnd.X := last.length; |
n := selEnd.Y - selBeg.Y + 1; |
WHILE n > 0 DO |
moveLine(text); |
SetPos(text, 0, text.cursor.Y + step); |
DEC(n) |
END |
IF down THEN |
last := last.next(tLine); |
List._delete(text, last); |
List._insert(text, first.prev, last) |
ELSE |
moveLine(text) |
first := first.prev(tLine); |
List._delete(text, first); |
List._insert(text, last, first) |
END; |
IF frw THEN |
IF down THEN |
temp := selBeg; |
selBeg := selEnd; |
selEnd := temp |
selEnd := temp; |
END; |
step := step DIV 2; |
SetPos(text, selBeg.X, selBeg.Y - step); |
SetPos(text, selBeg.X, selBeg.Y + step); |
setSelect(text); |
text.select.X := selEnd.X; |
text.select.Y := selEnd.Y - step |
text.select.Y := selEnd.Y + step |
ELSE |
first := getLine(text, selBeg.Y); |
Lines.modify(first); |
IF down THEN |
last := first.next(tLine) |
ELSE |
last := first.prev.prev(tLine) |
END; |
List._delete(text, first); |
List._insert(text, last, first); |
INC(text.cursor.Y, step); |
INC(text.select.Y, step); |
SetPos(text, text.cursor.X, text.cursor.Y) |
END |
END |
END MoveLines; |
2541,18 → 2542,6 |
END findNext; |
PROCEDURE rewrite (line: tLine; repl: ARRAY OF WCHAR; pos, n: INTEGER); |
BEGIN |
IF n > 0 THEN |
Lines.copy(line) |
END; |
WHILE n > 0 DO |
DEC(n); |
Lines.setChar(line, pos + n, repl[n]) |
END |
END rewrite; |
PROCEDURE replace* (text: tText; s: ARRAY OF WCHAR; n: INTEGER); |
VAR |
line: tLine; |
2564,11 → 2553,15 |
i := text.cursor.X; |
IF sLen > n THEN |
Lines.insert3(line, i, sLen - n) |
ELSIF n > sLen THEN |
Lines.delCharN(line, i, n - sLen) |
ELSE (* n = sLen *) |
Lines.copy(line) |
END; |
SetPos(text, i + sLen, text.cursor.Y); |
rewrite(line, s, i, sLen); |
IF n > sLen THEN |
Lines.delCharN(line, text.cursor.X, n - sLen) |
WHILE sLen > 0 DO |
DEC(sLen); |
Lines.setChar(line, i + sLen, s[sLen]) |
END; |
resetSelect(text); |
Lines.modify(line); |