File: Revert-patch-9.1.0949-popups-inconsistently-shifted-to-th.patch

package info (click to toggle)
vim 2%3A9.1.1882-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 92,504 kB
  • sloc: ansic: 432,444; cpp: 6,371; makefile: 4,596; sh: 2,387; java: 2,312; xml: 2,099; python: 1,559; perl: 1,419; awk: 730; lisp: 501; cs: 458; objc: 369; sed: 8; csh: 6
file content (166 lines) | stat: -rw-r--r-- 5,513 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
From: James McCoy <jamessan@debian.org>
Date: Thu, 9 Jan 2025 20:38:13 -0500
Subject: Revert "patch 9.1.0949: popups inconsistently shifted to the left"

This reverts commit 13c1153eefe54ce933e60258358300868c22f68a.

It causes a regression in vim-YouCompleteMe's autopkgtests.
https://github.com/ycm-core/YouCompleteMe/issues/4284

Closes: #1091729
---
 runtime/doc/popup.txt         |  1 +
 src/popupwin.c                | 23 ++++++++++++-----------
 src/testdir/test_popupwin.vim | 26 ++++++--------------------
 src/version.c                 |  2 --
 4 files changed, 19 insertions(+), 33 deletions(-)

diff --git a/runtime/doc/popup.txt b/runtime/doc/popup.txt
index 41f4da5..8c6bc32 100644
--- a/runtime/doc/popup.txt
+++ b/runtime/doc/popup.txt
@@ -713,6 +713,7 @@ The second argument of |popup_create()| is a dictionary with options:
 			present.  Use zero to reset.
 	fixed		When FALSE (the default), and:
 			 - "pos" is "botleft" or "topleft", and
+			 - "wrap" is off, and
 			 - the popup would be truncated at the right edge of
 			   the screen, then
 			the popup is moved to the left so as to fit the
diff --git a/src/popupwin.c b/src/popupwin.c
index 96f669a..53e2e86 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -1443,7 +1443,17 @@ popup_adjust_position(win_T *wp)
 	len = linetabsize(wp, lnum);
 	wp->w_width = w_width;
 
-	if (len + margin_width > maxwidth
+	if (wp->w_p_wrap)
+	{
+	    while (len + margin_width > maxwidth)
+	    {
+		++wrapped;
+		len -= maxwidth - margin_width;
+		wp->w_width = maxwidth;
+		used_maxwidth = TRUE;
+	    }
+	}
+	else if (len + margin_width > maxwidth
 		&& allow_adjust_left
 		&& (wp->w_popup_pos == POPPOS_TOPLEFT
 		    || wp->w_popup_pos == POPPOS_BOTLEFT))
@@ -1455,6 +1465,7 @@ popup_adjust_position(win_T *wp)
 	    {
 		int truncate_shift = shift_by - wp->w_wincol;
 
+		len -= truncate_shift;
 		shift_by -= truncate_shift;
 	    }
 
@@ -1462,16 +1473,6 @@ popup_adjust_position(win_T *wp)
 	    maxwidth += shift_by;
 	    wp->w_width = maxwidth;
 	}
-	if (wp->w_p_wrap)
-	{
-	    while (len + margin_width > maxwidth)
-	    {
-		++wrapped;
-		len -= maxwidth - margin_width;
-		wp->w_width = maxwidth;
-		used_maxwidth = TRUE;
-	    }
-	}
 	if (wp->w_width < len + margin_width)
 	{
 	    wp->w_width = len + margin_width;
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 4b616a8..6894aba 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -29,7 +29,7 @@ func Test_simple_popup()
 	\ .. "#{text: 'a comment line', props: [#{"
 	\ .. "col: 3, length: 7, minwidth: 20, type: 'comment'"
 	\ .. "}]},"
-	\ .. "], #{line: 4, col: 9, minwidth: 20, fixed: v:true})\<CR>")
+	\ .. "], #{line: 4, col: 9, minwidth: 20})\<CR>")
   call VerifyScreenDump(buf, 'Test_popupwin_02', {})
 
   " switch back to first tabpage
@@ -85,7 +85,7 @@ func Test_popup_with_border_and_padding()
 	  call popup_create('hello both', #{line: 2, col: 43, border: [], padding: [], highlight: 'Normal'})
 	  call popup_create('border TL', #{line: 6, col: 3, border: [1, 0, 0, 4]})
 	  call popup_create('paddings', #{line: 6, col: 23, padding: range(1, 4)})
-	  call popup_create('wrapped longer text', #{line: 8, col: 55, padding: [0, 3, 0, 3], border: [0, 1, 0, 1], fixed: v:true})
+	  call popup_create('wrapped longer text', #{line: 8, col: 55, padding: [0, 3, 0, 3], border: [0, 1, 0, 1]})
 	  call popup_create('right aligned text', #{line: 11, col: 56, wrap: 0, padding: [0, 3, 0, 3], border: [0, 1, 0, 1]})
 	  call popup_create('X', #{line: 2, col: 73})
 	  call popup_create('X', #{line: 3, col: 74})
@@ -1969,7 +1969,7 @@ func Test_popup_position_adjust()
   " Anything placed past the last cell on the right of the screen is moved to
   " the left.
   "
-  " We also shift to the left to display on the
+  " When wrapping is disabled, we also shift to the left to display on the
   " screen, unless fixed is set.
 
   " Entries for cases which don't vary based on wrapping.
@@ -1994,10 +1994,9 @@ func Test_popup_position_adjust()
   "     - expected height
   let tests = [
 	\ #{
-	\   comment: 'left aligned with wrapping, fixed position',
+	\   comment: 'left-aligned with wrapping',
 	\   options: #{
 	\     wrap: 1,
-	\     fixed: v:true,
 	\     pos: 'botleft',
 	\   },
 	\   tests: both_wrap_tests + [
@@ -2022,22 +2021,9 @@ func Test_popup_position_adjust()
 	\   ],
 	\ },
 	\ #{
-	\   comment: 'left aligned with wrapping, no fixed position',
-	\   options: #{
-	\     wrap: 1,
-	\     fixed: v:false,
-	\     pos: 'botleft',
-	\   },
-	\   tests: both_wrap_tests + [
-	\       [ repeat('a', &columns*3), 5, &columns,   3,                 1, &columns, 3],
-	\       [ repeat('a', 50),         5, &columns,   5, &columns - 50 + 1,       50, 1],
-	\   ],
-	\ },
-	\ #{
-	\   comment: 'left aligned without wrapping, no fixed position',
+	\   comment: 'left aligned without wrapping',
 	\   options: #{
 	\     wrap: 0,
-	\     fixed: v:false,
 	\     pos: 'botleft',
 	\   },
 	\   tests: both_wrap_tests + [
@@ -2061,7 +2047,7 @@ func Test_popup_position_adjust()
 	\   ],
 	\ },
 	\ #{
-	\   comment: 'left aligned without wrapping, fixed position',
+	\   comment: 'left aligned with fixed position',
 	\   options: #{
 	\     wrap: 0,
 	\     fixed: 1,
diff --git a/src/version.c b/src/version.c
index 2526c09..92397ee 100644
--- a/src/version.c
+++ b/src/version.c
@@ -2578,8 +2578,6 @@ static int included_patches[] =
     951,
 /**/
     950,
-/**/
-    949,
 /**/
     948,
 /**/