Skip to content

Commit

Permalink
Quick find bar: do not show the find/replace history menu if there is…
Browse files Browse the repository at this point in the history
… none

Quick find bar: when choosing entry from the history menu, place the caret after the text inserted

Signed-off-by: Eran Ifrah <[email protected]>
  • Loading branch information
eranif committed Jan 11, 2025
1 parent 6f7ec18 commit af98376
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions LiteEditor/quickfindbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,9 @@ bool QuickFindBar::HandleKeyboardShortcuts(wxKeyEvent& event)

void QuickFindBar::ShowMenuForFindCtrl()
{
if (m_findHistory.m_commands.empty()) {
return;
}
wxMenu menu;
for (const auto& word : m_findHistory.m_commands) {
int resource_id = wxXmlResource::GetXRCID(word);
Expand All @@ -1146,6 +1149,7 @@ void QuickFindBar::ShowMenuForFindCtrl()
[this, word](wxCommandEvent& event) {
wxUnusedVar(event);
m_textCtrlFind->SetValue(word);
m_textCtrlFind->SetInsertionPointEnd();
},
resource_id);
}
Expand All @@ -1155,6 +1159,10 @@ void QuickFindBar::ShowMenuForFindCtrl()

void QuickFindBar::ShowMenuForReplaceCtrl()
{
if (m_replaceHistory.m_commands.empty()) {
return;
}

wxMenu menu;
for (const auto& word : m_replaceHistory.m_commands) {
int resource_id = wxXmlResource::GetXRCID(word);
Expand All @@ -1164,6 +1172,7 @@ void QuickFindBar::ShowMenuForReplaceCtrl()
[this, word](wxCommandEvent& event) {
wxUnusedVar(event);
m_textCtrlReplace->SetValue(word);
m_textCtrlReplace->SetInsertionPointEnd();
},
resource_id);
}
Expand Down

0 comments on commit af98376

Please sign in to comment.