Make :yank-selected work in all modes.

This commit is contained in:
Florian Bruhin 2015-07-16 13:57:53 +02:00
parent 63ff39ad65
commit 704c5ff919
3 changed files with 15 additions and 14 deletions

View File

@ -23,6 +23,8 @@ Changed
- Some developer scripts got moved to `scripts/dev/` - Some developer scripts got moved to `scripts/dev/`
- When downloading to a FIFO or special file, a confirmation is displayed as - When downloading to a FIFO or special file, a confirmation is displayed as
this might cause qutebrowser to hang. this might cause qutebrowser to hang.
- The `:yank-selected` command now works in all modes instead of just caret
mode and is not hidden anymore.
v0.3.0 v0.3.0
------ ------

View File

@ -57,6 +57,7 @@
|<<view-source,view-source>>|Show the source of the current page. |<<view-source,view-source>>|Show the source of the current page.
|<<wq,wq>>|Save open pages and quit. |<<wq,wq>>|Save open pages and quit.
|<<yank,yank>>|Yank the current URL/title to the clipboard or primary selection. |<<yank,yank>>|Yank the current URL/title to the clipboard or primary selection.
|<<yank-selected,yank-selected>>|Yank the selected text to the clipboard or primary selection.
|<<zoom,zoom>>|Set the zoom level for the current tab. |<<zoom,zoom>>|Set the zoom level for the current tab.
|<<zoom-in,zoom-in>>|Increase the zoom level for the current tab. |<<zoom-in,zoom-in>>|Increase the zoom level for the current tab.
|<<zoom-out,zoom-out>>|Decrease the zoom level for the current tab. |<<zoom-out,zoom-out>>|Decrease the zoom level for the current tab.
@ -673,6 +674,16 @@ Yank the current URL/title to the clipboard or primary selection.
* +*-s*+, +*--sel*+: Use the primary selection instead of the clipboard. * +*-s*+, +*--sel*+: Use the primary selection instead of the clipboard.
* +*-d*+, +*--domain*+: Yank only the scheme, domain, and port number. * +*-d*+, +*--domain*+: Yank only the scheme, domain, and port number.
[[yank-selected]]
=== yank-selected
Syntax: +:yank-selected [*--sel*] [*--keep*]+
Yank the selected text to the clipboard or primary selection.
==== optional arguments
* +*-s*+, +*--sel*+: Use the primary selection instead of the clipboard.
* +*-k*+, +*--keep*+: If given, stay in visual mode after yanking.
[[zoom]] [[zoom]]
=== zoom === zoom
Syntax: +:zoom ['zoom']+ Syntax: +:zoom ['zoom']+
@ -760,7 +771,6 @@ How many steps to zoom out.
|<<search-next,search-next>>|Continue the search to the ([count]th) next term. |<<search-next,search-next>>|Continue the search to the ([count]th) next term.
|<<search-prev,search-prev>>|Continue the search to the ([count]th) previous term. |<<search-prev,search-prev>>|Continue the search to the ([count]th) previous term.
|<<toggle-selection,toggle-selection>>|Toggle caret selection mode. |<<toggle-selection,toggle-selection>>|Toggle caret selection mode.
|<<yank-selected,yank-selected>>|Yank the selected text to the clipboard or primary selection.
|============== |==============
[[clear-keychain]] [[clear-keychain]]
=== clear-keychain === clear-keychain
@ -1112,16 +1122,6 @@ How many elements to ignore.
=== toggle-selection === toggle-selection
Toggle caret selection mode. Toggle caret selection mode.
[[yank-selected]]
=== yank-selected
Syntax: +:yank-selected [*--sel*] [*--keep*]+
Yank the selected text to the clipboard or primary selection.
==== optional arguments
* +*-s*+, +*--sel*+: Use the primary selection instead of the clipboard.
* +*-k*+, +*--keep*+: If given, stay in visual mode after yanking.
== Debugging commands == Debugging commands
These commands are mainly intended for debugging. They are hidden if qutebrowser was started without the `--debug`-flag. These commands are mainly intended for debugging. They are hidden if qutebrowser was started without the `--debug`-flag.

View File

@ -1542,8 +1542,7 @@ class CommandDispatcher:
act = QWebPage.SelectEndOfDocument act = QWebPage.SelectEndOfDocument
webview.triggerPageAction(act) webview.triggerPageAction(act)
@cmdutils.register(instance='command-dispatcher', hide=True, @cmdutils.register(instance='command-dispatcher', scope='window')
modes=[KeyMode.caret], scope='window')
def yank_selected(self, sel=False, keep=False): def yank_selected(self, sel=False, keep=False):
"""Yank the selected text to the clipboard or primary selection. """Yank the selected text to the clipboard or primary selection.
@ -1568,7 +1567,7 @@ class CommandDispatcher:
message.info(self._win_id, "{} {} yanked to {}".format( message.info(self._win_id, "{} {} yanked to {}".format(
len(s), "char" if len(s) == 1 else "chars", target)) len(s), "char" if len(s) == 1 else "chars", target))
if not keep: if not keep:
modeman.leave(self._win_id, KeyMode.caret, "yank selected") modeman.maybe_leave(self._win_id, KeyMode.caret, "yank selected")
@cmdutils.register(instance='command-dispatcher', hide=True, @cmdutils.register(instance='command-dispatcher', hide=True,
modes=[KeyMode.caret], scope='window') modes=[KeyMode.caret], scope='window')