From 9bf75688fa88b9a3f7cfe361a7f5afc2b9ddbe42 Mon Sep 17 00:00:00 2001
From: Garulf <535299+Garulf@users.noreply.github.com>
Date: Sun, 19 Dec 2021 09:54:41 -0500
Subject: [PATCH 1/6] Add offset
---
Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
index 08ee8571e..3243ab903 100644
--- a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
+++ b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
@@ -53,7 +53,7 @@ namespace Flow.Launcher.Converters
// Check if Text will be larger then our QueryTextBox
System.Windows.Media.Typeface typeface = new Typeface(QueryTextBox.FontFamily, QueryTextBox.FontStyle, QueryTextBox.FontWeight, QueryTextBox.FontStretch);
System.Windows.Media.FormattedText ft = new FormattedText(QueryTextBox.Text, System.Globalization.CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, QueryTextBox.FontSize, Brushes.Black);
- if (ft.Width > QueryTextBox.ActualWidth || QueryTextBox.HorizontalOffset != 0)
+ if ((ft.Width + 30) > QueryTextBox.ActualWidth || QueryTextBox.HorizontalOffset != 0)
{
return string.Empty;
};
From aa850ff0e82caaa58f263fd52ddca389e3400465 Mon Sep 17 00:00:00 2001
From: Garulf <535299+Garulf@users.noreply.github.com>
Date: Sun, 19 Dec 2021 10:15:39 -0500
Subject: [PATCH 2/6] Incease offset to fix context menu triggering alignment
issue
---
Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
index 3243ab903..364a17d21 100644
--- a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
+++ b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
@@ -53,7 +53,7 @@ namespace Flow.Launcher.Converters
// Check if Text will be larger then our QueryTextBox
System.Windows.Media.Typeface typeface = new Typeface(QueryTextBox.FontFamily, QueryTextBox.FontStyle, QueryTextBox.FontWeight, QueryTextBox.FontStretch);
System.Windows.Media.FormattedText ft = new FormattedText(QueryTextBox.Text, System.Globalization.CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, QueryTextBox.FontSize, Brushes.Black);
- if ((ft.Width + 30) > QueryTextBox.ActualWidth || QueryTextBox.HorizontalOffset != 0)
+ if ((ft.Width + 40) > QueryTextBox.ActualWidth || QueryTextBox.HorizontalOffset != 0)
{
return string.Empty;
};
From aafbdebb9b8dcca8bfeffaf80685f760f1dbcb36 Mon Sep 17 00:00:00 2001
From: Garulf <535299+Garulf@users.noreply.github.com>
Date: Mon, 20 Dec 2021 02:20:26 -0500
Subject: [PATCH 3/6] Allow adjustment of offset in settings file
---
Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 1 +
Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs | 8 ++++++--
Flow.Launcher/MainWindow.xaml | 1 +
Flow.Launcher/ViewModel/MainViewModel.cs | 8 ++++++++
4 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
index 8ecd6dc4b..b02ef0270 100644
--- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
+++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
@@ -15,6 +15,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
private string language = "en";
public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}";
public string OpenResultModifiers { get; set; } = KeyConstant.Alt;
+ public int SuggestionTextOffset { get; set; } = 40;
public string ColorScheme { get; set; } = "System";
public bool ShowOpenResultHotkey { get; set; } = true;
public double WindowSize { get; set; } = 580;
diff --git a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
index 364a17d21..fd1e0de10 100644
--- a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
+++ b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
@@ -12,7 +12,8 @@ namespace Flow.Launcher.Converters
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
- if (values.Length != 3)
+
+ if (values.Length != 4)
{
return string.Empty;
}
@@ -53,7 +54,10 @@ namespace Flow.Launcher.Converters
// Check if Text will be larger then our QueryTextBox
System.Windows.Media.Typeface typeface = new Typeface(QueryTextBox.FontFamily, QueryTextBox.FontStyle, QueryTextBox.FontWeight, QueryTextBox.FontStretch);
System.Windows.Media.FormattedText ft = new FormattedText(QueryTextBox.Text, System.Globalization.CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, QueryTextBox.FontSize, Brushes.Black);
- if ((ft.Width + 40) > QueryTextBox.ActualWidth || QueryTextBox.HorizontalOffset != 0)
+
+ var FormatOffset = (int)values[3];
+
+ if ((ft.Width + FormatOffset) > QueryTextBox.ActualWidth || QueryTextBox.HorizontalOffset != 0)
{
return string.Empty;
};
diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml
index 75120322f..2c0a17144 100644
--- a/Flow.Launcher/MainWindow.xaml
+++ b/Flow.Launcher/MainWindow.xaml
@@ -164,6 +164,7 @@
+
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index abf3a1d14..de44c6dd7 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -84,6 +84,7 @@ namespace Flow.Launcher.ViewModel
InitializeKeyCommands();
RegisterViewUpdate();
RegisterResultsUpdatedEvent();
+ SetSuggestionTextOffset();
SetOpenResultModifiers();
}
@@ -395,6 +396,8 @@ namespace Flow.Launcher.ViewModel
public double MainWindowWidth => _settings.WindowSize;
+ public int SuggestionTextOffset { get; set; }
+
public ICommand EscCommand { get; set; }
public ICommand SelectNextItemCommand { get; set; }
public ICommand SelectPrevItemCommand { get; set; }
@@ -720,6 +723,11 @@ namespace Flow.Launcher.ViewModel
OpenResultCommandModifiers = _settings.OpenResultModifiers ?? DefaultOpenResultModifiers;
}
+ private void SetSuggestionTextOffset()
+ {
+ SuggestionTextOffset = _settings.SuggestionTextOffset;
+ }
+
public void ToggleFlowLauncher()
{
if (!MainWindowVisibilityStatus)
From c3ceed12713b77686122648d473923f7ac504bad Mon Sep 17 00:00:00 2001
From: Garulf <535299+Garulf@users.noreply.github.com>
Date: Mon, 20 Dec 2021 02:27:18 -0500
Subject: [PATCH 4/6] Revert "Allow adjustment of offset in settings file"
This reverts commit aafbdebb9b8dcca8bfeffaf80685f760f1dbcb36.
---
Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 1 -
Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs | 8 ++------
Flow.Launcher/MainWindow.xaml | 1 -
Flow.Launcher/ViewModel/MainViewModel.cs | 8 --------
4 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
index b02ef0270..8ecd6dc4b 100644
--- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
+++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs
@@ -15,7 +15,6 @@ namespace Flow.Launcher.Infrastructure.UserSettings
private string language = "en";
public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}";
public string OpenResultModifiers { get; set; } = KeyConstant.Alt;
- public int SuggestionTextOffset { get; set; } = 40;
public string ColorScheme { get; set; } = "System";
public bool ShowOpenResultHotkey { get; set; } = true;
public double WindowSize { get; set; } = 580;
diff --git a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
index fd1e0de10..364a17d21 100644
--- a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
+++ b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
@@ -12,8 +12,7 @@ namespace Flow.Launcher.Converters
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
-
- if (values.Length != 4)
+ if (values.Length != 3)
{
return string.Empty;
}
@@ -54,10 +53,7 @@ namespace Flow.Launcher.Converters
// Check if Text will be larger then our QueryTextBox
System.Windows.Media.Typeface typeface = new Typeface(QueryTextBox.FontFamily, QueryTextBox.FontStyle, QueryTextBox.FontWeight, QueryTextBox.FontStretch);
System.Windows.Media.FormattedText ft = new FormattedText(QueryTextBox.Text, System.Globalization.CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, QueryTextBox.FontSize, Brushes.Black);
-
- var FormatOffset = (int)values[3];
-
- if ((ft.Width + FormatOffset) > QueryTextBox.ActualWidth || QueryTextBox.HorizontalOffset != 0)
+ if ((ft.Width + 40) > QueryTextBox.ActualWidth || QueryTextBox.HorizontalOffset != 0)
{
return string.Empty;
};
diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml
index 2c0a17144..75120322f 100644
--- a/Flow.Launcher/MainWindow.xaml
+++ b/Flow.Launcher/MainWindow.xaml
@@ -164,7 +164,6 @@
-
diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs
index de44c6dd7..abf3a1d14 100644
--- a/Flow.Launcher/ViewModel/MainViewModel.cs
+++ b/Flow.Launcher/ViewModel/MainViewModel.cs
@@ -84,7 +84,6 @@ namespace Flow.Launcher.ViewModel
InitializeKeyCommands();
RegisterViewUpdate();
RegisterResultsUpdatedEvent();
- SetSuggestionTextOffset();
SetOpenResultModifiers();
}
@@ -396,8 +395,6 @@ namespace Flow.Launcher.ViewModel
public double MainWindowWidth => _settings.WindowSize;
- public int SuggestionTextOffset { get; set; }
-
public ICommand EscCommand { get; set; }
public ICommand SelectNextItemCommand { get; set; }
public ICommand SelectPrevItemCommand { get; set; }
@@ -723,11 +720,6 @@ namespace Flow.Launcher.ViewModel
OpenResultCommandModifiers = _settings.OpenResultModifiers ?? DefaultOpenResultModifiers;
}
- private void SetSuggestionTextOffset()
- {
- SuggestionTextOffset = _settings.SuggestionTextOffset;
- }
-
public void ToggleFlowLauncher()
{
if (!MainWindowVisibilityStatus)
From 85c58a9618d071a96216ad37911a7259e8ed3c31 Mon Sep 17 00:00:00 2001
From: Garulf <535299+Garulf@users.noreply.github.com>
Date: Mon, 20 Dec 2021 03:12:41 -0500
Subject: [PATCH 5/6] Derive offset from Right side Textbox padding
---
Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
index 364a17d21..b26d56250 100644
--- a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
+++ b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
@@ -53,7 +53,10 @@ namespace Flow.Launcher.Converters
// Check if Text will be larger then our QueryTextBox
System.Windows.Media.Typeface typeface = new Typeface(QueryTextBox.FontFamily, QueryTextBox.FontStyle, QueryTextBox.FontWeight, QueryTextBox.FontStretch);
System.Windows.Media.FormattedText ft = new FormattedText(QueryTextBox.Text, System.Globalization.CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, QueryTextBox.FontSize, Brushes.Black);
- if ((ft.Width + 40) > QueryTextBox.ActualWidth || QueryTextBox.HorizontalOffset != 0)
+
+ var Offset = QueryTextBox.Padding.Right;
+
+ if ((ft.Width + Offset) > QueryTextBox.ActualWidth || QueryTextBox.HorizontalOffset != 0)
{
return string.Empty;
};
From 301dd612d4a3da5f245bbef2f050a4b17e17529c Mon Sep 17 00:00:00 2001
From: Jeremy Wu
Date: Mon, 20 Dec 2021 21:05:49 +1100
Subject: [PATCH 6/6] lowercase variable name
---
Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
index b26d56250..ecdfc5851 100644
--- a/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
+++ b/Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
@@ -54,9 +54,9 @@ namespace Flow.Launcher.Converters
System.Windows.Media.Typeface typeface = new Typeface(QueryTextBox.FontFamily, QueryTextBox.FontStyle, QueryTextBox.FontWeight, QueryTextBox.FontStretch);
System.Windows.Media.FormattedText ft = new FormattedText(QueryTextBox.Text, System.Globalization.CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, QueryTextBox.FontSize, Brushes.Black);
- var Offset = QueryTextBox.Padding.Right;
+ var offset = QueryTextBox.Padding.Right;
- if ((ft.Width + Offset) > QueryTextBox.ActualWidth || QueryTextBox.HorizontalOffset != 0)
+ if ((ft.Width + offset) > QueryTextBox.ActualWidth || QueryTextBox.HorizontalOffset != 0)
{
return string.Empty;
};