+45
-2
lines changedFilter options
+45
-2
lines changed Original file line number Diff line number Diff line change
@@ -71,6 +71,7 @@ ArrayOf(Integer, 2) nvim_win_get_cursor(Window window, Error *err)
71
71
}
72
72
73
73
/// Sets the (1,0)-indexed cursor position in the window. |api-indexing|
74
+
/// Unlike |win_execute()| this scrolls the window.
74
75
///
75
76
/// @param window Window handle, or 0 for current window
76
77
/// @param pos (row, col) tuple representing the new position
@@ -118,6 +119,8 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err)
118
119
update_topline_win(win);
119
120
120
121
redraw_later(win, VALID);
122
+
redraw_for_cursorline(win);
123
+
win->w_redr_status = true;
121
124
}
122
125
123
126
/// Gets the window height
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
1
1
local helpers = require('test.functional.helpers')(after_each)
2
+
local Screen = require('test.functional.ui.screen')
2
3
local clear, nvim, curbuf, curbuf_contents, window, curwin, eq, neq,
3
4
ok, feed, insert, eval, tabpage = helpers.clear, helpers.nvim, helpers.curbuf,
4
5
helpers.curbuf_contents, helpers.window, helpers.curwin, helpers.eq,
@@ -73,8 +74,7 @@ describe('API/win', function()
73
74
eq('typing\n some dumb text', curbuf_contents())
74
75
end)
75
76
76
-
it('does not leak memory when using invalid window ID with invalid pos',
77
-
function()
77
+
it('does not leak memory when using invalid window ID with invalid pos', function()
78
78
eq('Invalid window id: 1', pcall_err(meths.win_set_cursor, 1, {"b\na"}))
79
79
end)
80
80
@@ -147,6 +147,46 @@ describe('API/win', function()
147
147
eq({2, 5}, window('get_cursor', win))
148
148
end)
149
149
150
+
it('updates cursorline and statusline ruler in non-current window', function()
151
+
local screen = Screen.new(60, 8)
152
+
screen:set_default_attr_ids({
153
+
[1] = {bold = true, foreground = Screen.colors.Blue}, -- NonText
154
+
[2] = {background = Screen.colors.Grey90}, -- CursorLine
155
+
[3] = {bold = true, reverse = true}, -- StatusLine
156
+
[4] = {reverse = true}, -- VertSplit, StatusLineNC
157
+
})
158
+
screen:attach()
159
+
command('set ruler')
160
+
command('set cursorline')
161
+
insert([[
162
+
aaa
163
+
bbb
164
+
ccc
165
+
ddd]])
166
+
local oldwin = curwin()
167
+
command('vsplit')
168
+
screen:expect([[
169
+
aaa {4:│}aaa |
170
+
bbb {4:│}bbb |
171
+
ccc {4:│}ccc |
172
+
{2:dd^d }{4:│}{2:ddd }|
173
+
{1:~ }{4:│}{1:~ }|
174
+
{1:~ }{4:│}{1:~ }|
175
+
{3:[No Name] [+] 4,3 All }{4:[No Name] [+] 4,3 All}|
176
+
|
177
+
]])
178
+
window('set_cursor', oldwin, {1, 0})
179
+
screen:expect([[
180
+
aaa {4:│}{2:aaa }|
181
+
bbb {4:│}bbb |
182
+
ccc {4:│}ccc |
183
+
{2:dd^d }{4:│}ddd |
184
+
{1:~ }{4:│}{1:~ }|
185
+
{1:~ }{4:│}{1:~ }|
186
+
{3:[No Name] [+] 4,3 All }{4:[No Name] [+] 1,1 All}|
187
+
|
188
+
]])
189
+
end)
150
190
end)
151
191
152
192
describe('{get,set}_height', function()
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4