patch 9.1.1145: multi-line completion has wrong indentation for last line
Problem: When expanding omni completion items with newlines (e.g.
`then\n\t\nend`), the end statement gets wrong indentation.
Solution: Add OPENLINE_FORCE_INDENT flag to make open_line() use
second_line_indent directly (glepnir)
closes: #16614
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Justin M. Keyes <justinkz@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/insexpand.c b/src/insexpand.c
index deae1ce..edc4265 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -4473,6 +4473,7 @@
{
char_u *start = str;
char_u *curr = str;
+ int base_indent = get_indent();
while (*curr != NUL)
{
@@ -4483,7 +4484,7 @@
ins_char_bytes(start, (int)(curr - start));
// Handle newline
- open_line(FORWARD, OPENLINE_KEEPTRAIL, FALSE, NULL);
+ open_line(FORWARD, OPENLINE_KEEPTRAIL | OPENLINE_FORCE_INDENT, base_indent, NULL);
start = curr + 1;
}
curr++;