Allow defining actions to take when pasting

Fixes #4873
This commit is contained in:
Kovid Goyal
2022-03-24 17:22:46 +05:30
parent cb7aed3234
commit 3c67e991c2
10 changed files with 114 additions and 33 deletions

View File

@@ -808,6 +808,15 @@ def shell_integration(x: str) -> FrozenSet[str]:
return q
def paste_actions(x: str) -> FrozenSet[str]:
s = frozenset({'quote-urls-at-prompt', 'confirm', 'filter'})
q = frozenset(x.lower().split(','))
if not q.issubset(s):
log_error(f'Invalid paste actions: {q - s}, ignoring')
return q & s or frozenset({'invalid'})
return q
def action_alias(val: str) -> Iterable[Tuple[str, str]]:
parts = val.split(maxsplit=1)
if len(parts) > 1: