Mercurial > vim
comparison src/popupwin.c @ 18438:144fa40ee706 v8.1.2213
patch 8.1.2213: popup_textprop tests fail
Commit: https://github.com/vim/vim/commit/aa1f04d09286085c4031bc7c4ca9fa672f6f4905
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 24 22:12:54 2019 +0200
patch 8.1.2213: popup_textprop tests fail
Problem: Popup_textprop tests fail.
Solution: Adjust the column and line positioning.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 24 Oct 2019 22:15:03 +0200 |
parents | ee8db42dacf6 |
children | 41a5f241e9d5 |
comparison
equal
deleted
inserted
replaced
18437:f246fac8243c | 18438:144fa40ee706 |
---|---|
1080 int org_height = wp->w_height; | 1080 int org_height = wp->w_height; |
1081 int org_leftcol = wp->w_leftcol; | 1081 int org_leftcol = wp->w_leftcol; |
1082 int org_leftoff = wp->w_popup_leftoff; | 1082 int org_leftoff = wp->w_popup_leftoff; |
1083 int minwidth; | 1083 int minwidth; |
1084 int wantline = wp->w_wantline; // adjusted for textprop | 1084 int wantline = wp->w_wantline; // adjusted for textprop |
1085 int use_wantline = wantline != 0; | |
1086 int wantcol = wp->w_wantcol; // adjusted for textprop | 1085 int wantcol = wp->w_wantcol; // adjusted for textprop |
1087 int use_wantcol = wantcol != 0; | 1086 int use_wantcol = wantcol != 0; |
1088 | 1087 |
1089 wp->w_winrow = 0; | 1088 wp->w_winrow = 0; |
1090 wp->w_wincol = 0; | 1089 wp->w_wincol = 0; |
1094 | 1093 |
1095 // May need to update the "cursorline" highlighting, which may also change | 1094 // May need to update the "cursorline" highlighting, which may also change |
1096 // "topline" | 1095 // "topline" |
1097 if (wp->w_popup_last_curline != wp->w_cursor.lnum) | 1096 if (wp->w_popup_last_curline != wp->w_cursor.lnum) |
1098 popup_highlight_curline(wp); | 1097 popup_highlight_curline(wp); |
1099 | |
1100 // If no line was specified default to vertical centering. | |
1101 if (wantline == 0) | |
1102 center_vert = TRUE; | |
1103 else if (wantline < 0) | |
1104 // If "wantline" is negative it actually means zero. | |
1105 wantline = 0; | |
1106 if (wantcol < 0) | |
1107 wantcol = 0; | |
1108 | 1098 |
1109 if (wp->w_popup_prop_type > 0 && win_valid(wp->w_popup_prop_win)) | 1099 if (wp->w_popup_prop_type > 0 && win_valid(wp->w_popup_prop_win)) |
1110 { | 1100 { |
1111 win_T *prop_win = wp->w_popup_prop_win; | 1101 win_T *prop_win = wp->w_popup_prop_win; |
1112 textprop_T prop; | 1102 textprop_T prop; |
1157 // right of the text | 1147 // right of the text |
1158 wantcol = screen_ecol + wantcol; | 1148 wantcol = screen_ecol + wantcol; |
1159 else | 1149 else |
1160 // left of the text | 1150 // left of the text |
1161 wantcol = screen_scol + wantcol - 2; | 1151 wantcol = screen_scol + wantcol - 2; |
1152 use_wantcol = TRUE; | |
1153 } | |
1154 else | |
1155 { | |
1156 // If no line was specified default to vertical centering. | |
1157 if (wantline == 0) | |
1158 center_vert = TRUE; | |
1159 else if (wantline < 0) | |
1160 // If "wantline" is negative it actually means zero. | |
1161 wantline = 0; | |
1162 if (wantcol < 0) | |
1163 // If "wantcol" is negative it actually means zero. | |
1164 wantcol = 0; | |
1162 } | 1165 } |
1163 | 1166 |
1164 if (wp->w_popup_pos == POPPOS_CENTER) | 1167 if (wp->w_popup_pos == POPPOS_CENTER) |
1165 { | 1168 { |
1166 // center after computing the size | 1169 // center after computing the size |
1167 center_vert = TRUE; | 1170 center_vert = TRUE; |
1168 center_hor = TRUE; | 1171 center_hor = TRUE; |
1169 } | 1172 } |
1170 else | 1173 else |
1171 { | 1174 { |
1172 if (use_wantline && (wp->w_popup_pos == POPPOS_TOPLEFT | 1175 if (wantline > 0 && (wp->w_popup_pos == POPPOS_TOPLEFT |
1173 || wp->w_popup_pos == POPPOS_TOPRIGHT)) | 1176 || wp->w_popup_pos == POPPOS_TOPRIGHT)) |
1174 { | 1177 { |
1175 wp->w_winrow = wantline - 1; | 1178 wp->w_winrow = wantline - 1; |
1176 if (wp->w_winrow >= Rows) | 1179 if (wp->w_winrow >= Rows) |
1177 wp->w_winrow = Rows - 1; | 1180 wp->w_winrow = Rows - 1; |
1178 } | 1181 } |