summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-03-27 07:28:25 +1100
committerMaxime Coste <mawww@kakoune.org>2018-03-27 07:28:25 +1100
commit3d3a37a80cec3be1b38c8176fab0425279c19303 (patch)
tree52e12eb569749ab8d850be1a4468014d75706c97
parent253790be515d9d742774b94f8ed80029571f7591 (diff)
Fix 'O' not putting the cursor on the correct line
-rw-r--r--src/input_handler.cc2
-rw-r--r--test/regression/1964-O-does-not-position-cursor-correctly/cmd1
-rw-r--r--test/regression/1964-O-does-not-position-cursor-correctly/in3
-rw-r--r--test/regression/1964-O-does-not-position-cursor-correctly/out4
4 files changed, 9 insertions, 1 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index 210b0ec9..20228dd1 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -1365,7 +1365,7 @@ private:
buffer.insert(sel.min().line + inserted_count,
String{'\n', CharCount{count}});
for (int i = 0; i < count; ++i)
- new_sels.push_back({sel.max().line + inserted_count + i});
+ new_sels.push_back({sel.min().line + inserted_count + i});
inserted_count += count;
}
selections.set(std::move(new_sels),
diff --git a/test/regression/1964-O-does-not-position-cursor-correctly/cmd b/test/regression/1964-O-does-not-position-cursor-correctly/cmd
new file mode 100644
index 00000000..5fa326cb
--- /dev/null
+++ b/test/regression/1964-O-does-not-position-cursor-correctly/cmd
@@ -0,0 +1 @@
+Oqux<esc>
diff --git a/test/regression/1964-O-does-not-position-cursor-correctly/in b/test/regression/1964-O-does-not-position-cursor-correctly/in
new file mode 100644
index 00000000..f25db757
--- /dev/null
+++ b/test/regression/1964-O-does-not-position-cursor-correctly/in
@@ -0,0 +1,3 @@
+%(foo
+bar
+baz)
diff --git a/test/regression/1964-O-does-not-position-cursor-correctly/out b/test/regression/1964-O-does-not-position-cursor-correctly/out
new file mode 100644
index 00000000..75ef555e
--- /dev/null
+++ b/test/regression/1964-O-does-not-position-cursor-correctly/out
@@ -0,0 +1,4 @@
+qux
+foo
+bar
+baz