mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 04:37:30 +02: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:
@@ -112,9 +112,9 @@ namespace Wox.Plugin.Folder
|
|||||||
}
|
}
|
||||||
|
|
||||||
string changeTo = path.EndsWith("\\") ? path : path + "\\";
|
string changeTo = path.EndsWith("\\") ? path : path + "\\";
|
||||||
_context.API.ChangeQuery(string.IsNullOrEmpty(query.ActionKeyword) ?
|
changeTo = string.IsNullOrEmpty(query.ActionKeyword) ? changeTo : query.ActionKeyword + " " + changeTo;
|
||||||
changeTo :
|
bool requery = true;
|
||||||
query.ActionKeyword + " " + changeTo);
|
_context.API.ChangeQuery(changeTo, requery);
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = path }
|
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)
|
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;
|
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
|
//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;
|
_launcher.AutoCompleteTextBox.PlaceholderText = String.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_viewModel.QueryTextCursorMovedToEnd)
|
if (_viewModel.QueryTextUpdateBySystem)
|
||||||
{
|
{
|
||||||
_launcher.TextBox.SelectionStart = _launcher.TextBox.Text.Length;
|
_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(() =>
|
await System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||||
{
|
{
|
||||||
_viewModel.QueryText = text;
|
_viewModel.Query();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -235,16 +235,9 @@ namespace Wox
|
|||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTextChanged(object sender, TextChangedEventArgs e)
|
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)
|
public void ChangeQuery(string query, bool requery = false)
|
||||||
{
|
{
|
||||||
_mainVM.ChangeQueryText(query);
|
_mainVM.ChangeQueryText(query, requery);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeQueryText(string query, bool selectAll = false)
|
public void ChangeQueryText(string query, bool selectAll = false)
|
||||||
{
|
{
|
||||||
_mainVM.ChangeQueryText(query);
|
_mainVM.ChangeQueryText(query, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ namespace Wox.ViewModel
|
|||||||
{
|
{
|
||||||
_saved = false;
|
_saved = false;
|
||||||
_queryTextBeforeLeaveResults = "";
|
_queryTextBeforeLeaveResults = "";
|
||||||
_queryText = "";
|
|
||||||
_lastQuery = new Query();
|
_lastQuery = new Query();
|
||||||
|
|
||||||
_settings = settings;
|
_settings = settings;
|
||||||
@@ -223,29 +222,30 @@ namespace Wox.ViewModel
|
|||||||
public ResultsViewModel ContextMenu { get; private set; }
|
public ResultsViewModel ContextMenu { get; private set; }
|
||||||
public ResultsViewModel History { get; private set; }
|
public ResultsViewModel History { get; private set; }
|
||||||
|
|
||||||
private string _queryText;
|
public string SystemQueryText { get; set; }
|
||||||
public string QueryText
|
|
||||||
{
|
public string QueryText { get; set; }
|
||||||
get { return _queryText; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_queryText = value;
|
|
||||||
Query();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// we need move cursor to end when we manually changed query
|
/// 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>
|
/// </summary>
|
||||||
/// <param name="queryText"></param>
|
/// <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;
|
QueryText = queryText;
|
||||||
|
|
||||||
|
if(requery)
|
||||||
|
{
|
||||||
|
Query();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public bool LastQuerySelected { get; set; }
|
public bool LastQuerySelected { get; set; }
|
||||||
public bool QueryTextCursorMovedToEnd { get; set; }
|
public bool QueryTextUpdateBySystem { get; set; }
|
||||||
|
|
||||||
private ResultsViewModel _selectedResults;
|
private ResultsViewModel _selectedResults;
|
||||||
private ResultsViewModel SelectedResults
|
private ResultsViewModel SelectedResults
|
||||||
|
|||||||
Reference in New Issue
Block a user