aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-10-02 22:43:59 -0700
committerGitHub <noreply@github.com>2019-10-02 22:43:59 -0700
commit30479417e808eac338025dbbfbd3724e158fb344 (patch)
treea8f0e660fc18436506f323d0e2be0eb3236485b6 /src/nvim/normal.c
parentb069e9b20f9e1f24fde34bee7d6e5d95f47ef10d (diff)
parent4518f230fa84e66737f6fc313fb669984974a1fd (diff)
downloadrneovim-30479417e808eac338025dbbfbd3724e158fb344.tar.gz
rneovim-30479417e808eac338025dbbfbd3724e158fb344.tar.bz2
rneovim-30479417e808eac338025dbbfbd3724e158fb344.zip
Merge #11087 from janlazo/vim-8.1.0010
vim-patch:8.1.{10,230,315,330,514,517,518,1327,1347,1758,2072,2074,2091,2095,2103}
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r--src/nvim/normal.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 4dfde96e94..e32b738c7e 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -3932,11 +3932,11 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist)
while (dist--) {
if (dir == BACKWARD) {
- if ((long)curwin->w_curswant >= width2)
- /* move back within line */
+ if (curwin->w_curswant > width2) {
+ // move back within line
curwin->w_curswant -= width2;
- else {
- /* to previous line */
+ } else {
+ // to previous line
if (curwin->w_cursor.lnum == 1) {
retval = false;
break;
@@ -4680,9 +4680,8 @@ static void nv_ctrlo(cmdarg_T *cap)
}
}
-/*
- * CTRL-^ command, short for ":e #"
- */
+// CTRL-^ command, short for ":e #". Works even when the alternate buffer is
+// not named.
static void nv_hat(cmdarg_T *cap)
{
if (!checkclearopq(cap->oap))
@@ -6795,10 +6794,14 @@ static void nv_g_cmd(cmdarg_T *cap)
} else if (nv_screengo(oap, FORWARD, cap->count1 - 1) == false)
clearopbeep(oap);
} else {
+ if (cap->count1 > 1) {
+ // if it fails, let the cursor still move to the last char
+ cursor_down(cap->count1 - 1, false);
+ }
i = curwin->w_leftcol + curwin->w_width_inner - col_off - 1;
coladvance((colnr_T)i);
- /* Make sure we stick in this column. */
+ // Make sure we stick in this column.
validate_virtcol();
curwin->w_curswant = curwin->w_virtcol;
curwin->w_set_curswant = false;