summaryrefslogtreecommitdiff
path: root/src/editor.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2012-03-07 19:19:33 +0000
committerMaxime Coste <frrrwww@gmail.com>2012-03-07 19:19:33 +0000
commit7e01867d55f649ead77acb225dbb4752a40493d4 (patch)
tree1102f29395737f2452a59ab47376382f652a095f /src/editor.cc
parentc183acb800057cdbd0d7f1e8965190f912613d4c (diff)
'I' now inserts before the first non blank character of the line instead of the first character of the line
Diffstat (limited to 'src/editor.cc')
-rw-r--r--src/editor.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/editor.cc b/src/editor.cc
index 2cd790b7..de242891 100644
--- a/src/editor.cc
+++ b/src/editor.cc
@@ -294,6 +294,14 @@ IncrementalInserter::IncrementalInserter(Editor& editor, Mode mode)
pos = m_editor.m_buffer.iterator_at_line_begin(sel.begin());
if (mode == Mode::OpenLineAbove)
--pos;
+ else
+ {
+ auto first_non_blank = pos;
+ while (*first_non_blank == ' ' or *first_non_blank == '\t')
+ ++first_non_blank;
+ if (*first_non_blank != '\n')
+ pos = first_non_blank;
+ }
break;
}
sel = Selection(pos, pos);