Merge branch 'dev' into dev3

This commit is contained in:
Jeremy Wu 2024-12-19 22:08:12 +11:00 committed by GitHub
commit 9fb0233b6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 62 additions and 11 deletions

View file

@ -1,19 +1,19 @@
name: Assign PR to creator
# Due to GitHub token limitation, only able to assign org members not authors from forks.
# https://github.com/thomaseizinger/assign-pr-creator-action/issues/3
on:
pull_request:
pull_request_target:
types: [opened]
branches-ignore:
- l10n_dev
permissions:
pull-requests: write
jobs:
automation:
runs-on: ubuntu-latest
steps:
- name: Assign PR to creator
uses: thomaseizinger/assign-pr-creator-action@v1.0.0
uses: toshimaru/auto-author-assign@v2.1.1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

View file

@ -6,6 +6,9 @@ on:
pull_request:
types: [opened]
permissions:
pull-requests: write
jobs:
automation:
runs-on: ubuntu-latest

View file

@ -28,6 +28,7 @@ namespace Flow.Launcher.Core.Resource
public static Language Czech = new Language("cs", "čeština");
public static Language Arabic = new Language("ar", "اللغة العربية");
public static Language Vietnamese = new Language("vi-vn", "Tiếng Việt");
public static Language Hebrew = new Language("he", "עברית");
public static List<Language> GetAvailableLanguages()
@ -57,7 +58,8 @@ namespace Flow.Launcher.Core.Resource
Turkish,
Czech,
Arabic,
Vietnamese
Vietnamese,
Hebrew
};
return languages;
}

View file

@ -132,7 +132,9 @@ public partial class SettingsPaneThemeViewModel : BaseModel
"ddd dd'/'MM",
"dddd dd'/'MM",
"dddd dd', 'MMMM",
"dd', 'MMMM"
"dd', 'MMMM",
"dd.MM.yy",
"dd.MM.yyyy"
};
public string TimeFormat

View file

@ -1,10 +1,14 @@
using System;
using System.Text.RegularExpressions;
using Microsoft.Search.Interop;
namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
{
public class QueryConstructor
{
private static Regex _specialCharacterMatcher = new(@"[\@\\#\\&\_;,\%\|\!\(\)\{\}\[\]\^\~\?\\""\/\:\=\-]+", RegexOptions.Compiled);
private static Regex _multiWhiteSpacesMatcher = new(@"\s+", RegexOptions.Compiled);
private Settings settings { get; }
private const string SystemIndex = "SystemIndex";
@ -76,8 +80,39 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
if (userSearchString.IsWhiteSpace())
userSearchString = "*";
// Remove any special characters that might cause issues with the query
var replacedSearchString = ReplaceSpecialCharacterWithTwoSideWhiteSpace(userSearchString);
// Generate SQL from constructed parameters, converting the userSearchString from AQS->WHERE clause
return $"{CreateBaseQuery().GenerateSQLFromUserQuery(userSearchString.ToString())} AND {RestrictionsForAllFilesAndFoldersSearch} ORDER BY {FileName}";
return $"{CreateBaseQuery().GenerateSQLFromUserQuery(replacedSearchString)} AND {RestrictionsForAllFilesAndFoldersSearch} ORDER BY {FileName}";
}
/// <summary>
/// If one special character have white space on one side, replace it with one white space.
/// So command will not have "[special character]+*" which will cause OLEDB exception.
/// </summary>
private static string ReplaceSpecialCharacterWithTwoSideWhiteSpace(ReadOnlySpan<char> input)
{
const string whiteSpace = " ";
var inputString = input.ToString();
// Use regex to match special characters with whitespace on one side
// and replace them with a single space
var result = _specialCharacterMatcher.Replace(inputString, match =>
{
// Check if the match has whitespace on one side
bool hasLeadingWhitespace = match.Index > 0 && char.IsWhiteSpace(inputString[match.Index - 1]);
bool hasTrailingWhitespace = match.Index + match.Length < inputString.Length && char.IsWhiteSpace(inputString[match.Index + match.Length]);
if (hasLeadingWhitespace || hasTrailingWhitespace)
{
return whiteSpace;
}
return match.Value;
});
// Remove any extra spaces that might have been introduced
return _multiWhiteSpacesMatcher.Replace(result, whiteSpace).Trim();
}
///<summary>

View file

@ -103,6 +103,9 @@ namespace Flow.Launcher.Plugin.Sys
private List<Result> Commands()
{
var results = new List<Result>();
var logPath = Path.Combine(DataLocation.DataDirectory(), "Logs", Constant.Version);
var userDataPath = DataLocation.DataDirectory();
var recycleBinFolder = "shell:RecycleBinFolder";
results.AddRange(new[]
{
new Result
@ -264,10 +267,11 @@ namespace Flow.Launcher.Plugin.Sys
SubTitle = context.API.GetTranslation("flowlauncher_plugin_sys_openrecyclebin"),
IcoPath = "Images\\openrecyclebin.png",
Glyph = new GlyphInfo (FontFamily:"/Resources/#Segoe Fluent Icons", Glyph:"\xe74d"),
CopyText = recycleBinFolder,
Action = c =>
{
{
System.Diagnostics.Process.Start("explorer", "shell:RecycleBinFolder");
System.Diagnostics.Process.Start("explorer", recycleBinFolder);
}
return true;
@ -356,9 +360,10 @@ namespace Flow.Launcher.Plugin.Sys
Title = "Open Log Location",
SubTitle = context.API.GetTranslation("flowlauncher_plugin_sys_open_log_location"),
IcoPath = "Images\\app.png",
CopyText = logPath,
AutoCompleteText = logPath,
Action = c =>
{
var logPath = Path.Combine(DataLocation.DataDirectory(), "Logs", Constant.Version);
context.API.OpenDirectory(logPath);
return true;
}
@ -368,6 +373,8 @@ namespace Flow.Launcher.Plugin.Sys
Title = "Flow Launcher Tips",
SubTitle = context.API.GetTranslation("flowlauncher_plugin_sys_open_docs_tips"),
IcoPath = "Images\\app.png",
CopyText = Constant.Documentation,
AutoCompleteText = Constant.Documentation,
Action = c =>
{
context.API.OpenUrl(Constant.Documentation);
@ -379,9 +386,11 @@ namespace Flow.Launcher.Plugin.Sys
Title = "Flow Launcher UserData Folder",
SubTitle = context.API.GetTranslation("flowlauncher_plugin_sys_open_userdata_location"),
IcoPath = "Images\\app.png",
CopyText = userDataPath,
AutoCompleteText = userDataPath,
Action = c =>
{
context.API.OpenDirectory(DataLocation.DataDirectory());
context.API.OpenDirectory(userDataPath);
return true;
}
},