Skip to content

Commit 3e2676b

Browse files
committed
keep find in note prompt visible
1 parent fa37e54 commit 3e2676b

File tree

2 files changed

+18
-39
lines changed

2 files changed

+18
-39
lines changed

package/version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.36a
1+
0.36b

source/editbox.pas

+17-38
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@
238238
2023/03/11 Allow Qt to set Text and Background colour, force Gray for Inactive
239239
background (in LoadNote) cos Kmemo get it wrong
240240
2023/04/08 Get a note's height and width before populating KMemo, saves 200mS on a big note !
241-
241+
2023/04/09 Keep Find-in-note prompt there unless not found.
242242
}
243243

244244

@@ -1515,50 +1515,36 @@ procedure TEditBoxForm.SpeedLeftClick(Sender: TObject); // think btPrev
15151515
// var Res : Boolean = false;
15161516
begin
15171517
if (EditFind.Caption = '') or (EditFind.Caption = rsMenuSearch) then exit;
1518-
LabelFindInfo.Caption := '';
1519-
if not FindInNoteBack(lowercase(EditFind.Text)) then
1520-
LabelFindInfo.Caption := rsNotAvailable;
1518+
if FindInNoteBack(lowercase(EditFind.Text)) then
1519+
LabelFindInfo.Caption := {$ifdef DARWIN}
1520+
rsFindNavRightHintMac + ', ' + rsFindNavLeftHintMac
1521+
{$else}rsFindNavRightHint + ', ' + rsFindNavLeftHint{$endif}
1522+
else LabelFindInfo.Caption := rsNotAvailable;
15211523
if PanelFind.Height = SearchPanelHeight then
15221524
EditFind.SetFocus;
1523-
1524-
(* Res := FindIt(EditFind.Text, KMemo1.SelStart, False, False);
1525-
if Res then LabelFindInfo.Caption := ''
1526-
else begin
1527-
LabelFindInfo.Caption := rsNotAvailable; // perhaps user has deleted the only term in the note ?
1528-
NumbFindHits := 0;
1529-
LabelFindCount.caption := ''; // this is set to data by GetFindHits()
1530-
end;
1531-
KMemo1.setfocus; *)
15321525
end;
15331526

15341527

15351528
procedure TEditBoxForm.FindNew(IncStartPos : boolean);
15361529
var Found : boolean;
15371530
begin
15381531
if (EditFind.Caption = '') or (EditFind.Caption = rsMenuSearch) then exit;
1539-
LabelFindInfo.Caption := '';
15401532
if IncStartPos then
15411533
Found := FindInNote(lowercase(EditFind.Text), 1)
15421534
else Found := FindInNote(lowercase(EditFind.Text), 0);
1543-
if not Found then
1544-
LabelFindInfo.Caption := rsNotAvailable;
1535+
if Found then
1536+
LabelFindInfo.Caption := {$ifdef DARWIN}
1537+
rsFindNavRightHintMac + ', ' + rsFindNavLeftHintMac
1538+
{$else}rsFindNavRightHint + ', ' + rsFindNavLeftHint{$endif}
1539+
else
1540+
LabelFindInfo.Caption := rsNotAvailable;
15451541
if PanelFind.Height = SearchPanelHeight then
15461542
EditFind.SetFocus;
15471543
end;
15481544

15491545
procedure TEditBoxForm.SpeedRightClick(Sender: TObject); // think btNext
1550-
// var Res : Boolean = false;
15511546
begin
15521547
FindNew(True);
1553-
1554-
(* Res := FindIt(EditFind.Text, KMemo1.SelStart+1, true, False);
1555-
if Res then LabelFindInfo.Caption := ''
1556-
else begin
1557-
LabelFindInfo.Caption := rsNotAvailable; // perhaps user has deleted the only term in the note ?
1558-
NumbFindHits := 0;
1559-
LabelFindCount.caption := ''; // this is set to data by GetFindHits()
1560-
end;
1561-
KMemo1.setfocus; *)
15621548
end;
15631549

