Mercurial > vim
diff src/terminal.c @ 14301:3c80092eb211 v8.1.0166
patch 8.1.0166: using dict_add_nr_str() is clumsy
commit https://github.com/vim/vim/commit/e0be167a805fd547c25ec1ec97fd4c7f13046236
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 8 16:50:37 2018 +0200
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 https://github.com/vim/vim/issues/3154)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 08 Jul 2018 17:00:07 +0200 |
parents | 4d3f6bf86bec |
children | 83b870d9ac4b |
line wrap: on
line diff
--- a/src/terminal.c +++ b/src/terminal.c @@ -4729,11 +4729,11 @@ f_term_getcursor(typval_T *argvars, typv 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 @@ f_term_scrape(typval_T *argvars, typval_ 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_nr_str(dcell, "attr", - cell2attr(attrs, fg, bg), NULL); - dict_add_nr_str(dcell, "width", width, NULL); + dict_add_string(dcell, "bg", rgb); + + dict_add_number(dcell, "attr", cell2attr(attrs, fg, bg)); + dict_add_number(dcell, "width", width); ++pos.col; if (width == 2)