[gnome-builder] vim: place cursor on first non-whitespace character on `yyp`
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] vim: place cursor on first non-whitespace character on `yyp`
- Date: Tue, 7 Oct 2014 01:23:52 +0000 (UTC)
commit 216940c0c5f9518ec4f6a6464db8831effff21c1
Author: Christian Hergert <christian hergert me>
Date: Mon Oct 6 18:22:20 2014 -0700
vim: place cursor on first non-whitespace character on `yyp`
src/editor/gb-editor-vim.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index 9e98a1a..67ef188 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -1893,6 +1893,7 @@ gb_editor_vim_paste (GbEditorVim *vim)
*/
if (text && g_str_has_suffix (text, "\n"))
{
+ const gchar *tmp;
gchar *trimmed;
/*
@@ -1918,9 +1919,22 @@ gb_editor_vim_paste (GbEditorVim *vim)
g_free (trimmed);
/*
- * VIM leaves us on position 0 when pasting a whole line.
+ * VIM leaves us on the first non-whitespace character.
*/
offset = 0;
+ for (tmp = text; *tmp; tmp = g_utf8_next_char (tmp))
+ {
+ gunichar ch;
+
+ ch = g_utf8_get_char (tmp);
+ if (g_unichar_isspace (ch))
+ {
+ offset++;
+ continue;
+ }
+ break;
+ }
+
line++;
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]