When dropping URLs/files onto kitty at a shell prompt insert them appropriately quoted and space separated

This commit is contained in:
Kovid Goyal 2022-02-25 10:30:15 +05:30
parent 6689d312a3
commit a8826f0d02
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 14 additions and 2 deletions

View File

@ -97,6 +97,9 @@ Detailed list of changes
- Fix :ac:`show_last_command_output` not working when the output is stored
partially in the scrollback pager history buffer (:iss:`4435`)
- When dropping URLs/files onto kitty at a shell prompt insert them appropriately quoted and space
separated (:iss:`4734`)
- Improve CWD detection when there are multiple foreground processes in the TTY process group
- A new option :opt:`narrow_symbols` to turn off opportunistic wide rendering of private use codepoints

View File

@ -1221,7 +1221,12 @@ class Boss:
if w is not None:
text = data.decode('utf-8', 'replace')
if mime == 'text/uri-list':
text = '\n'.join(parse_uri_list(text))
urls = parse_uri_list(text)
if w.at_prompt:
import shlex
text = ' '.join(map(shlex.quote, urls))
else:
text = '\n'.join(urls)
w.paste(text)
@ac('win', 'Focus the nth OS window')

View File

@ -520,9 +520,13 @@ class Window:
def current_colors(self) -> Dict[str, Optional[int]]:
return self.screen.color_profile.as_dict()
@property
def at_prompt(self) -> bool:
return self.screen.cursor_at_prompt()
@property
def has_running_program(self) -> bool:
return not self.screen.cursor_at_prompt()
return not self.at_prompt
def matches(self, field: str, pat: MatchPatternType) -> bool:
if not pat: