-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search bar: improve keypress handling, fix glitch in popup, strip whitespaces #4658
Conversation
Can you explain how I can test this change to see what's different? I'm not quite sure what popup is being talked about |
It's about the query popup > Ctrl+Space, or click the down arrow on the right. These are small commits with clear messages, so I hope the details are clear. |
I get it! taking a look now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as described, lgtm. feel free to merge
I pushed two fixup commits that simplify things a bit. Also I need to check why 46103f1 works in LateNight -- but has no effect in the other skins : | |
Converting to draft to prevent merging these fixup commits. |
src/widget/wsearchlineedit.cpp
Outdated
@@ -233,7 +225,7 @@ void WSearchLineEdit::loadQueriesFromConfig() { | |||
m_pConfig->getKeysWithGroup(kSavedQueriesConfigGroup); | |||
QSet<QString> queryStrings; | |||
for (const auto& queryKey : queryKeys) { | |||
const auto& queryString = m_pConfig->getValueString(queryKey); | |||
const auto& queryString = m_pConfig->getValueString(queryKey).simplified(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A query may intentionally contain multiple spaces and they might be quoted. They are not redundant and we shouldmust not remove them. Only leading/trailing spaces are redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now uses .trim()
src/widget/wsearchlineedit.cpp
Outdated
@@ -465,27 +472,32 @@ void WSearchLineEdit::slotTriggerSearch() { | |||
|
|||
/// saves the current query as selection | |||
void WSearchLineEdit::slotSaveSearch() { | |||
m_saveTimer.stop(); | |||
QString cText = currentText(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we should apply trim()
to avoid storing empty searches (see below, the check for `isEmpty())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
000667b
to
2b21769
Compare
db9d1bd
to
57938ea
Compare
@uklotzde What's your opinion on the current state? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No more objections. Thanks for leaving comments that explain why some special case handling is required. LGTM
This fixes some minor, yet annoying, UX issues.