Created
January 28, 2012 15:42
-
-
Save h-east/1694734 to your computer and use it in GitHub Desktop.
patch for vim-jp/Issue#147 (Inspired from @hdk1983 [Hideki EIRAKU])
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 -r 54d621a3b561 src/edit.c | |
--- a/src/edit.c Thu Jan 26 20:58:26 2012 +0100 | |
+++ b/src/edit.c Sun Jan 29 00:34:53 2012 +0900 | |
@@ -1763,9 +1763,9 @@ | |
static void | |
undisplay_dollar() | |
{ | |
- if (dollar_vcol) | |
- { | |
- dollar_vcol = 0; | |
+ if (dollar_vcol >= 0) | |
+ { | |
+ dollar_vcol = -1; | |
redrawWinline(curwin->w_cursor.lnum, FALSE); | |
} | |
} | |
@@ -5441,7 +5441,7 @@ | |
compl_curr_match->cp_number); | |
edit_submode_extra = match_ref; | |
edit_submode_highl = HLF_R; | |
- if (dollar_vcol) | |
+ if (dollar_vcol >= 0) | |
curs_columns(FALSE); | |
} | |
} | |
@@ -8961,7 +8961,7 @@ | |
* We can emulate the vi behaviour by pretending there is a dollar | |
* displayed even when there isn't. | |
* --pkv Sun Jan 19 01:56:40 EST 2003 */ | |
- if (vim_strchr(p_cpo, CPO_BACKSPACE) != NULL && dollar_vcol == 0) | |
+ if (vim_strchr(p_cpo, CPO_BACKSPACE) != NULL && dollar_vcol < 0) | |
dollar_vcol = curwin->w_virtcol; | |
#ifdef FEAT_FOLDING | |
diff -r 54d621a3b561 src/globals.h | |
--- a/src/globals.h Thu Jan 26 20:58:26 2012 +0100 | |
+++ b/src/globals.h Sun Jan 29 00:34:53 2012 +0900 | |
@@ -115,7 +115,7 @@ | |
* is put at the end of the changed text. dollar_vcol is set to the virtual | |
* column of this '$'. | |
*/ | |
-EXTERN colnr_T dollar_vcol INIT(= 0); | |
+EXTERN colnr_T dollar_vcol INIT(= -1); | |
#ifdef FEAT_INS_EXPAND | |
/* | |
diff -r 54d621a3b561 src/move.c | |
--- a/src/move.c Thu Jan 26 20:58:26 2012 +0100 | |
+++ b/src/move.c Sun Jan 29 00:34:53 2012 +0900 | |
@@ -362,7 +362,7 @@ | |
#endif | |
) | |
{ | |
- dollar_vcol = 0; | |
+ dollar_vcol = -1; | |
if (curwin->w_skipcol != 0) | |
{ | |
curwin->w_skipcol = 0; | |
@@ -966,7 +966,7 @@ | |
/* remove '$' from change command when cursor moves onto it */ | |
if (startcol > dollar_vcol) | |
- dollar_vcol = 0; | |
+ dollar_vcol = -1; | |
extra = curwin_col_off(); | |
curwin->w_wcol = curwin->w_virtcol + extra; | |
diff -r 54d621a3b561 src/screen.c | |
--- a/src/screen.c Thu Jan 26 20:58:26 2012 +0100 | |
+++ b/src/screen.c Sun Jan 29 00:34:53 2012 +0900 | |
@@ -1637,11 +1637,12 @@ | |
* When at start of changed lines: May scroll following lines | |
* up or down to minimize redrawing. | |
* Don't do this when the change continues until the end. | |
- * Don't scroll when dollar_vcol is non-zero, keep the "$". | |
+ * Don't scroll when dollar_vcol is greater than equal zero, | |
+ * keep the "$". | |
*/ | |
if (lnum == mod_top | |
&& mod_bot != MAXLNUM | |
- && !(dollar_vcol != 0 && mod_bot == mod_top + 1)) | |
+ && !(dollar_vcol >= 0 && mod_bot == mod_top + 1)) | |
{ | |
int old_rows = 0; | |
int new_rows = 0; | |
@@ -1868,12 +1869,12 @@ | |
if (row > wp->w_height) /* past end of screen */ | |
{ | |
/* we may need the size of that too long line later on */ | |
- if (dollar_vcol == 0) | |
+ if (dollar_vcol < 0) | |
wp->w_lines[idx].wl_size = plines_win(wp, lnum, TRUE); | |
++idx; | |
break; | |
} | |
- if (dollar_vcol == 0) | |
+ if (dollar_vcol < 0) | |
wp->w_lines[idx].wl_size = row - srow; | |
++idx; | |
#ifdef FEAT_FOLDING | |
@@ -1990,7 +1991,7 @@ | |
} | |
#endif | |
} | |
- else if (dollar_vcol == 0) | |
+ else if (dollar_vcol < 0) | |
wp->w_botline = lnum; | |
/* make sure the rest of the screen is blank */ | |
@@ -2005,7 +2006,7 @@ | |
wp->w_old_botfill = wp->w_botfill; | |
#endif | |
- if (dollar_vcol == 0) | |
+ if (dollar_vcol < 0) | |
{ | |
/* | |
* There is a trick with w_botline. If we invalidate it on each | |
@@ -3564,7 +3565,7 @@ | |
} | |
/* When still displaying '$' of change command, stop at cursor */ | |
- if (dollar_vcol != 0 && wp == curwin | |
+ if (dollar_vcol >= 0 && wp == curwin | |
&& lnum == wp->w_cursor.lnum && vcol >= (long)wp->w_virtcol | |
#ifdef FEAT_DIFF | |
&& filler_todo <= 0 | |
diff -r 54d621a3b561 src/search.c | |
--- a/src/search.c Thu Jan 26 20:58:26 2012 +0100 | |
+++ b/src/search.c Sun Jan 29 00:34:53 2012 +0900 | |
@@ -2501,8 +2501,8 @@ | |
save_siso = p_siso; | |
/* Handle "$" in 'cpo': If the ')' is typed on top of the "$", | |
* stop displaying the "$". */ | |
- if (dollar_vcol > 0 && dollar_vcol == curwin->w_virtcol) | |
- dollar_vcol = 0; | |
+ if (dollar_vcol >= 0 && dollar_vcol == curwin->w_virtcol) | |
+ dollar_vcol = -1; | |
++curwin->w_virtcol; /* do display ')' just before "$" */ | |
update_screen(VALID); /* show the new char first */ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment