diff --git a/OpenBullet2.Native/Views/Dialogs/BotLogDialog.xaml.cs b/OpenBullet2.Native/Views/Dialogs/BotLogDialog.xaml.cs index a7c1a8755..d2d034393 100644 --- a/OpenBullet2.Native/Views/Dialogs/BotLogDialog.xaml.cs +++ b/OpenBullet2.Native/Views/Dialogs/BotLogDialog.xaml.cs @@ -24,6 +24,7 @@ public BotLogDialog(IBotLogger logger) logRTB.Font = new System.Drawing.Font("Consolas", 10); logRTB.BackColor = System.Drawing.Color.FromArgb(22, 22, 22); + logRTB.HandleCreated += (_, _) => FixAutoWordSelection(logRTB); if (logger is null) { @@ -45,9 +46,17 @@ public BotLogDialog(IBotLogger logger) } catch { - + // ignored } } + + private void FixAutoWordSelection(System.Windows.Forms.RichTextBox rtb) + { + // Stupid ass workaround because WinForms RichTextBox is broken + // https://stackoverflow.com/questions/3678620/c-sharp-richtextbox-selection-problem + rtb.AutoWordSelection = true; + rtb.AutoWordSelection = false; + } #region Search private void Search(object sender, RoutedEventArgs e) @@ -139,7 +148,7 @@ private void NextMatch(object sender, RoutedEventArgs e) } #endregion } - + public class BotLogDialogViewModel : ViewModelBase { private string searchString = string.Empty; diff --git a/OpenBullet2.Native/Views/Pages/Shared/Debugger.xaml.cs b/OpenBullet2.Native/Views/Pages/Shared/Debugger.xaml.cs index e72f34b92..cc5eecbd3 100644 --- a/OpenBullet2.Native/Views/Pages/Shared/Debugger.xaml.cs +++ b/OpenBullet2.Native/Views/Pages/Shared/Debugger.xaml.cs @@ -30,9 +30,19 @@ public Debugger() logRTB.Font = new System.Drawing.Font("Consolas", 10); logRTB.BackColor = System.Drawing.Color.FromArgb(22, 22, 22); - + logRTB.HandleCreated += (_, _) => FixAutoWordSelection(logRTB); + variablesRTB.Font = new System.Drawing.Font("Consolas", 10); variablesRTB.BackColor = System.Drawing.Color.FromArgb(22, 22, 22); + variablesRTB.HandleCreated += (_, _) => FixAutoWordSelection(variablesRTB); + } + + private void FixAutoWordSelection(System.Windows.Forms.RichTextBox rtb) + { + // Stupid ass workaround because WinForms RichTextBox is broken + // https://stackoverflow.com/questions/3678620/c-sharp-richtextbox-selection-problem + rtb.AutoWordSelection = true; + rtb.AutoWordSelection = false; } private void ShowLog(object sender, RoutedEventArgs e) => tabControl.SelectedIndex = 0; @@ -40,7 +50,7 @@ public Debugger() private void ShowHTML(object sender, RoutedEventArgs e) => tabControl.SelectedIndex = 2; private async void Start(object sender, RoutedEventArgs e) - { + { if (!vm.PersistLog) { logRTB.Clear();