Mercurial > vim
comparison src/sign.c @ 17247:cbd0432cf8ff v8.1.1623
patch 8.1.1623: display wrong with signs in narrow number column
commit https://github.com/vim/vim/commit/e4b407f536ba8bd007152649a347a95320d80fce
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 4 11:59:28 2019 +0200
patch 8.1.1623: display wrong with signs in narrow number column
Problem: Display wrong with signs in narrow number column.
Solution: Increase the numbercolumn width if needed. (Yegappan Lakshmanan,
closes #4606)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 04 Jul 2019 12:00:09 +0200 |
parents | 210c4c5f783d |
children | 82b5d981fe59 |
comparison
equal
deleted
inserted
replaced
17246:a437ebad37b8 | 17247:cbd0432cf8ff |
---|---|
1006 sign_list_defined(sp); | 1006 sign_list_defined(sp); |
1007 else | 1007 else |
1008 semsg(_("E155: Unknown sign: %s"), name); | 1008 semsg(_("E155: Unknown sign: %s"), name); |
1009 } | 1009 } |
1010 | 1010 |
1011 static void | |
1012 may_force_numberwidth_recompute(buf_T *buf, int unplace) | |
1013 { | |
1014 tabpage_T *tp; | |
1015 win_T *wp; | |
1016 | |
1017 FOR_ALL_TAB_WINDOWS(tp, wp) | |
1018 if (wp->w_buffer == buf | |
1019 && (wp->w_p_nu || wp->w_p_rnu) | |
1020 && (unplace || wp->w_nrwidth_width < 2) | |
1021 && (*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u')) | |
1022 wp->w_nrwidth_line_count = 0; | |
1023 } | |
1024 | |
1011 /* | 1025 /* |
1012 * Place a sign at the specified file location or update a sign. | 1026 * Place a sign at the specified file location or update a sign. |
1013 */ | 1027 */ |
1014 static int | 1028 static int |
1015 sign_place( | 1029 sign_place( |
1043 buf_addsign(buf, *sign_id, sign_group, prio, lnum, sp->sn_typenr); | 1057 buf_addsign(buf, *sign_id, sign_group, prio, lnum, sp->sn_typenr); |
1044 else | 1058 else |
1045 // ":sign place {id} file={fname}": change sign type | 1059 // ":sign place {id} file={fname}": change sign type |
1046 lnum = buf_change_sign_type(buf, *sign_id, sign_group, sp->sn_typenr); | 1060 lnum = buf_change_sign_type(buf, *sign_id, sign_group, sp->sn_typenr); |
1047 if (lnum > 0) | 1061 if (lnum > 0) |
1062 { | |
1048 redraw_buf_line_later(buf, lnum); | 1063 redraw_buf_line_later(buf, lnum); |
1064 | |
1065 // When displaying signs in the 'number' column, if the width of the | |
1066 // number column is less than 2, then force recomputing the width. | |
1067 may_force_numberwidth_recompute(buf, FALSE); | |
1068 } | |
1049 else | 1069 else |
1050 { | 1070 { |
1051 semsg(_("E885: Not possible to change sign %s"), sign_name); | 1071 semsg(_("E885: Not possible to change sign %s"), sign_name); |
1052 return FAIL; | 1072 return FAIL; |
1053 } | 1073 } |
1077 // Delete only the specified signs | 1097 // Delete only the specified signs |
1078 lnum = buf_delsign(buf, atlnum, sign_id, sign_group); | 1098 lnum = buf_delsign(buf, atlnum, sign_id, sign_group); |
1079 if (lnum == 0) | 1099 if (lnum == 0) |
1080 return FAIL; | 1100 return FAIL; |
1081 } | 1101 } |
1102 | |
1103 // When all the signs in a buffer are removed, force recomputing the | |
1104 // number column width (if enabled) in all the windows displaying the | |
1105 // buffer if 'signcolumn' is set to 'number' in that window. | |
1106 if (buf->b_signlist == NULL) | |
1107 may_force_numberwidth_recompute(buf, TRUE); | |
1082 | 1108 |
1083 return OK; | 1109 return OK; |
1084 } | 1110 } |
1085 | 1111 |
1086 /* | 1112 /* |