Skip to content

Commit 878a38e

Browse files
committed
#3538 search: always preset selected search text
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
1 parent 0487220 commit 878a38e

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## 26.4.3
44

5+
- When pressing **Ctrl+F** to open the search bar in the **note text edit**,
6+
the **preview**, or the **QLiteHTML preview**, any currently selected text
7+
will now always be placed into the search field (replacing any existing search
8+
text) and selected, making it easy to search for the highlighted word or phrase
9+
(for [#3538](https://github.com/pbek/QOwnNotes/issues/3538))
510
- Added a built-in **MCP (Model Context Protocol) server** that allows external AI
611
agents to access notes via HTTP+SSE transport with Bearer token authentication,
712
providing `search_notes` and `fetch_note` tools for AI-powered note retrieval

src/libraries/qlitehtml/src/qlitehtmlsearchwidget.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ void QLiteHtmlSearchWidget::activate()
6060
show();
6161

6262
QString selectedText = _liteHtmlWidget->selectedText();
63-
if (!selectedText.isEmpty() && ui->searchLineEdit->text().isEmpty()) {
63+
// Preset the selected text as search text if there is any, replacing any
64+
// existing search text
65+
if (!selectedText.isEmpty()) {
6466
ui->searchLineEdit->setText(selectedText);
6567
}
6668

src/widgets/qtexteditsearchwidget.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ void QTextEditSearchWidget::activate() {
6464
setReplaceMode(false);
6565
show();
6666

67-
// preset the selected text as search text if there is any and there is no
68-
// other search text
67+
// Preset the selected text as search text if there is any, replacing any
68+
// existing search text
6969
QString selectedText = _textEdit->textCursor().selectedText();
70-
if (!selectedText.isEmpty() && ui->searchLineEdit->text().isEmpty()) {
70+
if (!selectedText.isEmpty()) {
7171
ui->searchLineEdit->setText(selectedText);
7272
}
7373

0 commit comments

Comments
 (0)