Skip to content

Commit bfa4246

Browse files
committed
patch 8.1.0058: display problem with margins and scrolling
Problem: Display problem with margins and scrolling. Solution: Place the cursor in the right column. (Kouichi Iwamoto, closes #3016)
1 parent 6ba3ec1 commit bfa4246

2 files changed

Lines changed: 19 additions & 9 deletions

File tree

src/screen.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9797,6 +9797,7 @@ screen_ins_lines(
97979797
int j;
97989798
unsigned temp;
97999799
int cursor_row;
9800+
int cursor_col = 0;
98009801
int type;
98019802
int result_empty;
98029803
int can_ce = can_clear(T_CE);
@@ -9893,6 +9894,9 @@ screen_ins_lines(
98939894
gui_dont_update_cursor(row + off <= gui.cursor_row);
98949895
#endif
98959896

9897+
if (wp != NULL && wp->w_wincol != 0 && *T_CSV != NUL && *T_CCS == NUL)
9898+
cursor_col = wp->w_wincol;
9899+
98969900
if (*T_CCS != NUL) /* cursor relative to region */
98979901
cursor_row = row;
98989902
else
@@ -9939,7 +9943,7 @@ screen_ins_lines(
99399943
}
99409944

99419945
screen_stop_highlight();
9942-
windgoto(cursor_row, 0);
9946+
windgoto(cursor_row, cursor_col);
99439947
if (clear_attr != 0)
99449948
screen_start_highlight(clear_attr);
99459949

@@ -9958,7 +9962,7 @@ screen_ins_lines(
99589962
if (type == USE_T_AL)
99599963
{
99609964
if (i && cursor_row != 0)
9961-
windgoto(cursor_row, 0);
9965+
windgoto(cursor_row, cursor_col);
99629966
out_str(T_AL);
99639967
}
99649968
else /* type == USE_T_SR */
@@ -9975,7 +9979,7 @@ screen_ins_lines(
99759979
{
99769980
for (i = 0; i < line_count; ++i)
99779981
{
9978-
windgoto(off + i, 0);
9982+
windgoto(off + i, cursor_col);
99799983
out_str(T_CE);
99809984
screen_start(); /* don't know where cursor is now */
99819985
}
@@ -10011,6 +10015,7 @@ screen_del_lines(
1001110015
int i;
1001210016
unsigned temp;
1001310017
int cursor_row;
10018+
int cursor_col = 0;
1001410019
int cursor_end;
1001510020
int result_empty; /* result is empty until end of region */
1001610021
int can_delete; /* deleting line codes can be used */
@@ -10110,6 +10115,9 @@ screen_del_lines(
1011010115
&& gui.cursor_row < end + off);
1011110116
#endif
1011210117

10118+
if (wp != NULL && wp->w_wincol != 0 && *T_CSV != NUL && *T_CCS == NUL)
10119+
cursor_col = wp->w_wincol;
10120+
1011310121
if (*T_CCS != NUL) /* cursor relative to region */
1011410122
{
1011510123
cursor_row = row;
@@ -10172,13 +10180,13 @@ screen_del_lines(
1017210180
redraw_block(row, end, wp);
1017310181
else if (type == USE_T_CD) /* delete the lines */
1017410182
{
10175-
windgoto(cursor_row, 0);
10183+
windgoto(cursor_row, cursor_col);
1017610184
out_str(T_CD);
1017710185
screen_start(); /* don't know where cursor is now */
1017810186
}
1017910187
else if (type == USE_T_CDL)
1018010188
{
10181-
windgoto(cursor_row, 0);
10189+
windgoto(cursor_row, cursor_col);
1018210190
term_delete_lines(line_count);
1018310191
screen_start(); /* don't know where cursor is now */
1018410192
}
@@ -10189,7 +10197,7 @@ screen_del_lines(
1018910197
*/
1019010198
else if (type == USE_NL)
1019110199
{
10192-
windgoto(cursor_end - 1, 0);
10200+
windgoto(cursor_end - 1, cursor_col);
1019310201
for (i = line_count; --i >= 0; )
1019410202
out_char('\n'); /* cursor will remain on same line */
1019510203
}
@@ -10199,12 +10207,12 @@ screen_del_lines(
1019910207
{
1020010208
if (type == USE_T_DL)
1020110209
{
10202-
windgoto(cursor_row, 0);
10210+
windgoto(cursor_row, cursor_col);
1020310211
out_str(T_DL); /* delete a line */
1020410212
}
1020510213
else /* type == USE_T_CE */
1020610214
{
10207-
windgoto(cursor_row + i, 0);
10215+
windgoto(cursor_row + i, cursor_col);
1020810216
out_str(T_CE); /* erase a line */
1020910217
}
1021010218
screen_start(); /* don't know where cursor is now */
@@ -10219,7 +10227,7 @@ screen_del_lines(
1021910227
{
1022010228
for (i = line_count; i > 0; --i)
1022110229
{
10222-
windgoto(cursor_end - i, 0);
10230+
windgoto(cursor_end - i, cursor_col);
1022310231
out_str(T_CE); /* erase a line */
1022410232
screen_start(); /* don't know where cursor is now */
1022510233
}

src/version.c

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

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
58,
764766
/**/
765767
57,
766768
/**/

0 commit comments

Comments
 (0)