Allow the URL hints kitten to insert the selected URL into the terminal

This commit is contained in:
Kovid Goyal
2018-04-11 13:22:07 +05:30
parent 2cf8c6aea7
commit 75b5130d96
2 changed files with 13 additions and 4 deletions

View File

@@ -212,6 +212,8 @@ OPTIONS = partial('''\
default=default
What program to use to open matched URLs. Defaults
to the default URL open program for the operating system.
Use a value of - to paste the URL into the terminal window
instead.
--regex
@@ -239,4 +241,9 @@ def main(args):
def handle_result(args, data, target_window_id, boss):
program = data['program']
boss.open_url(data['url'], None if program == 'default' else program)
if program == '-':
w = boss.window_id_map.get(target_window_id)
if w is not None:
w.paste(data['url'])
else:
boss.open_url(data['url'], None if program == 'default' else program)