To: vim-dev@vim.org Subject: Patch 5.6a.001 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6a.001 Problem: Using with a count doesn't work like it does with "G". (Benji Fisher) Solution: Accept a count for and . Files: src/normal.c *** ../vim-5.6a/src/normal.c Sun Dec 19 19:45:34 1999 --- src/normal.c Mon Dec 20 09:45:46 1999 *************** *** 87,93 **** static void nv_wordcmd __ARGS((CMDARG *cap, int type)); static void adjust_for_sel __ARGS((CMDARG *cap)); static void unadjust_for_sel __ARGS((void)); ! static void nv_goto __ARGS((OPARG *oap, long lnum)); static void nv_select __ARGS((CMDARG *cap)); static void nv_normal __ARGS((CMDARG *cap)); static void nv_esc __ARGS((CMDARG *oap, linenr_t opnum)); --- 87,93 ---- static void nv_wordcmd __ARGS((CMDARG *cap, int type)); static void adjust_for_sel __ARGS((CMDARG *cap)); static void unadjust_for_sel __ARGS((void)); ! static void nv_goto __ARGS((CMDARG *cap, linenr_t lnum)); static void nv_select __ARGS((CMDARG *cap)); static void nv_normal __ARGS((CMDARG *cap)); static void nv_esc __ARGS((CMDARG *oap, linenr_t opnum)); *************** *** 712,719 **** * 3. Cursor motions */ case 'G': ! nv_goto(oap, ca.count0 == 0 ? (long)curbuf->b_ml.ml_line_count ! : ca.count0); break; case 'H': --- 712,718 ---- * 3. Cursor motions */ case 'G': ! nv_goto(&ca, curbuf->b_ml.ml_line_count); break; case 'H': *************** *** 806,812 **** case K_S_HOME: if ((mod_mask & MOD_MASK_CTRL)) /* CTRL-HOME = goto line 1 */ { ! nv_goto(oap, 1L); break; } ca.count0 = 1; --- 805,811 ---- case K_S_HOME: if ((mod_mask & MOD_MASK_CTRL)) /* CTRL-HOME = goto line 1 */ { ! nv_goto(&ca, (linenr_t)1); break; } ca.count0 = 1; *************** *** 852,858 **** case K_XEND: case K_S_END: if ((mod_mask & MOD_MASK_CTRL)) /* CTRL-END = goto last line */ ! nv_goto(oap, curbuf->b_ml.ml_line_count); /* FALLTHROUGH */ case '$': --- 851,860 ---- case K_XEND: case K_S_END: if ((mod_mask & MOD_MASK_CTRL)) /* CTRL-END = goto last line */ ! { ! nv_goto(&ca, curbuf->b_ml.ml_line_count); ! ca.count1 = 1; /* to end of current line */ ! } /* FALLTHROUGH */ case '$': *************** *** 5308,5314 **** * that line number like for "G". -- webb */ case 'g': ! nv_goto(oap, cap->count0); /* nv_goto() will change 0 into 1 */ break; /* --- 5310,5316 ---- * that line number like for "G". -- webb */ case 'g': ! nv_goto(cap, (linenr_t)1); break; /* *************** *** 5638,5650 **** } } static void ! nv_goto(oap, lnum) ! OPARG *oap; ! long lnum; { ! oap->motion_type = MLINE; setpcmark(); if (lnum < 1L) lnum = 1L; else if (lnum > curbuf->b_ml.ml_line_count) --- 5640,5659 ---- } } + /* + * "G", "gg", CTRL-END, CTRL-HOME. + */ static void ! nv_goto(cap, lnum) ! CMDARG *cap; ! linenr_t lnum; { ! cap->oap->motion_type = MLINE; setpcmark(); + + /* When a count is given, use it instead of the default lnum */ + if (cap->count0 != 0) + lnum = cap->count0; if (lnum < 1L) lnum = 1L; else if (lnum > curbuf->b_ml.ml_line_count) *** ../vim-5.6a/src/version.c Sun Dec 19 19:45:19 1999 --- src/version.c Mon Dec 20 09:50:04 1999 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 1, /**/ -- ARTHUR: No, hang on! Just answer the five questions ... GALAHAD: Three questions ... ARTHUR: Three questions ... And we shall watch ... and pray. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /