Created
July 19, 2017 15:14
-
-
Save ttdoda/e7c2d965845b77e73787a025b09fff88 to your computer and use it in GitHub Desktop.
左右マージン(垂直スクロールリージョン)使用時のカーソル位置修正
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/screen.c b/src/screen.c | |
index 0ec9ea2..01ea728 100644 | |
--- a/src/screen.c | |
+++ b/src/screen.c | |
@@ -9732,6 +9732,7 @@ screen_ins_lines( | |
int j; | |
unsigned temp; | |
int cursor_row; | |
+ int cursor_col = 0; | |
int type; | |
int result_empty; | |
int can_ce = can_clear(T_CE); | |
@@ -9829,6 +9830,12 @@ screen_ins_lines( | |
gui_dont_update_cursor(row + off <= gui.cursor_row); | |
#endif | |
+#ifdef FEAT_WINDOWS | |
+ if (wp != NULL && wp->w_width != Columns && *T_CSV != NUL && *T_CCS == NUL) { | |
+ cursor_col = W_WINCOL(wp); | |
+ } | |
+#endif | |
+ | |
if (*T_CCS != NUL) /* cursor relative to region */ | |
cursor_row = row; | |
else | |
@@ -9876,7 +9883,7 @@ screen_ins_lines( | |
} | |
screen_stop_highlight(); | |
- windgoto(cursor_row, 0); | |
+ windgoto(cursor_row, cursor_col); | |
#ifdef FEAT_WINDOWS | |
/* redraw the characters */ | |
@@ -9896,7 +9903,7 @@ screen_ins_lines( | |
if (type == USE_T_AL) | |
{ | |
if (i && cursor_row != 0) | |
- windgoto(cursor_row, 0); | |
+ windgoto(cursor_row, cursor_col); | |
out_str(T_AL); | |
} | |
else /* type == USE_T_SR */ | |
@@ -9913,7 +9920,7 @@ screen_ins_lines( | |
{ | |
for (i = 0; i < line_count; ++i) | |
{ | |
- windgoto(off + i, 0); | |
+ windgoto(off + i, cursor_col); | |
out_str(T_CE); | |
screen_start(); /* don't know where cursor is now */ | |
} | |
@@ -9948,6 +9955,7 @@ screen_del_lines( | |
int i; | |
unsigned temp; | |
int cursor_row; | |
+ int cursor_col = 0; | |
int cursor_end; | |
int result_empty; /* result is empty until end of region */ | |
int can_delete; /* deleting line codes can be used */ | |
@@ -10051,6 +10059,12 @@ screen_del_lines( | |
&& gui.cursor_row < end + off); | |
#endif | |
+#ifdef FEAT_WINDOWS | |
+ if (wp != NULL && wp->w_width != Columns && *T_CSV != NUL && *T_CCS == NUL) { | |
+ cursor_col = W_WINCOL(wp); | |
+ } | |
+#endif | |
+ | |
if (*T_CCS != NUL) /* cursor relative to region */ | |
{ | |
cursor_row = row; | |
@@ -10114,13 +10128,13 @@ screen_del_lines( | |
#endif | |
if (type == USE_T_CD) /* delete the lines */ | |
{ | |
- windgoto(cursor_row, 0); | |
+ windgoto(cursor_row, cursor_col); | |
out_str(T_CD); | |
screen_start(); /* don't know where cursor is now */ | |
} | |
else if (type == USE_T_CDL) | |
{ | |
- windgoto(cursor_row, 0); | |
+ windgoto(cursor_row, cursor_col); | |
term_delete_lines(line_count); | |
screen_start(); /* don't know where cursor is now */ | |
} | |
@@ -10131,7 +10145,7 @@ screen_del_lines( | |
*/ | |
else if (type == USE_NL) | |
{ | |
- windgoto(cursor_end - 1, 0); | |
+ windgoto(cursor_end - 1, cursor_col); | |
for (i = line_count; --i >= 0; ) | |
out_char('\n'); /* cursor will remain on same line */ | |
} | |
@@ -10141,12 +10155,12 @@ screen_del_lines( | |
{ | |
if (type == USE_T_DL) | |
{ | |
- windgoto(cursor_row, 0); | |
+ windgoto(cursor_row, cursor_col); | |
out_str(T_DL); /* delete a line */ | |
} | |
else /* type == USE_T_CE */ | |
{ | |
- windgoto(cursor_row + i, 0); | |
+ windgoto(cursor_row + i, cursor_col); | |
out_str(T_CE); /* erase a line */ | |
} | |
screen_start(); /* don't know where cursor is now */ | |
@@ -10161,7 +10175,7 @@ screen_del_lines( | |
{ | |
for (i = line_count; i > 0; --i) | |
{ | |
- windgoto(cursor_end - i, 0); | |
+ windgoto(cursor_end - i, cursor_col); | |
out_str(T_CE); /* erase a line */ | |
screen_start(); /* don't know where cursor is now */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment