diff options
author | Andrej Zieger <jerdna-regeiz@users.noreply.github.com> | 2019-05-20 11:19:22 +0200 |
---|---|---|
committer | Andrej Zieger <jerdna-regeiz@users.noreply.github.com> | 2019-05-26 19:32:32 +0200 |
commit | e09f3baed8abc5fb821fb9b6226ad232d8e2f4c7 (patch) | |
tree | 54005ff22d43bab9955109609c1498583e4d599c | |
parent | f43900f6865cb9f7b70621b090194448920d66e5 (diff) | |
download | rneovim-e09f3baed8abc5fb821fb9b6226ad232d8e2f4c7.tar.gz rneovim-e09f3baed8abc5fb821fb9b6226ad232d8e2f4c7.tar.bz2 rneovim-e09f3baed8abc5fb821fb9b6226ad232d8e2f4c7.zip |
vim-patch:8.1.0709: windows are updated for every added/deleted sign
Problem: Windows are updated for every added/deleted sign.
Solution: Do not call update_debug_sign(). Only redraw when the line with
the sign is visible. (idea from neovim vim/vim#9479)
https://github.com/vim/vim/commit/27a472c32ed5b5298bca50864570a4a71ec1d204
-rw-r--r-- | src/nvim/screen.c | 3 | ||||
-rw-r--r-- | src/nvim/sign.c | 35 |
2 files changed, 19 insertions, 19 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 31386ebd42..0f29ef09ae 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -221,7 +221,8 @@ void redraw_buf_later(buf_T *buf, int type) void redraw_buf_line_later(buf_T *buf, linenr_T line) { FOR_ALL_WINDOWS_IN_TAB(wp, curtab) { - if (wp->w_buffer == buf) { + if (wp->w_buffer == buf + && line >= wp->w_topline && line < wp->w_botline) { redrawWinline(wp, line); } } diff --git a/src/nvim/sign.c b/src/nvim/sign.c index 70d32f687d..069f841d63 100644 --- a/src/nvim/sign.c +++ b/src/nvim/sign.c @@ -326,8 +326,8 @@ void buf_addsign( prev = NULL; FOR_ALL_SIGNS_IN_BUF(buf, sign) { - if (lnum == sign->lnum && id == sign->id && - sign_in_group(sign, groupname)) { + if (lnum == sign->lnum && id == sign->id + && sign_in_group(sign, groupname)) { // Update an existing sign sign->typenr = typenr; return; @@ -453,9 +453,9 @@ linenr_T buf_delsign( lnum = 0; for (sign = buf->b_signlist; sign != NULL; sign = next) { next = sign->next; - if ((id == 0 || sign->id == id) && - (atlnum == 0 || sign->lnum == atlnum) && - sign_in_group(sign, group)) { + if ((id == 0 || sign->id == id) + && (atlnum == 0 || sign->lnum == atlnum) + && sign_in_group(sign, group)) { *lastp = next; if (next != NULL) { next->prev = sign->prev; @@ -564,7 +564,6 @@ void buf_delete_signs(buf_T *buf, char_u *group) // When deleting the last sign need to redraw the windows to remove the // sign column. Not when curwin is NULL (this means we're exiting). if (buf->b_signlist != NULL && curwin != NULL){ - redraw_buf_later(buf, NOT_VALID); changed_cline_bef_curs(); } @@ -1047,16 +1046,16 @@ static void sign_place_cmd( // :sign place // :sign place group={group} // :sign place group=* - if (lnum >= 0 || sign_name != NULL || - (group != NULL && *group == '\0')) { + if (lnum >= 0 || sign_name != NULL + || (group != NULL && *group == '\0')) { EMSG(_(e_invarg)); } else { sign_list_placed(buf, group); } } else { // Place a new sign - if (sign_name == NULL || buf == NULL || - (group != NULL && *group == '\0')) { + if (sign_name == NULL || buf == NULL + || (group != NULL && *group == '\0')) { EMSG(_(e_invarg)); return; } @@ -1148,8 +1147,8 @@ static void sign_jump_cmd( return; } - if (buf == NULL || (group != NULL && *group == '\0') || - lnum >= 0 || sign_name != NULL) { + if (buf == NULL || (group != NULL && *group == '\0') + || lnum >= 0 || sign_name != NULL) { // File or buffer is not specified or an empty group is used // or a line number or a sign name is specified. EMSG(_(e_invarg)); @@ -1280,8 +1279,8 @@ static int parse_sign_cmd_args( // If the filename is not supplied for the sign place or the sign jump // command, then use the current buffer. if (filename == NULL && ((cmd == SIGNCMD_PLACE && lnum_arg) - || cmd == SIGNCMD_JUMP)) { - *buf = curwin->w_buffer; + || cmd == SIGNCMD_JUMP)) { + *buf = curwin->w_buffer; } return OK; } @@ -1477,10 +1476,10 @@ static void sign_get_placed_in_buf( if (!sign_in_group(sign, sign_group)) { continue; } - if ((lnum == 0 && sign_id == 0) || - (sign_id == 0 && lnum == sign->lnum) || - (lnum == 0 && sign_id == sign->id) || - (lnum == sign->lnum && sign_id == sign->id)) { + if ((lnum == 0 && sign_id == 0) + || (sign_id == 0 && lnum == sign->lnum) + || (lnum == 0 && sign_id == sign->id) + || (lnum == sign->lnum && sign_id == sign->id)) { if ((sdict = sign_get_info(sign)) != NULL) { tv_list_append_dict(l, sdict); } |