patch 8.2.2289: Vim9: 'cpo' can become empty
Problem: Vim9: 'cpo' can become empty.
Solution: Use empty_option instead of an empty string. Update quickfix
buffer after restoring 'cpo'. (closes #7608)
diff --git a/src/quickfix.c b/src/quickfix.c
index 697a3d4..f22d2bf 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -8099,6 +8099,7 @@
int new_qi = FALSE;
char_u *au_name = NULL;
char_u *lang = NULL;
+ int updated = FALSE;
switch (eap->cmdidx)
{
@@ -8150,14 +8151,24 @@
qfl->qf_ptr = qfl->qf_start;
qfl->qf_index = 1;
qf_list_changed(qfl);
- qf_update_buffer(qi, NULL);
+ updated = TRUE;
}
if (p_cpo == empty_option)
p_cpo = save_cpo;
else
- // Darn, some plugin changed the value.
+ {
+ // Darn, some plugin changed the value. If it's still empty it was
+ // changed and restored, need to restore in the complicated way.
+ if (*p_cpo == NUL)
+ set_option_value((char_u *)"cpo", 0L, save_cpo, 0);
free_string_option(save_cpo);
+ }
+
+ if (updated)
+ // This may open a window and source scripts, do this after 'cpo' was
+ // restored.
+ qf_update_buffer(qi, NULL);
if (au_name != NULL)
{