Mercurial > vim
comparison src/normal.c @ 18475:709c6b0dc78f v8.1.2231
patch 8.1.2231: not easy to move to the middle of a text line
Commit: https://github.com/vim/vim/commit/8b530c1ff91f07cf6b0289a536992b7dfbc86598
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Oct 28 02:13:05 2019 +0100
patch 8.1.2231: not easy to move to the middle of a text line
Problem: Not easy to move to the middle of a text line.
Solution: Add the gM command. (Yasuhiro Matsumoto, closes https://github.com/vim/vim/issues/2070)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 28 Oct 2019 02:15:05 +0100 |
parents | 34d5cd432cac |
children | e93cab5d0f0f |
comparison
equal
deleted
inserted
replaced
18474:95daf3963003 | 18475:709c6b0dc78f |
---|---|
5977 curwin->w_valid &= ~VALID_WCOL; | 5977 curwin->w_valid &= ~VALID_WCOL; |
5978 } | 5978 } |
5979 curwin->w_set_curswant = TRUE; | 5979 curwin->w_set_curswant = TRUE; |
5980 break; | 5980 break; |
5981 | 5981 |
5982 case 'M': | |
5983 { | |
5984 char_u *ptr = ml_get_curline(); | |
5985 | |
5986 oap->motion_type = MCHAR; | |
5987 oap->inclusive = FALSE; | |
5988 if (has_mbyte) | |
5989 i = mb_string2cells(ptr, STRLEN(ptr)); | |
5990 else | |
5991 i = (int)STRLEN(ptr); | |
5992 if (cap->count0 > 0 && cap->count0 <= 100) | |
5993 coladvance((colnr_T)(i * cap->count0 / 100)); | |
5994 else | |
5995 coladvance((colnr_T)(i / 2)); | |
5996 curwin->w_set_curswant = TRUE; | |
5997 } | |
5998 break; | |
5999 | |
5982 case '_': | 6000 case '_': |
5983 /* "g_": to the last non-blank character in the line or <count> lines | 6001 /* "g_": to the last non-blank character in the line or <count> lines |
5984 * downward. */ | 6002 * downward. */ |
5985 cap->oap->motion_type = MCHAR; | 6003 cap->oap->motion_type = MCHAR; |
5986 cap->oap->inclusive = TRUE; | 6004 cap->oap->inclusive = TRUE; |