From 0e1e0fc57b9e876f3a450ffaaa5669edfba2f801 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 13 Dec 2018 17:35:16 +1100 Subject: [PATCH] Improve deindent behaviour with mixed indent --- src/normal.cc | 2 +- test/regression/0-deindent-on-mixed-indent-line/cmd | 1 + test/regression/0-deindent-on-mixed-indent-line/in | 1 + test/regression/0-deindent-on-mixed-indent-line/out | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 test/regression/0-deindent-on-mixed-indent-line/cmd create mode 100644 test/regression/0-deindent-on-mixed-indent-line/in create mode 100644 test/regression/0-deindent-on-mixed-indent-line/out diff --git a/src/normal.cc b/src/normal.cc index 49cc90f6..0a4e4c86 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -1207,7 +1207,7 @@ void deindent(Context& context, NormalParams params) sels.emplace_back(line, BufferCoord{line, column-1}); break; } - if (width == indent_width) + if (width >= indent_width) { sels.emplace_back(line, BufferCoord{line, column}); break; diff --git a/test/regression/0-deindent-on-mixed-indent-line/cmd b/test/regression/0-deindent-on-mixed-indent-line/cmd new file mode 100644 index 00000000..c72cbb66 --- /dev/null +++ b/test/regression/0-deindent-on-mixed-indent-line/cmd @@ -0,0 +1 @@ + diff --git a/test/regression/0-deindent-on-mixed-indent-line/in b/test/regression/0-deindent-on-mixed-indent-line/in new file mode 100644 index 00000000..c67c4f4e --- /dev/null +++ b/test/regression/0-deindent-on-mixed-indent-line/in @@ -0,0 +1 @@ + fo%(o) diff --git a/test/regression/0-deindent-on-mixed-indent-line/out b/test/regression/0-deindent-on-mixed-indent-line/out new file mode 100644 index 00000000..27be8730 --- /dev/null +++ b/test/regression/0-deindent-on-mixed-indent-line/out @@ -0,0 +1 @@ + foo