15641550
function TEditBoxForm.FindInNoteBack(Term : string) : boolean;
@@ -1673,9 +1659,6 @@ procedure TEditBoxForm.MenuItemCutClick(Sender: TObject);
16731659
if KMemo1.ReadOnly then exit();
16741660
KMemo1.ExecuteCommand(ecCut);
16751661
MarkDirty();
1676-
//if not Dirty then TimerSave.Enabled := true;
1677-
//Dirty := true;
1678-
//LabelFindInfo.Caption := 'd';
16791662
end;
16801663

16811664
procedure TEditBoxForm.MenuItemDeleteClick(Sender: TObject);
@@ -1684,10 +1667,6 @@ procedure TEditBoxForm.MenuItemDeleteClick(Sender: TObject);
16841667
// KMemo1.ExecuteCommand(ecClearSelection);
16851668
Undoer.AddPasteOrCut(True);
16861669
KMemo1.Blocks.ClearSelection;
1687-
MarkDirty();
1688-
//if not Dirty then TimerSave.Enabled := true;
1689-
//Dirty := true;
1690-
//LabelFindInfo.Caption := 'd';
16911670
end;
16921671

16931672
procedure TEditBoxForm.MenuItemExportPlainTextClick(Sender: TObject);
@@ -2203,7 +2182,7 @@ procedure TEditBoxForm.MarkTitle();
22032182
var
22042183
BlockNo : integer = 0;
22052184
EndBlock, blar : integer;
2206-
Tick, Tock, Tuck : qword; // ToDo : remove
2185+
// Tick, Tock, Tuck : qword; // ToDo : remove
22072186
begin
22082187
// if Not Ready then exit(); // ToDo : what is effect of disabling this ?
22092188
{ if there is more than one block, and the first, [0], is a para, delete it.}
@@ -2214,7 +2193,7 @@ procedure TEditBoxForm.MarkTitle();
22142193
if Kmemo1.Blocks.Items[BlockNo].ClassName = 'TKMemoParagraph' then
22152194
Kmemo1.Blocks.DeleteEOL(0);
22162195
try
2217-
Tick := GetTickCount64(); // this while loop can take 70mS when loading a big note, 100mS when updating title in a big note
2196+
// Tick := GetTickCount64(); // this while loop can take 70mS when loading a big note, 100mS when updating title in a big note
22182197
while Kmemo1.Blocks.Items[BlockNo].ClassName <> 'TKMemoParagraph' do begin
22192198
if Kmemo1.Blocks.Items[BlockNo].ClassNameIs('TKMemoTextBlock') then begin // just possible its an image, ignore ....
22202199
TKMemoTextBlock(Kmemo1.Blocks.Items[BlockNo]).TextStyle.Font.Size := Sett.FontTitle;
@@ -2227,7 +2206,7 @@ procedure TEditBoxForm.MarkTitle();
22272206
break;
22282207
end;
22292208
end; // Stopped at first TKMemoParagraph if it exists.
2230-
Tock := GetTickCount64();
2209+
// Tock := GetTickCount64();
22312210
BlocksInTitle := BlockNo;
22322211
{ Make sure user has not smeared Title charactistics to next line
22332212
Scan back from cursor to end of title, if Title font, reset. }
@@ -2245,8 +2224,8 @@ procedure TEditBoxForm.MarkTitle();
22452224
KMemo1.Blocks.UnLockUpdate;
22462225
Ready := True;
22472226
end;
2248-
Tuck := GetTickCount64();
2249-
debugln('TEditBoxForm.MarkTitle ' + inttostr(Tock - Tick) + ' ' + inttostr(Tuck - Tock) + ' Total=' + inttostr(Tuck - Tick));
2227+
// Tuck := GetTickCount64();
2228+
// debugln('TEditBoxForm.MarkTitle ' + inttostr(Tock - Tick) + ' ' + inttostr(Tuck - Tock) + ' Total=' + inttostr(Tuck - Tick));
22502229
end;
22512230

22522231
// This is a debug method, take care, it uses writeln and will kill Windows !

0 commit comments

Comments
 (0)