summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.1131
blob: 90cd3ad3154183e7968f4389425116adb6aafe0a (plain)
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
To: vim_dev@googlegroups.com
Subject: Patch 8.1.1131
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.1131
Problem:    getwinpos() does not work in the MS-Windows console.
Solution:   Implement getwinpos().
Files:	    src/ui.c, src/evalfunc.c, src/terminal.c,
            src/testdir/test_terminal.vim


*** ../vim-8.1.1130/src/ui.c	2019-04-06 20:00:15.429129945 +0200
--- src/ui.c	2019-04-06 21:49:45.780723617 +0200
***************
*** 629,634 ****
--- 629,635 ----
  
  #if ((defined(FEAT_EVAL) || defined(FEAT_TERMINAL)) \
  	    && (defined(FEAT_GUI) \
+ 		|| defined(MSWIN) \
  		|| (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)))) \
  	|| defined(PROTO)
  /*
***************
*** 642,651 ****
      if (gui.in_use)
  	return gui_mch_get_winpos(x, y);
  # endif
! # if defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)
!     return term_get_winpos(x, y, timeout);
  # else
      return FAIL;
  # endif
  }
  #endif
--- 643,656 ----
      if (gui.in_use)
  	return gui_mch_get_winpos(x, y);
  # endif
! # if defined(MSWIN) && !defined(FEAT_GUI)
!     return mch_get_winpos(x, y);
  # else
+ #  if defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)
+     return term_get_winpos(x, y, timeout);
+ #  else
      return FAIL;
+ #  endif
  # endif
  }
  #endif
*** ../vim-8.1.1130/src/evalfunc.c	2019-04-06 20:53:26.042494665 +0200
--- src/evalfunc.c	2019-04-06 21:47:10.709543453 +0200
***************
*** 5985,5991 ****
  
      if (rettv_list_alloc(rettv) == FAIL)
  	return;
! #if defined(FEAT_GUI) || (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE))
      {
  	varnumber_T timeout = 100;
  
--- 5985,5993 ----
  
      if (rettv_list_alloc(rettv) == FAIL)
  	return;
! #if defined(FEAT_GUI) \
! 	|| (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)) \
! 	|| defined(MSWIN)
      {
  	varnumber_T timeout = 100;
  
***************
*** 6007,6013 ****
  f_getwinposx(typval_T *argvars UNUSED, typval_T *rettv)
  {
      rettv->vval.v_number = -1;
! #if defined(FEAT_GUI) || (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE))
      {
  	int	    x, y;
  
--- 6009,6018 ----
  f_getwinposx(typval_T *argvars UNUSED, typval_T *rettv)
  {
      rettv->vval.v_number = -1;
! #if defined(FEAT_GUI) \
! 	|| (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)) \
! 	|| defined(MSWIN)
! 
      {
  	int	    x, y;
  
***************
*** 6024,6030 ****
  f_getwinposy(typval_T *argvars UNUSED, typval_T *rettv)
  {
      rettv->vval.v_number = -1;
! #if defined(FEAT_GUI) || (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE))
      {
  	int	    x, y;
  
--- 6029,6037 ----
  f_getwinposy(typval_T *argvars UNUSED, typval_T *rettv)
  {
      rettv->vval.v_number = -1;
! #if defined(FEAT_GUI) \
! 	|| (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)) \
! 	|| defined(MSWIN)
      {
  	int	    x, y;
  
*** ../vim-8.1.1130/src/terminal.c	2019-04-06 20:00:15.433129920 +0200
--- src/terminal.c	2019-04-06 21:47:28.685448823 +0200
***************
*** 3868,3874 ****
  
      // When getting the window position is not possible or it fails it results
      // in zero/zero.
! #if defined(FEAT_GUI) || (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE))
      (void)ui_get_winpos(&x, &y, (varnumber_T)100);
  #endif
  
--- 3868,3876 ----
  
      // When getting the window position is not possible or it fails it results
      // in zero/zero.
! #if defined(FEAT_GUI) \
! 	|| (defined(HAVE_TGETENT) && defined(FEAT_TERMRESPONSE)) \
! 	|| defined(MSWIN)
      (void)ui_get_winpos(&x, &y, (varnumber_T)100);
  #endif
  
*** ../vim-8.1.1130/src/testdir/test_terminal.vim	2019-04-06 20:40:32.362959652 +0200
--- src/testdir/test_terminal.vim	2019-04-06 21:58:50.945799533 +0200
***************
*** 1889,1900 ****
  endfunc
  
  func Test_terminal_getwinpos()
-   " getwinpos() does not work in the MS-Windows console, and the GUI runs the
-   " console version in the terminal window.
-   if has('win32')
-     return
-   endif
- 
    " split, go to the bottom-right window
    split
    wincmd j
--- 1889,1894 ----
***************
*** 1913,1922 ****
    let xpos = str2nr(substitute(line, '\[\(\d\+\), \d\+\]', '\1', ''))
    let ypos = str2nr(substitute(line, '\[\d\+, \(\d\+\)\]', '\1', ''))
  
!   " Position must be bigger than the getwinpos() result of Vim itself.
!   let [xroot, yroot] = getwinpos()
!   call assert_inrange(xroot + 2, xroot + 1000, xpos)
!   call assert_inrange(yroot + 2, yroot + 1000, ypos)
  
    call term_wait(buf)
    call term_sendkeys(buf, ":q\<CR>")
--- 1907,1923 ----
    let xpos = str2nr(substitute(line, '\[\(\d\+\), \d\+\]', '\1', ''))
    let ypos = str2nr(substitute(line, '\[\d\+, \(\d\+\)\]', '\1', ''))
  
!   " getwinpos() in the MS-Windows console returns the screen position of the
!   " emulated console.
!   if has('win32')
!     call assert_inrange(0, 4000, xpos)
!     call assert_inrange(0, 2000, ypos)
!   else
!     " Position must be bigger than the getwinpos() result of Vim itself.
!     let [xroot, yroot] = getwinpos()
!     call assert_inrange(xroot + 2, xroot + 1000, xpos)
!     call assert_inrange(yroot + 2, yroot + 1000, ypos)
!   endif
  
    call term_wait(buf)
    call term_sendkeys(buf, ":q\<CR>")
*** ../vim-8.1.1130/src/version.c	2019-04-06 20:53:26.042494665 +0200
--- src/version.c	2019-04-06 21:59:10.497693909 +0200
***************
*** 773,774 ****
--- 773,776 ----
  {   /* Add new patch number below this line */
+ /**/
+     1131,
  /**/

-- 
Don't be humble ... you're not that great.
                      -- Golda Meir

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///