[gnome-builder] vim: Support count before modifier
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] vim: Support count before modifier
- Date: Sun, 5 Oct 2014 21:21:52 +0000 (UTC)
commit 73d9c20f1d039c12bd43e8652a54d481f51a7dab
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Oct 4 22:39:27 2014 +0200
vim: Support count before modifier
For commands with a modifier, the optional count may precede either
the command or the modifier. The latter is slightly more intuitive
in many cases ("delete two words" vs. "two delete words"), so add
support for it.
https://bugzilla.gnome.org/show_bug.cgi?id=737909
src/editor/gb-editor-vim.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index 6c7f4bd..5fbdefc 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -1971,6 +1971,21 @@ gb_editor_vim_parse_phrase (GbEditorVim *vim,
if (n_scanned == 1)
return GB_EDITOR_VIM_PHRASE_NEED_MORE;
+ n_scanned = sscanf (str, "%c%u%c", &key, &count, &modifier);
+
+ if (n_scanned == 3)
+ {
+ phrase->count = count;
+ phrase->key = key;
+ phrase->modifier = modifier;
+
+ return GB_EDITOR_VIM_PHRASE_SUCCESS;
+ }
+
+ /* there's a count following key - the modifier is non-optional then */
+ if (n_scanned == 2)
+ return GB_EDITOR_VIM_PHRASE_NEED_MORE;
+
n_scanned = sscanf (str, "%c%c", &key, &modifier);
if (n_scanned == 2)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]