comparison src/popupwin.c @ 19647:c8cb1a41f64c v8.2.0380

patch 8.2.0380: tiny popup when creating a terminal popup without minwidth Commit: https://github.com/vim/vim/commit/193982650960f8411df51f3b3b0d44a75e1ac034 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Mar 14 15:28:08 2020 +0100 patch 8.2.0380: tiny popup when creating a terminal popup without minwidth Problem: Tiny popup when creating a terminal popup without minwidth. Solution: Use a default mininum size of 5 lines of 20 characters.
author Bram Moolenaar <Bram@vim.org>
date Sat, 14 Mar 2020 15:30:03 +0100
parents 8de319d1b82c
children 435726a03481
comparison
equal deleted inserted replaced
19646:847a300aa244 19647:c8cb1a41f64c
1125 int org_wincol = wp->w_wincol; 1125 int org_wincol = wp->w_wincol;
1126 int org_width = wp->w_width; 1126 int org_width = wp->w_width;
1127 int org_height = wp->w_height; 1127 int org_height = wp->w_height;
1128 int org_leftcol = wp->w_leftcol; 1128 int org_leftcol = wp->w_leftcol;
1129 int org_leftoff = wp->w_popup_leftoff; 1129 int org_leftoff = wp->w_popup_leftoff;
1130 int minwidth; 1130 int minwidth, minheight;
1131 int wantline = wp->w_wantline; // adjusted for textprop 1131 int wantline = wp->w_wantline; // adjusted for textprop
1132 int wantcol = wp->w_wantcol; // adjusted for textprop 1132 int wantcol = wp->w_wantcol; // adjusted for textprop
1133 int use_wantcol = wantcol != 0; 1133 int use_wantcol = wantcol != 0;
1134 1134
1135 wp->w_winrow = 0; 1135 wp->w_winrow = 0;
1247 { 1247 {
1248 allow_adjust_left = FALSE; 1248 allow_adjust_left = FALSE;
1249 maxwidth = wp->w_maxwidth; 1249 maxwidth = wp->w_maxwidth;
1250 } 1250 }
1251 minwidth = wp->w_minwidth; 1251 minwidth = wp->w_minwidth;
1252 minheight = wp->w_minheight;
1253 #ifdef FEAT_TERMINAL
1254 // A terminal popup initially does not have content, use a default minimal
1255 // width of 20 characters and height of 5 lines.
1256 if (wp->w_buffer->b_term != NULL)
1257 {
1258 if (minwidth == 0)
1259 minwidth = 20;
1260 if (minheight == 0)
1261 minheight = 5;
1262 }
1263 #endif
1252 1264
1253 // start at the desired first line 1265 // start at the desired first line
1254 if (wp->w_firstline > 0) 1266 if (wp->w_firstline > 0)
1255 wp->w_topline = wp->w_firstline; 1267 wp->w_topline = wp->w_firstline;
1256 if (wp->w_topline < 1) 1268 if (wp->w_topline < 1)
1417 } 1429 }
1418 } 1430 }
1419 1431
1420 wp->w_height = wp->w_buffer->b_ml.ml_line_count - wp->w_topline 1432 wp->w_height = wp->w_buffer->b_ml.ml_line_count - wp->w_topline
1421 + 1 + wrapped; 1433 + 1 + wrapped;
1422 if (wp->w_minheight > 0 && wp->w_height < wp->w_minheight) 1434 if (minheight > 0 && wp->w_height < minheight)
1423 wp->w_height = wp->w_minheight; 1435 wp->w_height = minheight;
1424 if (wp->w_maxheight > 0 && wp->w_height > wp->w_maxheight) 1436 if (wp->w_maxheight > 0 && wp->w_height > wp->w_maxheight)
1425 wp->w_height = wp->w_maxheight; 1437 wp->w_height = wp->w_maxheight;
1426 w_height_before_limit = wp->w_height; 1438 w_height_before_limit = wp->w_height;
1427 if (wp->w_height > Rows - wp->w_winrow) 1439 if (wp->w_height > Rows - wp->w_winrow)
1428 wp->w_height = Rows - wp->w_winrow; 1440 wp->w_height = Rows - wp->w_winrow;