@@ -228,6 +228,24 @@ private void InitializeKeyCommands()
228
228
}
229
229
} ) ;
230
230
231
+ InsertSuggestion = new RelayCommand ( _ =>
232
+ {
233
+ var results = SelectedResults ;
234
+
235
+ var result = results . SelectedItem ? . Result ;
236
+ if ( result != null ) // SelectedItem returns null if selection is empty.
237
+ {
238
+ string _newText = String . IsNullOrEmpty ( result . SuggestionText ) ? result . Title : result . SuggestionText ;
239
+
240
+ var SpecialKeyState = GlobalHotkey . Instance . CheckModifiers ( ) ;
241
+ if ( SpecialKeyState . ShiftPressed )
242
+ {
243
+ _newText = result . SubTitle ;
244
+ }
245
+ ChangeQueryText ( _newText ) ;
246
+ }
247
+ } ) ;
248
+
231
249
LoadContextMenuCommand = new RelayCommand ( _ =>
232
250
{
233
251
if ( SelectedIsFromQueryResults ( ) )
@@ -315,24 +333,7 @@ public void ChangeQueryText(string queryText, bool reQuery = false)
315
333
}
316
334
QueryTextCursorMovedToEnd = true ;
317
335
}
318
- public void InsertSuggestion ( string suggestion )
319
- {
320
- var results = SelectedResults ;
321
-
322
- var result = results . SelectedItem ? . Result ;
323
- if ( result != null ) // SelectedItem returns null if selection is empty.
324
- {
325
- suggestion = String . IsNullOrEmpty ( suggestion ) ? result . Title : suggestion ;
326
- string _newText = String . IsNullOrEmpty ( result . SuggestionText ) ? suggestion : result . SuggestionText ;
327
336
328
- var SpecialKeyState = GlobalHotkey . Instance . CheckModifiers ( ) ;
329
- if ( SpecialKeyState . ShiftPressed )
330
- {
331
- _newText = result . SubTitle ;
332
- }
333
- ChangeQueryText ( _newText ) ;
334
- }
335
- }
336
337
public bool LastQuerySelected { get ; set ; }
337
338
338
339
// This is not a reliable indicator of the cursor's position, it is manually set for a specific purpose.
@@ -399,7 +400,7 @@ private ResultsViewModel SelectedResults
399
400
public ICommand OpenSettingCommand { get ; set ; }
400
401
public ICommand ReloadPluginDataCommand { get ; set ; }
401
402
public ICommand ClearQueryCommand { get ; private set ; }
402
- public ICommand ReplaceQueryWithResult { get ; set ; }
403
+ public ICommand InsertSuggestion { get ; set ; }
403
404
404
405
public string OpenResultCommandModifiers { get ; private set ; }
405
406
0 commit comments