diff --git a/src/buffer.cc b/src/buffer.cc index 07383257..06805e73 100644 --- a/src/buffer.cc +++ b/src/buffer.cc @@ -495,6 +495,9 @@ BufferCoord Buffer::do_insert(BufferCoord pos, StringView content) BufferCoord Buffer::do_erase(BufferCoord begin, BufferCoord end) { + if (begin == end) + return begin; + kak_assert(is_valid(begin)); kak_assert(is_valid(end)); StringView prefix = m_lines[begin.line].substr(0, begin.column); diff --git a/test/regression/1308-wrong-behaviour-of-kak-indent-on-newline/cmd b/test/regression/1308-wrong-behaviour-of-kak-indent-on-newline/cmd new file mode 100644 index 00000000..13e7564e --- /dev/null +++ b/test/regression/1308-wrong-behaviour-of-kak-indent-on-newline/cmd @@ -0,0 +1 @@ +o diff --git a/test/regression/1308-wrong-behaviour-of-kak-indent-on-newline/in b/test/regression/1308-wrong-behaviour-of-kak-indent-on-newline/in new file mode 100644 index 00000000..8ae40f7c --- /dev/null +++ b/test/regression/1308-wrong-behaviour-of-kak-indent-on-newline/in @@ -0,0 +1 @@ +# Comment diff --git a/test/regression/1308-wrong-behaviour-of-kak-indent-on-newline/rc b/test/regression/1308-wrong-behaviour-of-kak-indent-on-newline/rc new file mode 100644 index 00000000..3daaec2e --- /dev/null +++ b/test/regression/1308-wrong-behaviour-of-kak-indent-on-newline/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/core/kakrc.kak" +set buffer filetype kak diff --git a/test/regression/1308-wrong-behaviour-of-kak-indent-on-newline/selections b/test/regression/1308-wrong-behaviour-of-kak-indent-on-newline/selections new file mode 100644 index 00000000..139597f9 --- /dev/null +++ b/test/regression/1308-wrong-behaviour-of-kak-indent-on-newline/selections @@ -0,0 +1,2 @@ + +