File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 66* Added explicit error handle to get_password_from_file with EAFP.
77* Use the "history" scheme for fzf searches.
88* Deduplicate history in fzf searches.
9+ * Add a preview window to fzf history searches.
910
1011Internal
1112--------
Original file line number Diff line number Diff line change 1+ import re
12from shutil import which
23
34from pyfzf import FzfPrompt
@@ -30,15 +31,18 @@ def search_history(event: KeyPressEvent):
3031 original_history_items = []
3132 seen = {}
3233 for item , timestamp in history_items_with_timestamp :
33- formatted_item = item . replace ( " \n " , " " )
34+ formatted_item = re . sub ( r'\s+' , ' ' , item )
3435 timestamp = timestamp .split ("." )[0 ] if "." in timestamp else timestamp
3536 if formatted_item in seen :
3637 continue
3738 seen [formatted_item ] = True
3839 formatted_history_items .append (f"{ timestamp } { formatted_item } " )
3940 original_history_items .append (item )
4041
41- result = fzf .prompt (formatted_history_items , fzf_options = "--scheme=history --tiebreak=index" )
42+ result = fzf .prompt (
43+ formatted_history_items ,
44+ fzf_options = "--scheme=history --tiebreak=index --preview-window=down:wrap --preview=\" printf '%s' {}\" " ,
45+ )
4246
4347 if result :
4448 selected_index = formatted_history_items .index (result [0 ])
You can’t perform that action at this time.
0 commit comments