[CEdit, FB2 Reader]: minor fixes

git-svn-id: svn://kolibrios.org@9599 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Anton Krotov 2022-01-08 21:10:10 +00:00
parent eb8c7e7663
commit ef33c606ec
7 changed files with 49 additions and 52 deletions

Binary file not shown.

Binary file not shown.

View File

@ -28,7 +28,7 @@ IMPORT
RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
CONST
HEADER = "CEdit (05-jan-2022)";
HEADER = "CEdit (08-jan-2022)";
ShellFilter = "";
EditFilter = "SH|INC|TXT|ASM|OB07|C|CPP|H|PAS|PP|LUA|INI|JSON";
@ -404,6 +404,8 @@ BEGIN
CheckBox.paint(WH);
END;
G.SetColor(canvas, K.borderColor);
G.VLine(canvas, 0, 0, canvas.height - 1);
G.DrawCanvas(canvas, LEFT, TOP);
NotFound;
Replaced;
@ -1952,7 +1954,7 @@ VAR
fileName, filePath: RW.tFileName;
width, height, cliWidth, cliHeight: INTEGER;
resized: BOOLEAN;
firstClickX, firstClickY, time: INTEGER;
firstClickX, firstClickY, time, blink: INTEGER;
BEGIN
header := "";
K.GetSystemColors;
@ -2066,11 +2068,17 @@ BEGIN
K.SetEventsMask({0, 1, 2, 5, 6, 31});
Menu.init(resetTimer);
draw_window;
blink := Ini.blink;
IF blink <= 0 THEN
blink := 0
ELSIF blink < 30 THEN
blink := 30
END;
timerEnabled := TRUE;
CursorTime := K.GetTickCount();
WHILE TRUE DO
CurrentTime := K.GetTickCount();
IF (CurrentTime - CursorTime > Ini.blink) & timerEnabled THEN
IF (CurrentTime - CursorTime > blink) & (blink > 0) & timerEnabled THEN
CursorTime := CurrentTime;
T.toggleCursor;
repaint

View File

@ -49,7 +49,7 @@ VAR
ptr, pchar: INTEGER;
wch: WCHAR;
BEGIN
cnt := bufSize(buffer) DIV 2;
cnt := bufSize(buffer) DIV SYSTEM.SIZE(WCHAR);
size := cnt + 12;
a := KOSAPI.malloc(size);
ASSERT(a # 0);

View File

@ -151,11 +151,6 @@ PROCEDURE getSettings* (VAR build, run, debug: RW.tFileName);
BEGIN
Lines.setTabs(get_int(IniFileName, "settings", "tab", 4));
blink := get_int(IniFileName, "settings", "blink", 70);
IF blink = 0 THEN
blink := -1
ELSE
blink := MIN(MAX(blink, 1), 1000)
END;
getStr("settings", "build", build);
getStr("settings", "run", run);
getStr("settings", "debug", debug)

View File

@ -497,7 +497,10 @@ BEGIN
_tab := 4
END;
tabs := _tab > 0;
tab := ABS(_tab)
tab := ABS(_tab);
IF tab > 32 THEN
tab := 32
END
END setTabs;

View File

@ -26,7 +26,6 @@ IMPORT
RW, Search,
E := Encodings,
CB := Clipboard,
K := KolibriOS,
ChangeLog, File,
Lang := Languages;
@ -75,7 +74,6 @@ TYPE
enc, eol: INTEGER;
table: Search.IdxTable;
foundList: List.tList;
idxData: Search.tBuffer;
foundSel: INTEGER;
searchText: tString;
chLog*: ChangeLog.tLog;
@ -818,7 +816,7 @@ BEGIN
END leadingSpaces;
PROCEDURE plain (text: tText; eot: BOOLEAN): CB.tBuffer;
PROCEDURE plain (text: tText): CB.tBuffer;
VAR
buf: CB.tBuffer;
size: INTEGER;
@ -834,10 +832,7 @@ BEGIN
INC(size, CB.lenEOL)
END
END;
IF eot THEN
INC(size, 2)
END;
buf := CB.create(size);
buf := CB.create(size + 2);
line := text.first(tLine);
WHILE line # NIL DO
CB.append(buf, line, 0, line.length - 1);
@ -846,9 +841,8 @@ BEGIN
CB.eol(buf)
END
END;
IF eot THEN
CB.appends(buf, 0X + 0X, 0, 1)
END
CB.appends(buf, 0X, 0, 0);
CB.appends(buf, 0X, 0, 0)
RETURN buf
END plain;
@ -857,9 +851,11 @@ PROCEDURE search* (text: tText; s: ARRAY OF WCHAR; cs, whole: BOOLEAN): BOOLEAN;
VAR
pos: List.tItem;
res: BOOLEAN;
plainText: Search.tBuffer;
plainText, idxData: Search.tBuffer;
BEGIN
res := TRUE;
plainText := NIL;
idxData := NIL;
WHILE text.foundList.count # 0 DO
pos := List.pop(text.foundList);
DISPOSE(pos)
@ -871,15 +867,13 @@ BEGIN
U.upcase16(text.searchText)
END;
IF text.searchText # "" THEN
plainText := plain(text, TRUE);
text.idxData := Search.index(plainText, text.table, cs);
plainText := plain(text);
idxData := Search.index(plainText, text.table, cs);
Search.find(plainText, text.table, text.searchText, whole, text.foundList);
res := text.foundList.count > 0
ELSE
res := TRUE
END;
CB.destroy(plainText);
CB.destroy(text.idxData);
CB.destroy(idxData);
text.search := FALSE;
text.foundSel := 0
RETURN res
@ -1537,7 +1531,7 @@ BEGIN
DEC(n)
END;
buffer := CB.create(cnt);
buffer := CB.create(cnt + 2); (* +2 wchars EOT *)
n := selEnd.Y - selBeg.Y;
line := first;
@ -2343,9 +2337,7 @@ BEGIN
IF drawCursor THEN
cursor(text)
END;
G.SetColor(canvas, K.borderColor);
G.VLine(canvas, 0, 0, size.Y - 1);
END
END draw;
@ -2380,7 +2372,6 @@ BEGIN
text.whole := FALSE;
text.numbers := TRUE;
text.guard := TRUE;
text.idxData := NIL;
text.edition := NIL;
text.foundList := List.create(NIL);
text.searchText := "";