Skip to content

Commit e089c3f

Browse files
committed
patch 8.1.1656: popup window width is wrong when using Tabs
Problem: Popup window width is wrong when using Tabs. (Paul Jolly) Solution: Count tabs correctly. (closes #4637)
1 parent 3dabd71 commit e089c3f

4 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/popupwin.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,9 @@ popup_adjust_position(win_T *wp)
880880
wp->w_width = 1;
881881
for (lnum = wp->w_topline; lnum <= wp->w_buffer->b_ml.ml_line_count; ++lnum)
882882
{
883-
int len = vim_strsize(ml_get_buf(wp->w_buffer, lnum, FALSE));
883+
// count Tabs for what they are worth
884+
int len = win_linetabsize(wp, ml_get_buf(wp->w_buffer, lnum, FALSE),
885+
(colnr_T)MAXCOL);
884886

885887
if (wp->w_p_wrap)
886888
{
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
>1+0&#ffffff0| @73
22
|2| @73
3-
|3| @18|#+0#e000e06#e0e0e08|i|n|c|l|u|d|e| |<+0#e000002&|s|t|d|i|o|.|h|>| +0#0000000#ffffff0@36
4-
|4| @18|i+0#00e0003#e0e0e08|n|t| +0#0000000&|m|a|i|n|(|v+0#00e0003&|o|i|d|)+0#0000000&| @3| +0&#ffffff0@36
5-
|5| @18|{+0&#e0e0e08| @16| +0&#ffffff0@36
6-
|6| @18| +0&#e0e0e08@3|p|r|i|n|t|f|(|5+0#e000002&|6|7|)+0#0000000&|;| @1| +0&#ffffff0@36
7-
|7| @18|}+0&#e0e0e08| @16| +0&#ffffff0@36
3+
|3| @18|#+0#e000e06#e0e0e08|i|n|c|l|u|d|e| |<+0#e000002&|s|t|d|i|o|.|h|>| +0#0000000&@1| +0&#ffffff0@34
4+
|4| @18|i+0#00e0003#e0e0e08|n|t| +0#0000000&|m|a|i|n|(|v+0#00e0003&|o|i|d|)+0#0000000&| @5| +0&#ffffff0@34
5+
|5| @18|{+0&#e0e0e08| @18| +0&#ffffff0@34
6+
|6| @18| +0&#e0e0e08@7|p|r|i|n|t|f|(|5+0#e000002&|6|7|)+0#0000000&|;| +0&#ffffff0@34
7+
|7| @18|}+0&#e0e0e08| @18| +0&#ffffff0@34
88
|8| @73
99
|9| @73
1010
@57|1|,|1| @10|T|o|p|

src/testdir/test_popupwin.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ func Test_popup_with_syntax_setbufvar()
225225
\ '#include <stdio.h>',
226226
\ 'int main(void)',
227227
\ '{',
228-
\ ' printf(567);',
228+
\ "\tprintf(567);",
229229
\ '}',
230230
\], {'line': 3, 'col': 21, 'highlight': 'PopupColor'})
231231
call setbufvar(winbufnr(winid), '&syntax', 'cpp')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,8 @@ static char *(features[]) =
777777

778778
static int included_patches[] =
779779
{ /* Add new patch number below this line */
780+
/**/
781+
1656,
780782
/**/
781783
1655,
782784
/**/

0 commit comments

Comments
 (0)