Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit ea57ccc

Browse files
committed
fixed Ctrl+F not copying selection to the search box
1 parent 4aaa772 commit ea57ccc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

UI/MainWindow/MainWindowCommands.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,19 +231,24 @@ private void Command_FindReplace()
231231
{
232232
return;
233233
}
234+
235+
var selection = GetCurrentEditorElement().editor.TextArea.Selection.GetText();
236+
234237
if (Program.IsSearchOpen)
235238
{
236239
foreach (Window win in Application.Current.Windows)
237240
{
238241
if (win is FindReplaceWindow findWin)
239242
{
240243
findWin.Activate();
244+
findWin.FindBox.Text = selection;
245+
findWin.FindBox.SelectAll();
241246
findWin.FindBox.Focus();
242247
return;
243248
}
244249
}
245250
}
246-
var findWindow = new FindReplaceWindow();
251+
var findWindow = new FindReplaceWindow(selection);
247252
Program.IsSearchOpen = true;
248253
findWindow.Show();
249254
findWindow.FindBox.Focus();

UI/Windows/FindReplaceWindow.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public partial class FindReplaceWindow
2626
#endregion
2727

2828
#region Constructors
29-
public FindReplaceWindow()
29+
public FindReplaceWindow(string searchTerm = "")
3030
{
3131
InitializeComponent();
3232
if (Program.OptionsObject.Program_AccentColor != "Red" || Program.OptionsObject.Program_Theme != "BaseDark")
@@ -37,6 +37,8 @@ public FindReplaceWindow()
3737

3838
ReplaceButton.ItemsSource = findReplaceButtonDict;
3939
ReplaceButton.SelectedIndex = 0;
40+
FindBox.Text = searchTerm;
41+
FindBox.SelectAll();
4042

4143
LoadEditorsInfo();
4244
Language_Translate();

0 commit comments

Comments
 (0)