Skip to content

Instantly share code, notes, and snippets.

@ttdoda
Last active December 18, 2015 04:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ttdoda/5726992 to your computer and use it in GitHub Desktop.
Save ttdoda/5726992 to your computer and use it in GitHub Desktop.
vsplit時、IL/DL/NLの実行をスクロールリージョン内で行うようにする。
--- screen.c.orig 2013-06-15 17:29:09.000000000 +0900
+++ screen.c 2013-06-15 17:45:44.000000000 +0900
@@ -9020,6 +9020,7 @@
int j;
unsigned temp;
int cursor_row;
+ int cursor_col = 0;
int type;
int result_empty;
int can_ce = can_clear(T_CE);
@@ -9117,6 +9118,11 @@
gui_dont_update_cursor();
#endif
+#ifdef FEAT_VERTSPLIT
+ 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
@@ -9164,7 +9170,7 @@
}
screen_stop_highlight();
- windgoto(cursor_row, 0);
+ windgoto(cursor_row, cursor_col);
#ifdef FEAT_VERTSPLIT
/* redraw the characters */
@@ -9184,7 +9190,7 @@
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 */
@@ -9201,7 +9207,7 @@
{
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 */
}
@@ -9236,6 +9242,7 @@
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 */
@@ -9338,6 +9345,11 @@
gui_dont_update_cursor();
#endif
+#ifdef FEAT_VERTSPLIT
+ 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;
@@ -9401,13 +9413,13 @@
#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 */
}
@@ -9418,7 +9430,7 @@
*/
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 */
}
@@ -9428,12 +9440,12 @@
{
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 */
@@ -9448,7 +9460,7 @@
{
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