This repository was archived by the owner on Sep 11, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff 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 ( ) ;
Original file line number Diff line number Diff 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 ( ) ;
You can’t perform that action at this time.
0 commit comments