Skip to content

Fixed QueryTextbox Binding event#1380

Merged
taooceros merged 7 commits intoFlow-Launcher:devfrom
Sparrkle:QueryTextboxNotify
Oct 1, 2022
Merged

Fixed QueryTextbox Binding event#1380
taooceros merged 7 commits intoFlow-Launcher:devfrom
Sparrkle:QueryTextboxNotify

Conversation

@Sparrkle
Copy link
Contributor

Fixed an error when typing QueryTextBox in specific language.
For example, if the user enters "안녕하세요" and presses the Enter key immediately, it will be searched as "안녕하세".

@onesounds
Copy link
Contributor

korean works well. I think there would have been similar problems with Chinese or Japanese.
(I've been through this problem for a long time, but I couldn't find a solution. In the end, I was mainly used in English.)
If there is no problem in other languages, it is better to apply it.

@onesounds onesounds added the bug Something isn't working label Sep 14, 2022
@taooceros
Copy link
Member

Thanks for the fix! Could you explains a bit why PropertyChange is not enough for triggering change to source for other language (is it because of ime)?

@Sparrkle
Copy link
Contributor Author

In the case of Hangul, initial, neutral, and final letters are combined to form one letter.
However, it is assumed PropertyChanged event will be triggered when the next initial is passed because only the initial and neutral can be entered.

@taooceros
Copy link
Member

taooceros commented Sep 14, 2022

I am worried by whether this may trigger too much unnecessary result when user use input method like for Chinese. Before the text is typed in, the query is triggered and the querytext will not change.

public string QueryText
{
get => _queryText;
set
{
_queryText = value;
Query();
}

Please also add a equality check here (note for requery, which is handled in a different way

public void ChangeQueryText(string queryText, bool reQuery = false)
{
if (QueryText != queryText)
{
// re-query is done in QueryText's setter method
QueryText = queryText;
// set to false so the subsequent set true triggers
// PropertyChanged and MoveQueryTextToEnd is called
QueryTextCursorMovedToEnd = false;
}
else if (reQuery)
{
Query();
}
QueryTextCursorMovedToEnd = true;
}
).

@Sparrkle
Copy link
Contributor Author

fixed a bug not triggered while the backspace was pressed.

Comment on lines 563 to 564
if(_viewModel.QueryText != QueryTextBox.Text)
_viewModel.QueryText = QueryTextBox.Text;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol do you want to change the binding mode to oneway?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a oneway but it works twoway.

Comment on lines 564 to 567
_viewModel.QueryText = QueryTextBox.Text;
{
BindingExpression be = QueryTextBox.GetBindingExpression(System.Windows.Controls.TextBox.TextProperty);
be.UpdateSource();
}
Copy link
Member

@taooceros taooceros Sep 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I mean these two (Any difference between them)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested it and it works the same :'( There is no difference.

@taooceros taooceros merged commit 1546f63 into Flow-Launcher:dev Oct 1, 2022
@jjw24 jjw24 added this to the 1.10.0 milestone Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants