Added fix to update text on navigation using up/down arrow (#4626)

* Added fix to update text on navigation using up/down arrow

* Fix incorrect alignment with ghost text

* Added tests
This commit is contained in:
Divyansh Srivastava
2020-07-02 18:29:39 -07:00
committed by GitHub
parent 18f4e9db31
commit 7dabcc00ed
3 changed files with 272 additions and 30 deletions

View File

@@ -709,6 +709,40 @@ namespace Wox.ViewModel
}
}
public static string GetAutoCompleteText(int index, string input, String query)
{
if (!string.IsNullOrEmpty(input) && !string.IsNullOrEmpty(query))
{
if (index == 0)
{
if (input.IndexOf(query, StringComparison.InvariantCultureIgnoreCase) == 0)
{
// Use the same case as the input query for the matched portion of the string
return query + input.Substring(query.Length);
}
}
}
return string.Empty;
}
public static string GetSearchText(int index, String input, string query)
{
if (!string.IsNullOrEmpty(input))
{
if (index == 0 && !string.IsNullOrEmpty(query))
{
if (input.IndexOf(query, StringComparison.InvariantCultureIgnoreCase) == 0)
{
return query + input.Substring(query.Length);
}
}
return input;
}
return string.Empty;
}
protected virtual void Dispose(bool disposing)
{
if (!_disposed)