add --sel option to prompt-yank
This commit is contained in:
parent
ddcc960aa5
commit
fe4dd579f9
@ -1404,7 +1404,7 @@ How many steps to zoom out.
|
||||
|<<prompt-accept,prompt-accept>>|Accept the current prompt.
|
||||
|<<prompt-item-focus,prompt-item-focus>>|Shift the focus of the prompt file completion menu to another item.
|
||||
|<<prompt-open-download,prompt-open-download>>|Immediately open a download.
|
||||
|<<prompt-yank,prompt-yank>>|Yank URL.
|
||||
|<<prompt-yank,prompt-yank>>|Yank URL to clipboard or primary selection.
|
||||
|<<rl-backward-char,rl-backward-char>>|Move back a character.
|
||||
|<<rl-backward-delete-char,rl-backward-delete-char>>|Delete the character before the cursor.
|
||||
|<<rl-backward-kill-word,rl-backward-kill-word>>|Remove chars from the cursor to the beginning of the word.
|
||||
@ -1612,7 +1612,12 @@ If no specific command is given, this will use the system's default application
|
||||
|
||||
[[prompt-yank]]
|
||||
=== prompt-yank
|
||||
Yank URL.
|
||||
Syntax: +:prompt-yank [*--sel*]+
|
||||
|
||||
Yank URL to clipboard or primary selection.
|
||||
|
||||
==== optional arguments
|
||||
* +*-s*+, +*--sel*+: Use the primary selection instead of the clipboard.
|
||||
|
||||
[[rl-backward-char]]
|
||||
=== rl-backward-char
|
||||
|
@ -623,11 +623,11 @@ Default:
|
||||
* +pass:[<Ctrl-F>]+: +pass:[rl-forward-char]+
|
||||
* +pass:[<Ctrl-H>]+: +pass:[rl-backward-delete-char]+
|
||||
* +pass:[<Ctrl-K>]+: +pass:[rl-kill-line]+
|
||||
* +pass:[<Ctrl-Shift-Y>]+: +pass:[prompt-yank --sel]+
|
||||
* +pass:[<Ctrl-U>]+: +pass:[rl-unix-line-discard]+
|
||||
* +pass:[<Ctrl-W>]+: +pass:[rl-unix-word-rubout]+
|
||||
* +pass:[<Ctrl-X>]+: +pass:[prompt-open-download]+
|
||||
* +pass:[<Ctrl-Y>]+: +pass:[rl-yank]+
|
||||
* +pass:[<Ctrl-y>]+: +pass:[prompt-yank]+
|
||||
* +pass:[<Ctrl-Y>]+: +pass:[prompt-yank]+
|
||||
* +pass:[<Down>]+: +pass:[prompt-item-focus next]+
|
||||
* +pass:[<Escape>]+: +pass:[leave-mode]+
|
||||
* +pass:[<Return>]+: +pass:[prompt-accept]+
|
||||
|
@ -2349,8 +2349,8 @@ bindings.default:
|
||||
<Alt-D>: rl-kill-word
|
||||
<Ctrl-W>: rl-unix-word-rubout
|
||||
<Alt-Backspace>: rl-backward-kill-word
|
||||
<Ctrl-Y>: rl-yank
|
||||
<Ctrl-y>: prompt-yank
|
||||
<Ctrl-Y>: prompt-yank
|
||||
<Ctrl-Shift-Y>: prompt-yank --sel
|
||||
<Ctrl-?>: rl-delete-char
|
||||
<Ctrl-H>: rl-backward-delete-char
|
||||
<Escape>: leave-mode
|
||||
|
@ -425,15 +425,23 @@ class PromptContainer(QWidget):
|
||||
@cmdutils.register(
|
||||
instance='prompt-container', scope='window',
|
||||
modes=[usertypes.KeyMode.prompt, usertypes.KeyMode.yesno])
|
||||
def prompt_yank(self):
|
||||
"""Yank URL."""
|
||||
def prompt_yank(self, sel=False):
|
||||
"""Yank URL to clipboard or primary selection.
|
||||
|
||||
Args:
|
||||
sel: Use the primary selection instead of the clipboard.
|
||||
"""
|
||||
question = self._prompt.question
|
||||
if not question.url:
|
||||
message.error('No URL found.')
|
||||
return
|
||||
s = question.url
|
||||
utils.set_clipboard(s)
|
||||
message.info("Yanked to clipboard: {}".format(s))
|
||||
target = 'primary selection'
|
||||
if not (sel and utils.supports_selection()):
|
||||
target = 'clipboard'
|
||||
sel = False
|
||||
utils.set_clipboard(s, sel)
|
||||
message.info("Yanked to {}: {}".format(target, s))
|
||||
|
||||
|
||||
class LineEdit(QLineEdit):
|
||||
|
Loading…
Reference in New Issue
Block a user