patch 8.1.0166: using dict_add_nr_str() is clumsy
Problem: Using dict_add_nr_str() is clumsy.
Solution: Split into two functions. (Ozaki Kiichi, closes #3154)
diff --git a/src/terminal.c b/src/terminal.c
index 6195ad5..2e99a85 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -4729,11 +4729,11 @@
d = dict_alloc();
if (d != NULL)
{
- dict_add_nr_str(d, "visible", term->tl_cursor_visible, NULL);
- dict_add_nr_str(d, "blink", blink_state_is_inverted()
- ? !term->tl_cursor_blink : term->tl_cursor_blink, NULL);
- dict_add_nr_str(d, "shape", term->tl_cursor_shape, NULL);
- dict_add_nr_str(d, "color", 0L, cursor_color_get(term->tl_cursor_color));
+ dict_add_number(d, "visible", term->tl_cursor_visible);
+ dict_add_number(d, "blink", blink_state_is_inverted()
+ ? !term->tl_cursor_blink : term->tl_cursor_blink);
+ dict_add_number(d, "shape", term->tl_cursor_shape);
+ dict_add_string(d, "color", cursor_color_get(term->tl_cursor_color));
list_append_dict(l, d);
}
}
@@ -5059,18 +5059,17 @@
break;
list_append_dict(l, dcell);
- dict_add_nr_str(dcell, "chars", 0, mbs);
+ dict_add_string(dcell, "chars", mbs);
vim_snprintf((char *)rgb, 8, "#%02x%02x%02x",
fg.red, fg.green, fg.blue);
- dict_add_nr_str(dcell, "fg", 0, rgb);
+ dict_add_string(dcell, "fg", rgb);
vim_snprintf((char *)rgb, 8, "#%02x%02x%02x",
bg.red, bg.green, bg.blue);
- dict_add_nr_str(dcell, "bg", 0, rgb);
+ dict_add_string(dcell, "bg", rgb);
- dict_add_nr_str(dcell, "attr",
- cell2attr(attrs, fg, bg), NULL);
- dict_add_nr_str(dcell, "width", width, NULL);
+ dict_add_number(dcell, "attr", cell2attr(attrs, fg, bg));
+ dict_add_number(dcell, "width", width);
++pos.col;
if (width == 2)