diff options
author | keis <keijser@gmail.com> | 2009-10-14 01:21:59 +0200 |
---|---|---|
committer | keis <keijser@gmail.com> | 2009-10-15 04:05:59 +0200 |
commit | e5cbab2ad66c5dc30068a22026dd789131effe31 (patch) | |
tree | 4546d0d08891116c3a890a1d353ae2da78953678 /examples | |
parent | 8f881188ce26d9bfbaed86b0dd76391b7fc77ef4 (diff) |
add symolic indexes to set_cursor_pos
Diffstat (limited to 'examples')
-rw-r--r-- | examples/data/uzbl/scripts/plugins/keycmd.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/examples/data/uzbl/scripts/plugins/keycmd.py b/examples/data/uzbl/scripts/plugins/keycmd.py index c5a8f93..9943cbc 100644 --- a/examples/data/uzbl/scripts/plugins/keycmd.py +++ b/examples/data/uzbl/scripts/plugins/keycmd.py @@ -328,11 +328,16 @@ def set_cursor_pos(uzbl, index): '''Allow setting of the cursor position externally. Supports negative indexing.''' - cursor = int(index.strip()) k = get_keylet(uzbl) - if cursor < 0: - cursor = len(k.cmd) + cursor + if index == '-': + cursor = k.cursor - 1 + elif index == '+': + cursor = k.cursor + 1 + else: + cursor = int(index.strip()) + if cursor < 0: + cursor = len(k.cmd) + cursor + 1 if cursor < 0: cursor = 0 |