mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 23:31:51 +00:00
fix(api/buffer): fix handling of viewport of non-current buffer
A lot of functions in move.c only worked for curwin, alternatively took a `wp` arg but still only work if that happens to be curwin. Refactor those that are needed for update_topline(wp) to work for any window. fixes #27723 fixes #27720
This commit is contained in:
@@ -707,7 +707,7 @@ void ins_char(int c)
|
||||
void ins_char_bytes(char *buf, size_t charlen)
|
||||
{
|
||||
// Break tabs if needed.
|
||||
if (virtual_active() && curwin->w_cursor.coladd > 0) {
|
||||
if (virtual_active(curwin) && curwin->w_cursor.coladd > 0) {
|
||||
coladvance_force(getviscol());
|
||||
}
|
||||
|
||||
@@ -815,7 +815,7 @@ void ins_str(char *s)
|
||||
int newlen = (int)strlen(s);
|
||||
linenr_T lnum = curwin->w_cursor.lnum;
|
||||
|
||||
if (virtual_active() && curwin->w_cursor.coladd > 0) {
|
||||
if (virtual_active(curwin) && curwin->w_cursor.coladd > 0) {
|
||||
coladvance_force(getviscol());
|
||||
}
|
||||
|
||||
@@ -918,7 +918,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
|
||||
// fixpos is true, we don't want to end up positioned at the NUL,
|
||||
// unless "restart_edit" is set or 'virtualedit' contains "onemore".
|
||||
if (col > 0 && fixpos && restart_edit == 0
|
||||
&& (get_ve_flags() & VE_ONEMORE) == 0) {
|
||||
&& (get_ve_flags(curwin) & VE_ONEMORE) == 0) {
|
||||
curwin->w_cursor.col--;
|
||||
curwin->w_cursor.coladd = 0;
|
||||
curwin->w_cursor.col -= utf_head_off(oldp, oldp + curwin->w_cursor.col);
|
||||
|
Reference in New Issue
Block a user