diff --git a/src/normal.cc b/src/normal.cc index c1a084a4..40efc32d 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -1104,6 +1104,7 @@ void join_lines_select_spaces(Context& context, NormalParams) if (selections.empty()) return; context.selections_write_only() = std::move(selections); + context.selections().merge_consecutive(); ScopedEdition edition(context); context.selections().replace({" "_str}); } diff --git a/test/regression/4476-invalid-line-join/cmd b/test/regression/4476-invalid-line-join/cmd new file mode 100644 index 00000000..ba1947f7 --- /dev/null +++ b/test/regression/4476-invalid-line-join/cmd @@ -0,0 +1 @@ +% diff --git a/test/regression/4476-invalid-line-join/in b/test/regression/4476-invalid-line-join/in new file mode 100644 index 00000000..b5e0c3a5 --- /dev/null +++ b/test/regression/4476-invalid-line-join/in @@ -0,0 +1,2 @@ +ab +ac diff --git a/test/regression/4476-invalid-line-join/out b/test/regression/4476-invalid-line-join/out new file mode 100644 index 00000000..2b456081 --- /dev/null +++ b/test/regression/4476-invalid-line-join/out @@ -0,0 +1 @@ +ab ac