Improve command documentation.
This commit is contained in:
parent
6c4b21117c
commit
9e73cba333
@ -302,27 +302,43 @@ class CommandDispatcher:
|
|||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
||||||
def prev_page(self):
|
def prev_page(self):
|
||||||
"""Open a "previous" link."""
|
"""Open a "previous" link.
|
||||||
|
|
||||||
|
This tries to automaticall click on typical "Previous Page" links using
|
||||||
|
some heuristics.
|
||||||
|
"""
|
||||||
self._prevnext(prev=True, newtab=False)
|
self._prevnext(prev=True, newtab=False)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
||||||
def next_page(self):
|
def next_page(self):
|
||||||
"""Open a "next" link."""
|
"""Open a "next" link.
|
||||||
|
|
||||||
|
This tries to automatically click on typical "Next Page" links using
|
||||||
|
some heuristics.
|
||||||
|
"""
|
||||||
self._prevnext(prev=False, newtab=False)
|
self._prevnext(prev=False, newtab=False)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
||||||
def prev_page_tab(self):
|
def prev_page_tab(self):
|
||||||
"""Open a "previous" link in a new tab."""
|
"""Open a "previous" link in a new tab.
|
||||||
|
|
||||||
|
This tries to automatically click on typical "Previous Page" links using
|
||||||
|
some heuristics.
|
||||||
|
"""
|
||||||
self._prevnext(prev=True, newtab=True)
|
self._prevnext(prev=True, newtab=True)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
||||||
def next_page_tab(self):
|
def next_page_tab(self):
|
||||||
"""Open a "next" link in a new tab."""
|
"""Open a "next" link in a new tab.
|
||||||
|
|
||||||
|
This tries to automatically click on typical "Previous Page" links using
|
||||||
|
some heuristics.
|
||||||
|
"""
|
||||||
self._prevnext(prev=False, newtab=True)
|
self._prevnext(prev=False, newtab=True)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cmd', hide=True)
|
@cmdutils.register(instance='mainwindow.tabs.cmd', hide=True)
|
||||||
def scroll(self, dx, dy, count=1):
|
def scroll(self, dx, dy, count=1):
|
||||||
"""Scroll the current tab by count * dx/dy.
|
"""Scroll the current tab by 'count * dx/dy'.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
dx: How much to scroll in x-direction.
|
dx: How much to scroll in x-direction.
|
||||||
@ -337,7 +353,10 @@ class CommandDispatcher:
|
|||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cmd', hide=True)
|
@cmdutils.register(instance='mainwindow.tabs.cmd', hide=True)
|
||||||
def scroll_perc_x(self, perc=None, count=None):
|
def scroll_perc_x(self, perc=None, count=None):
|
||||||
"""Scroll the current tab to a specific percent of the page (horiz).
|
"""Scroll horizontally to a specific percentage of the page.
|
||||||
|
|
||||||
|
The percentage can be given either as argument or as count.
|
||||||
|
If no percentage is given, the page is scrolled to the end.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
perc: Percentage to scroll.
|
perc: Percentage to scroll.
|
||||||
@ -347,7 +366,10 @@ class CommandDispatcher:
|
|||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cmd', hide=True)
|
@cmdutils.register(instance='mainwindow.tabs.cmd', hide=True)
|
||||||
def scroll_perc_y(self, perc=None, count=None):
|
def scroll_perc_y(self, perc=None, count=None):
|
||||||
"""Scroll the current tab to a specific percent of the page (vert).
|
"""Scroll vertically to a specific percentage of the page.
|
||||||
|
|
||||||
|
The percentage can be given either as argument or as count.
|
||||||
|
If no percentage is given, the page is scrolled to the end.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
perc: Percentage to scroll.
|
perc: Percentage to scroll.
|
||||||
@ -356,18 +378,18 @@ class CommandDispatcher:
|
|||||||
self._scroll_percent(perc, count, Qt.Vertical)
|
self._scroll_percent(perc, count, Qt.Vertical)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cmd', hide=True)
|
@cmdutils.register(instance='mainwindow.tabs.cmd', hide=True)
|
||||||
def scroll_page(self, mx, my, count=1):
|
def scroll_page(self, x, y, count=1):
|
||||||
"""Scroll the frame page-wise.
|
"""Scroll the frame page-wise.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
mx: How many pages to scroll to the right.
|
x: How many pages to scroll to the right.
|
||||||
my: How many pages to scroll down.
|
y: How many pages to scroll down.
|
||||||
count: multiplier
|
count: multiplier
|
||||||
"""
|
"""
|
||||||
frame = self._tabs.currentWidget().page().currentFrame()
|
frame = self._tabs.currentWidget().page().currentFrame()
|
||||||
size = frame.geometry()
|
size = frame.geometry()
|
||||||
dx = int(count) * float(mx) * size.width()
|
dx = int(count) * float(x) * size.width()
|
||||||
dy = int(count) * float(my) * size.height()
|
dy = int(count) * float(y) * size.height()
|
||||||
cmdutils.check_overflow(dx, 'int')
|
cmdutils.check_overflow(dx, 'int')
|
||||||
cmdutils.check_overflow(dy, 'int')
|
cmdutils.check_overflow(dy, 'int')
|
||||||
frame.scroll(dx, dy)
|
frame.scroll(dx, dy)
|
||||||
@ -417,7 +439,7 @@ class CommandDispatcher:
|
|||||||
"""Increase the zoom level for the current tab.
|
"""Increase the zoom level for the current tab.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
count: How many steps to take.
|
count: How many steps to zoom in.
|
||||||
"""
|
"""
|
||||||
tab = self._tabs.currentWidget()
|
tab = self._tabs.currentWidget()
|
||||||
tab.zoom(count)
|
tab.zoom(count)
|
||||||
@ -427,17 +449,21 @@ class CommandDispatcher:
|
|||||||
"""Decrease the zoom level for the current tab.
|
"""Decrease the zoom level for the current tab.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
count: How many steps to take.
|
count: How many steps to zoom out.
|
||||||
"""
|
"""
|
||||||
tab = self._tabs.currentWidget()
|
tab = self._tabs.currentWidget()
|
||||||
tab.zoom(-count)
|
tab.zoom(-count)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
||||||
def zoom(self, zoom=None, count=None):
|
def zoom(self, zoom=None, count=None):
|
||||||
"""Set the zoom level for the current tab to [count] or 100 percent.
|
"""Set the zoom level for the current tab.
|
||||||
|
|
||||||
|
The zoom can be given as argument or as [count]. If neither of both is
|
||||||
|
given, the zoom is set to 100%.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
count: How many steps to take.
|
zoom: The zoom percentage to set.
|
||||||
|
count: The zoom percentage to set.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
level = cmdutils.arg_or_count(zoom, count, default=100)
|
level = cmdutils.arg_or_count(zoom, count, default=100)
|
||||||
@ -474,7 +500,7 @@ class CommandDispatcher:
|
|||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
||||||
def undo(self):
|
def undo(self):
|
||||||
"""Re-open a closed tab (optionally skipping [count] tabs)."""
|
"""Re-open a closed tab (optionally skipping [count] closed tabs)."""
|
||||||
if self._tabs.url_stack:
|
if self._tabs.url_stack:
|
||||||
self._tabs.tabopen(self._tabs.url_stack.pop())
|
self._tabs.tabopen(self._tabs.url_stack.pop())
|
||||||
else:
|
else:
|
||||||
@ -482,7 +508,7 @@ class CommandDispatcher:
|
|||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
||||||
def tab_prev(self, count=1):
|
def tab_prev(self, count=1):
|
||||||
"""Switch to the previous tab, or skip [count] tabs.
|
"""Switch to the previous tab, or switch [count] tabs back.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
count: How many tabs to switch back.
|
count: How many tabs to switch back.
|
||||||
@ -497,7 +523,7 @@ class CommandDispatcher:
|
|||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
@cmdutils.register(instance='mainwindow.tabs.cmd')
|
||||||
def tab_next(self, count=1):
|
def tab_next(self, count=1):
|
||||||
"""Switch to the next tab, or skip [count] tabs.
|
"""Switch to the next tab, or switch [count] tabs forward.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
count: How many tabs to switch forward.
|
count: How many tabs to switch forward.
|
||||||
@ -548,6 +574,7 @@ class CommandDispatcher:
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
index: The tab index to focus, starting with 1.
|
index: The tab index to focus, starting with 1.
|
||||||
|
count: The tab index to focus, starting with 1.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
idx = cmdutils.arg_or_count(index, count, default=1,
|
idx = cmdutils.arg_or_count(index, count, default=1,
|
||||||
@ -565,8 +592,8 @@ class CommandDispatcher:
|
|||||||
"""Move the current tab.
|
"""Move the current tab.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
direction: + or - for relative moving, None for absolute.
|
direction: + or - for relative moving, none for absolute.
|
||||||
count: If moving absolutely: New position (or first).
|
count: If moving absolutely: New position (default: 0)
|
||||||
If moving relatively: Offset.
|
If moving relatively: Offset.
|
||||||
"""
|
"""
|
||||||
if direction is None:
|
if direction is None:
|
||||||
@ -614,7 +641,7 @@ class CommandDispatcher:
|
|||||||
don't care about the process anymore as soon as it's spawned.
|
don't care about the process anymore as soon as it's spawned.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
*args: The commandline to execute
|
*args: The commandline to execute.
|
||||||
"""
|
"""
|
||||||
log.procs.debug("Executing: {}".format(args))
|
log.procs.debug("Executing: {}".format(args))
|
||||||
subprocess.Popen(args)
|
subprocess.Popen(args)
|
||||||
@ -631,7 +658,6 @@ class CommandDispatcher:
|
|||||||
Args:
|
Args:
|
||||||
cmd: The userscript to run.
|
cmd: The userscript to run.
|
||||||
args: Arguments to pass to the userscript.
|
args: Arguments to pass to the userscript.
|
||||||
url: A custom QUrl to use instead of the current url.
|
|
||||||
"""
|
"""
|
||||||
url = self._tabs.current_url()
|
url = self._tabs.current_url()
|
||||||
userscripts.run(cmd, *args, url=url)
|
userscripts.run(cmd, *args, url=url)
|
||||||
@ -692,7 +718,10 @@ class CommandDispatcher:
|
|||||||
@cmdutils.register(instance='mainwindow.tabs.cmd', modes=[KeyMode.insert],
|
@cmdutils.register(instance='mainwindow.tabs.cmd', modes=[KeyMode.insert],
|
||||||
hide=True)
|
hide=True)
|
||||||
def open_editor(self):
|
def open_editor(self):
|
||||||
"""Open an external editor with the current form field.
|
"""Open an external editor with the currently selected form field.
|
||||||
|
|
||||||
|
The editor which should be launched can be configured via the
|
||||||
|
`general -> editor` config option.
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -291,6 +291,10 @@ class ConfigManager(QObject):
|
|||||||
//
|
//
|
||||||
|
|
||||||
Wrapper for the get-command to output the value in the status bar.
|
Wrapper for the get-command to output the value in the status bar.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
sectname: The section where the option is in.
|
||||||
|
optname: The name of the option.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
val = self.get(sectname, optname, transformed=False)
|
val = self.get(sectname, optname, transformed=False)
|
||||||
@ -338,6 +342,11 @@ class ConfigManager(QObject):
|
|||||||
//
|
//
|
||||||
|
|
||||||
Wrapper for self.set() to output exceptions in the status bar.
|
Wrapper for self.set() to output exceptions in the status bar.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
sectname: The section where the option is in.
|
||||||
|
optname: The name of the option.
|
||||||
|
value: The value to set.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
self.set('conf', sectname, optname, value)
|
self.set('conf', sectname, optname, value)
|
||||||
@ -354,6 +363,11 @@ class ConfigManager(QObject):
|
|||||||
//
|
//
|
||||||
|
|
||||||
Wrapper for self.set() to output exceptions in the status bar.
|
Wrapper for self.set() to output exceptions in the status bar.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
sectname: The section where the option is in.
|
||||||
|
optname: The name of the option.
|
||||||
|
value: The value to set.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
self.set('temp', sectname, optname, value)
|
self.set('temp', sectname, optname, value)
|
||||||
|
@ -213,10 +213,10 @@ class ModeManager(QObject):
|
|||||||
|
|
||||||
@cmdutils.register(instance='modeman', hide=True)
|
@cmdutils.register(instance='modeman', hide=True)
|
||||||
def enter_mode(self, mode):
|
def enter_mode(self, mode):
|
||||||
"""Enter mode as a command.
|
"""Enter a key mode.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
mode: The mode to enter as a string.
|
mode: The mode to enter.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
m = KeyMode[mode]
|
m = KeyMode[mode]
|
||||||
@ -225,7 +225,7 @@ class ModeManager(QObject):
|
|||||||
self.enter(m, 'command')
|
self.enter(m, 'command')
|
||||||
|
|
||||||
def leave(self, mode, reason=None):
|
def leave(self, mode, reason=None):
|
||||||
"""Leave a mode.
|
"""Leave a key mode.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
mode: The name of the mode to leave.
|
mode: The name of the mode to leave.
|
||||||
|
@ -55,7 +55,7 @@ def debug_crash(typ='exception'):
|
|||||||
"""Crash for debugging purposes.
|
"""Crash for debugging purposes.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
typ: either 'exception' or 'segfault'
|
typ: either 'exception' or 'segfault'.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
raises Exception when typ is not segfault.
|
raises Exception when typ is not segfault.
|
||||||
@ -80,7 +80,7 @@ def debug_all_widgets():
|
|||||||
|
|
||||||
@cmdutils.register(debug=True)
|
@cmdutils.register(debug=True)
|
||||||
def debug_all_objects():
|
def debug_all_objects():
|
||||||
"""Dump all children of an object recursively."""
|
"""Print a list of all objects to the debug log."""
|
||||||
s = QCoreApplication.instance().get_all_objects()
|
s = QCoreApplication.instance().get_all_objects()
|
||||||
logger.debug(s)
|
logger.debug(s)
|
||||||
|
|
||||||
|
@ -48,7 +48,10 @@ class ReadlineBridge:
|
|||||||
@cmd.register(instance='rl_bridge', hide=True,
|
@cmd.register(instance='rl_bridge', hide=True,
|
||||||
modes=[KeyMode.command, KeyMode.prompt])
|
modes=[KeyMode.command, KeyMode.prompt])
|
||||||
def rl_backward_char(self):
|
def rl_backward_char(self):
|
||||||
"""Readline: Move back a character."""
|
"""Move back a character.
|
||||||
|
|
||||||
|
This acts like readline's backward-char.
|
||||||
|
"""
|
||||||
if self.widget is None:
|
if self.widget is None:
|
||||||
return
|
return
|
||||||
self.widget.cursorBackward(False)
|
self.widget.cursorBackward(False)
|
||||||
@ -56,7 +59,10 @@ class ReadlineBridge:
|
|||||||
@cmd.register(instance='rl_bridge', hide=True,
|
@cmd.register(instance='rl_bridge', hide=True,
|
||||||
modes=[KeyMode.command, KeyMode.prompt])
|
modes=[KeyMode.command, KeyMode.prompt])
|
||||||
def rl_forward_char(self):
|
def rl_forward_char(self):
|
||||||
"""Readline: Move forward a character."""
|
"""Move forward a character.
|
||||||
|
|
||||||
|
This acts like readline's forward-char.
|
||||||
|
"""
|
||||||
if self.widget is None:
|
if self.widget is None:
|
||||||
return
|
return
|
||||||
self.widget.cursorForward(False)
|
self.widget.cursorForward(False)
|
||||||
@ -64,7 +70,10 @@ class ReadlineBridge:
|
|||||||
@cmd.register(instance='rl_bridge', hide=True,
|
@cmd.register(instance='rl_bridge', hide=True,
|
||||||
modes=[KeyMode.command, KeyMode.prompt])
|
modes=[KeyMode.command, KeyMode.prompt])
|
||||||
def rl_backward_word(self):
|
def rl_backward_word(self):
|
||||||
"""Readline: Move back to the start of the current or previous word."""
|
"""Move back to the start of the current or previous word.
|
||||||
|
|
||||||
|
This acts like readline's backward-word.
|
||||||
|
"""
|
||||||
if self.widget is None:
|
if self.widget is None:
|
||||||
return
|
return
|
||||||
self.widget.cursorWordBackward(False)
|
self.widget.cursorWordBackward(False)
|
||||||
@ -72,7 +81,10 @@ class ReadlineBridge:
|
|||||||
@cmd.register(instance='rl_bridge', hide=True,
|
@cmd.register(instance='rl_bridge', hide=True,
|
||||||
modes=[KeyMode.command, KeyMode.prompt])
|
modes=[KeyMode.command, KeyMode.prompt])
|
||||||
def rl_forward_word(self):
|
def rl_forward_word(self):
|
||||||
"""Readline: Move forward to the end of the next word."""
|
"""Move forward to the end of the next word.
|
||||||
|
|
||||||
|
This acts like readline's forward-word.
|
||||||
|
"""
|
||||||
if self.widget is None:
|
if self.widget is None:
|
||||||
return
|
return
|
||||||
self.widget.cursorWordForward(False)
|
self.widget.cursorWordForward(False)
|
||||||
@ -80,7 +92,10 @@ class ReadlineBridge:
|
|||||||
@cmd.register(instance='rl_bridge', hide=True,
|
@cmd.register(instance='rl_bridge', hide=True,
|
||||||
modes=[KeyMode.command, KeyMode.prompt])
|
modes=[KeyMode.command, KeyMode.prompt])
|
||||||
def rl_beginning_of_line(self):
|
def rl_beginning_of_line(self):
|
||||||
"""Readline: Move to the start of the current line."""
|
"""Move to the start of the line.
|
||||||
|
|
||||||
|
This acts like readline's beginning-of-line.
|
||||||
|
"""
|
||||||
if self.widget is None:
|
if self.widget is None:
|
||||||
return
|
return
|
||||||
self.widget.home(False)
|
self.widget.home(False)
|
||||||
@ -88,7 +103,10 @@ class ReadlineBridge:
|
|||||||
@cmd.register(instance='rl_bridge', hide=True,
|
@cmd.register(instance='rl_bridge', hide=True,
|
||||||
modes=[KeyMode.command, KeyMode.prompt])
|
modes=[KeyMode.command, KeyMode.prompt])
|
||||||
def rl_end_of_line(self):
|
def rl_end_of_line(self):
|
||||||
"""Readline: Move to the end of the line."""
|
"""Move to the end of the line.
|
||||||
|
|
||||||
|
This acts like readline's end-of-line.
|
||||||
|
"""
|
||||||
if self.widget is None:
|
if self.widget is None:
|
||||||
return
|
return
|
||||||
self.widget.end(False)
|
self.widget.end(False)
|
||||||
@ -96,7 +114,10 @@ class ReadlineBridge:
|
|||||||
@cmd.register(instance='rl_bridge', hide=True,
|
@cmd.register(instance='rl_bridge', hide=True,
|
||||||
modes=[KeyMode.command, KeyMode.prompt])
|
modes=[KeyMode.command, KeyMode.prompt])
|
||||||
def rl_unix_line_discard(self):
|
def rl_unix_line_discard(self):
|
||||||
"""Readline: Kill backward from cursor to the beginning of the line."""
|
"""Remove chars backward from the cursor to the beginning of the line.
|
||||||
|
|
||||||
|
This acts like readline's unix-line-discard.
|
||||||
|
"""
|
||||||
if self.widget is None:
|
if self.widget is None:
|
||||||
return
|
return
|
||||||
self.widget.home(True)
|
self.widget.home(True)
|
||||||
@ -106,7 +127,10 @@ class ReadlineBridge:
|
|||||||
@cmd.register(instance='rl_bridge', hide=True,
|
@cmd.register(instance='rl_bridge', hide=True,
|
||||||
modes=[KeyMode.command, KeyMode.prompt])
|
modes=[KeyMode.command, KeyMode.prompt])
|
||||||
def rl_kill_line(self):
|
def rl_kill_line(self):
|
||||||
"""Readline: Kill the text from point to the end of the line."""
|
"""Remove chars from the cursor to the end of the line.
|
||||||
|
|
||||||
|
This acts like readline's kill-line.
|
||||||
|
"""
|
||||||
if self.widget is None:
|
if self.widget is None:
|
||||||
return
|
return
|
||||||
self.widget.end(True)
|
self.widget.end(True)
|
||||||
@ -116,7 +140,10 @@ class ReadlineBridge:
|
|||||||
@cmd.register(instance='rl_bridge', hide=True,
|
@cmd.register(instance='rl_bridge', hide=True,
|
||||||
modes=[KeyMode.command, KeyMode.prompt])
|
modes=[KeyMode.command, KeyMode.prompt])
|
||||||
def rl_unix_word_rubout(self):
|
def rl_unix_word_rubout(self):
|
||||||
"""Readline: Kill the word behind point."""
|
"""Remove chars from the cursor to the beginning of the word.
|
||||||
|
|
||||||
|
This acts like readline's unix-word-rubout.
|
||||||
|
"""
|
||||||
if self.widget is None:
|
if self.widget is None:
|
||||||
return
|
return
|
||||||
self.widget.cursorWordBackward(True)
|
self.widget.cursorWordBackward(True)
|
||||||
@ -126,7 +153,10 @@ class ReadlineBridge:
|
|||||||
@cmd.register(instance='rl_bridge', hide=True,
|
@cmd.register(instance='rl_bridge', hide=True,
|
||||||
modes=[KeyMode.command, KeyMode.prompt])
|
modes=[KeyMode.command, KeyMode.prompt])
|
||||||
def rl_kill_word(self):
|
def rl_kill_word(self):
|
||||||
"""Readline: Kill from point to the end of the current word."""
|
"""Remove chars from the cursor to the end of the current word.
|
||||||
|
|
||||||
|
This acts like readline's kill-word.
|
||||||
|
"""
|
||||||
if self.widget is None:
|
if self.widget is None:
|
||||||
return
|
return
|
||||||
self.widget.cursorWordForward(True)
|
self.widget.cursorWordForward(True)
|
||||||
@ -136,7 +166,10 @@ class ReadlineBridge:
|
|||||||
@cmd.register(instance='rl_bridge', hide=True,
|
@cmd.register(instance='rl_bridge', hide=True,
|
||||||
modes=[KeyMode.command, KeyMode.prompt])
|
modes=[KeyMode.command, KeyMode.prompt])
|
||||||
def rl_yank(self):
|
def rl_yank(self):
|
||||||
"""Readline: Yank the top of the kill ring into the buffer at point."""
|
"""Paste the most recently deleted text.
|
||||||
|
|
||||||
|
This acts like readline's yank.
|
||||||
|
"""
|
||||||
if self.widget is None or self.widget not in self.deleted:
|
if self.widget is None or self.widget not in self.deleted:
|
||||||
return
|
return
|
||||||
self.widget.insert(self.deleted[self.widget])
|
self.widget.insert(self.deleted[self.widget])
|
||||||
@ -144,7 +177,10 @@ class ReadlineBridge:
|
|||||||
@cmd.register(instance='rl_bridge', hide=True,
|
@cmd.register(instance='rl_bridge', hide=True,
|
||||||
modes=[KeyMode.command, KeyMode.prompt])
|
modes=[KeyMode.command, KeyMode.prompt])
|
||||||
def rl_delete_char(self):
|
def rl_delete_char(self):
|
||||||
"""Readline: Delete the character at point."""
|
"""Delete the character after the cursor.
|
||||||
|
|
||||||
|
This acts like readline's delete-char.
|
||||||
|
"""
|
||||||
if self.widget is None:
|
if self.widget is None:
|
||||||
return
|
return
|
||||||
self.widget.del_()
|
self.widget.del_()
|
||||||
@ -152,7 +188,10 @@ class ReadlineBridge:
|
|||||||
@cmd.register(instance='rl_bridge', hide=True,
|
@cmd.register(instance='rl_bridge', hide=True,
|
||||||
modes=[KeyMode.command, KeyMode.prompt])
|
modes=[KeyMode.command, KeyMode.prompt])
|
||||||
def rl_backward_delete_char(self):
|
def rl_backward_delete_char(self):
|
||||||
"""Readline: Delete the character behind the cursor."""
|
"""Delete the character before the cursor.
|
||||||
|
|
||||||
|
This acts like readline's backward-delete-char.
|
||||||
|
"""
|
||||||
if self.widget is None:
|
if self.widget is None:
|
||||||
return
|
return
|
||||||
self.widget.backspace()
|
self.widget.backspace()
|
||||||
|
@ -221,7 +221,7 @@ class Command(MinimalLineEdit):
|
|||||||
@cmdutils.register(instance='mainwindow.status.cmd', hide=True,
|
@cmdutils.register(instance='mainwindow.status.cmd', hide=True,
|
||||||
modes=[KeyMode.command])
|
modes=[KeyMode.command])
|
||||||
def command_history_prev(self):
|
def command_history_prev(self):
|
||||||
"""Handle Up presses (go back in history)."""
|
"""Go back in the commandline history."""
|
||||||
try:
|
try:
|
||||||
if not self.history.browsing:
|
if not self.history.browsing:
|
||||||
item = self.history.start(self.text().strip())
|
item = self.history.start(self.text().strip())
|
||||||
@ -235,7 +235,7 @@ class Command(MinimalLineEdit):
|
|||||||
@cmdutils.register(instance='mainwindow.status.cmd', hide=True,
|
@cmdutils.register(instance='mainwindow.status.cmd', hide=True,
|
||||||
modes=[KeyMode.command])
|
modes=[KeyMode.command])
|
||||||
def command_history_next(self):
|
def command_history_next(self):
|
||||||
"""Handle Down presses (go forward in history)."""
|
"""Go forward in the commandline history."""
|
||||||
if not self.history.browsing:
|
if not self.history.browsing:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
@ -248,7 +248,7 @@ class Command(MinimalLineEdit):
|
|||||||
@cmdutils.register(instance='mainwindow.status.cmd', hide=True,
|
@cmdutils.register(instance='mainwindow.status.cmd', hide=True,
|
||||||
modes=[KeyMode.command])
|
modes=[KeyMode.command])
|
||||||
def command_accept(self):
|
def command_accept(self):
|
||||||
"""Handle the command in the status bar.
|
"""Execute the command currently in the commandline.
|
||||||
|
|
||||||
Emit:
|
Emit:
|
||||||
got_cmd: If a new cmd was entered.
|
got_cmd: If a new cmd was entered.
|
||||||
|
Loading…
Reference in New Issue
Block a user