Skip to content

Commit

Permalink
ptig #153 fuzzy filter result Windows notes
Browse files Browse the repository at this point in the history
  • Loading branch information
clach04 committed Aug 28, 2024
1 parent 563c460 commit 5fc3cb0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions puren_tonbo/tools/ptig.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
try:
import percol # https://github.com/mooz/percol
import percol.actions
import percol.command
import percol.finder
except ImportError:
percol = None

Expand Down Expand Up @@ -590,6 +592,12 @@ def do_results(self, line=None):

def do_fzf(self, line=None):
# TODO docs, Windows testing, help (multi-select)
# Windows works with windows-curses installed and percol syslog "fix"
# TODO Selecting multiple candidates options. Ctrl-Space does not work out of box (under Windows) percol.command.toggle_mark_and_next()
# checkout keymap- what other key bindings are there
# ctrl-t works great for toggle if manually declared
# TODO regex option for this
# TODO cancel - ctrl-c doesn't abort it picks selected
if not percol:
print('percol missing, required for fuzzy fine')
return
Expand All @@ -600,9 +608,14 @@ def do_fzf(self, line=None):
return

with percol.Percol(
finder=percol.finder.FinderMultiQueryString, # what's the difference between finder and action_finder? I think this is a no-op
actions=[percol.actions.no_output],
descriptors={'stdin': None, 'stdout': None, 'stderr': None},
candidates=iter(file_and_path_names)) as p:
p.import_keymap({
'C-t': lambda percol: percol.command.toggle_mark_and_next(), # works great, Ctrl-t now togles multi-select
'C-SPACE': lambda percol: percol.command.toggle_mark_and_next(), # nope
})
p.loop()
results = p.model_candidate.get_selected_results_with_index()
#return [r[0] for r in results]
Expand Down

0 comments on commit 5fc3cb0

Please sign in to comment.