mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-12 18:29:24 +08:00
- Fixes cursor jumping around issue.
- Seperating the ability to set the text from initiating a query. - Plugins have to explicitly request the query be updated. - Updating Folder plugin to explicty update the query on folder selection. - Removing unused changes from 'Wox' that don't compile.
This commit is contained in:
parent
6290630787
commit
15b7b20500
@ -112,9 +112,9 @@ namespace Wox.Plugin.Folder
|
||||
}
|
||||
|
||||
string changeTo = path.EndsWith("\\") ? path : path + "\\";
|
||||
_context.API.ChangeQuery(string.IsNullOrEmpty(query.ActionKeyword) ?
|
||||
changeTo :
|
||||
query.ActionKeyword + " " + changeTo);
|
||||
changeTo = string.IsNullOrEmpty(query.ActionKeyword) ? changeTo : query.ActionKeyword + " " + changeTo;
|
||||
bool requery = true;
|
||||
_context.API.ChangeQuery(changeTo, requery);
|
||||
return false;
|
||||
},
|
||||
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = path }
|
||||
|
@ -350,21 +350,25 @@ namespace PowerLauncher
|
||||
|
||||
private void QueryTextBox_TextChanged(object sender, Windows.UI.Xaml.Controls.TextChangedEventArgs e)
|
||||
{
|
||||
var latestTimeOfTyping = DateTime.Now;
|
||||
var text = ((Windows.UI.Xaml.Controls.TextBox)sender).Text;
|
||||
Task.Run(() => DelayedCheck(latestTimeOfTyping, text));
|
||||
s_lastTimeOfTyping = latestTimeOfTyping;
|
||||
|
||||
//To clear the auto-suggest immediately instead of waiting for selection changed
|
||||
if(text == String.Empty)
|
||||
if (text == String.Empty)
|
||||
{
|
||||
_launcher.AutoCompleteTextBox.PlaceholderText = String.Empty;
|
||||
}
|
||||
|
||||
if (_viewModel.QueryTextCursorMovedToEnd)
|
||||
if (_viewModel.QueryTextUpdateBySystem)
|
||||
{
|
||||
_launcher.TextBox.SelectionStart = _launcher.TextBox.Text.Length;
|
||||
_viewModel.QueryTextCursorMovedToEnd = false;
|
||||
_viewModel.QueryTextUpdateBySystem = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_viewModel.QueryText = text;
|
||||
var latestTimeOfTyping = DateTime.Now;
|
||||
|
||||
Task.Run(() => DelayedCheck(latestTimeOfTyping, text));
|
||||
s_lastTimeOfTyping = latestTimeOfTyping;
|
||||
}
|
||||
}
|
||||
|
||||
@ -375,7 +379,7 @@ namespace PowerLauncher
|
||||
{
|
||||
await System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
_viewModel.QueryText = text;
|
||||
_viewModel.Query();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
@ -235,16 +235,9 @@ namespace Wox
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (_viewModel.QueryTextCursorMovedToEnd)
|
||||
{
|
||||
QueryTextBox.CaretIndex = QueryTextBox.Text.Length;
|
||||
_viewModel.QueryTextCursorMovedToEnd = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -38,12 +38,12 @@ namespace Wox
|
||||
|
||||
public void ChangeQuery(string query, bool requery = false)
|
||||
{
|
||||
_mainVM.ChangeQueryText(query);
|
||||
_mainVM.ChangeQueryText(query, requery);
|
||||
}
|
||||
|
||||
public void ChangeQueryText(string query, bool selectAll = false)
|
||||
{
|
||||
_mainVM.ChangeQueryText(query);
|
||||
_mainVM.ChangeQueryText(query, false);
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
|
@ -51,7 +51,6 @@ namespace Wox.ViewModel
|
||||
{
|
||||
_saved = false;
|
||||
_queryTextBeforeLeaveResults = "";
|
||||
_queryText = "";
|
||||
_lastQuery = new Query();
|
||||
|
||||
_settings = settings;
|
||||
@ -223,29 +222,30 @@ namespace Wox.ViewModel
|
||||
public ResultsViewModel ContextMenu { get; private set; }
|
||||
public ResultsViewModel History { get; private set; }
|
||||
|
||||
private string _queryText;
|
||||
public string QueryText
|
||||
{
|
||||
get { return _queryText; }
|
||||
set
|
||||
{
|
||||
_queryText = value;
|
||||
Query();
|
||||
}
|
||||
}
|
||||
public string SystemQueryText { get; set; }
|
||||
|
||||
public string QueryText { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// we need move cursor to end when we manually changed query
|
||||
/// but we don't want to move cursor to end when query is updated from TextBox
|
||||
/// but we don't want to move cursor to end when query is updated from TextBox.
|
||||
/// Also we don't want to force the results to change unless explicity told to.
|
||||
/// </summary>
|
||||
/// <param name="queryText"></param>
|
||||
public void ChangeQueryText(string queryText)
|
||||
/// <param name="requery">Optional Parameter that if true, will automatically execute a query against the updated text</param>
|
||||
public void ChangeQueryText(string queryText, bool requery=false)
|
||||
{
|
||||
QueryTextCursorMovedToEnd = true;
|
||||
QueryTextUpdateBySystem = true;
|
||||
QueryText = queryText;
|
||||
|
||||
if(requery)
|
||||
{
|
||||
Query();
|
||||
}
|
||||
}
|
||||
public bool LastQuerySelected { get; set; }
|
||||
public bool QueryTextCursorMovedToEnd { get; set; }
|
||||
public bool QueryTextUpdateBySystem { get; set; }
|
||||
|
||||
private ResultsViewModel _selectedResults;
|
||||
private ResultsViewModel SelectedResults
|
||||
|
Loading…
Reference in New Issue
Block a user