Mercurial > vim
comparison src/normal.c @ 6927:58d9f967ae1a v7.4.782
patch 7.4.782
Problem: Still a few problems with CTRL-A and CTRL-X in Visual mode.
Solution: Fix the reported problems. (Christian Brabandt)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Fri, 17 Jul 2015 13:03:48 +0200 |
parents | f9876721bedc |
children | 1e621b31948b |
comparison
equal
deleted
inserted
replaced
6926:b2839b524d9f | 6927:58d9f967ae1a |
---|---|
38 #if defined(FEAT_MOUSE) | 38 #if defined(FEAT_MOUSE) |
39 static void find_start_of_word __ARGS((pos_T *)); | 39 static void find_start_of_word __ARGS((pos_T *)); |
40 static void find_end_of_word __ARGS((pos_T *)); | 40 static void find_end_of_word __ARGS((pos_T *)); |
41 static int get_mouse_class __ARGS((char_u *p)); | 41 static int get_mouse_class __ARGS((char_u *p)); |
42 #endif | 42 #endif |
43 static void prep_redo_visual __ARGS((cmdarg_T *cap)); | |
43 static void prep_redo_cmd __ARGS((cmdarg_T *cap)); | 44 static void prep_redo_cmd __ARGS((cmdarg_T *cap)); |
44 static void prep_redo __ARGS((int regname, long, int, int, int, int, int)); | 45 static void prep_redo __ARGS((int regname, long, int, int, int, int, int)); |
45 static int checkclearop __ARGS((oparg_T *oap)); | 46 static int checkclearop __ARGS((oparg_T *oap)); |
46 static int checkclearopq __ARGS((oparg_T *oap)); | 47 static int checkclearopq __ARGS((oparg_T *oap)); |
47 static void clearop __ARGS((oparg_T *oap)); | 48 static void clearop __ARGS((oparg_T *oap)); |
3611 | 3612 |
3612 return col; | 3613 return col; |
3613 } | 3614 } |
3614 | 3615 |
3615 /* | 3616 /* |
3617 * Add commands to reselect Visual mode into the redo buffer. | |
3618 */ | |
3619 static void | |
3620 prep_redo_visual(cap) | |
3621 cmdarg_T *cap; | |
3622 { | |
3623 ResetRedobuff(); | |
3624 AppendCharToRedobuff(VIsual_mode); | |
3625 if (VIsual_mode == 'V' && curbuf->b_visual.vi_end.lnum | |
3626 != curbuf->b_visual.vi_start.lnum) | |
3627 { | |
3628 AppendNumberToRedobuff(curbuf->b_visual.vi_end.lnum | |
3629 - curbuf->b_visual.vi_start.lnum); | |
3630 AppendCharToRedobuff('j'); | |
3631 } | |
3632 else if (VIsual_mode == 'v' || VIsual_mode == Ctrl_V) | |
3633 { | |
3634 /* block visual mode or char visual mmode*/ | |
3635 if (curbuf->b_visual.vi_end.lnum != curbuf->b_visual.vi_start.lnum) | |
3636 { | |
3637 AppendNumberToRedobuff(curbuf->b_visual.vi_end.lnum - | |
3638 curbuf->b_visual.vi_start.lnum); | |
3639 AppendCharToRedobuff('j'); | |
3640 } | |
3641 if (curbuf->b_visual.vi_curswant == MAXCOL) | |
3642 AppendCharToRedobuff('$'); | |
3643 else if (curbuf->b_visual.vi_end.col > curbuf->b_visual.vi_start.col) | |
3644 { | |
3645 AppendNumberToRedobuff(curbuf->b_visual.vi_end.col | |
3646 - curbuf->b_visual.vi_start.col - 1); | |
3647 AppendCharToRedobuff(' '); | |
3648 } | |
3649 } | |
3650 AppendNumberToRedobuff(cap->count1); | |
3651 } | |
3652 | |
3653 /* | |
3616 * Prepare for redo of a normal command. | 3654 * Prepare for redo of a normal command. |
3617 */ | 3655 */ |
3618 static void | 3656 static void |
3619 prep_redo_cmd(cap) | 3657 prep_redo_cmd(cap) |
3620 cmdarg_T *cap; | 3658 cmdarg_T *cap; |
4205 if (cap->oap->op_type == OP_NOP | 4243 if (cap->oap->op_type == OP_NOP |
4206 && do_addsub((int)cap->cmdchar, cap->count1, cap->arg) == OK) | 4244 && do_addsub((int)cap->cmdchar, cap->count1, cap->arg) == OK) |
4207 { | 4245 { |
4208 if (visual) | 4246 if (visual) |
4209 { | 4247 { |
4210 ResetRedobuff(); | 4248 prep_redo_visual(cap); |
4211 AppendCharToRedobuff(VIsual_mode); | 4249 if (cap->arg) |
4212 if (VIsual_mode == 'V') | 4250 AppendCharToRedobuff('g'); |
4213 { | |
4214 AppendNumberToRedobuff(cap->oap->line_count); | |
4215 AppendCharToRedobuff('j'); | |
4216 } | |
4217 AppendNumberToRedobuff(cap->count1); | |
4218 if (cap->nchar != NUL) | |
4219 AppendCharToRedobuff(cap->nchar); | |
4220 AppendCharToRedobuff(cap->cmdchar); | 4251 AppendCharToRedobuff(cap->cmdchar); |
4221 } | 4252 } |
4222 else | 4253 else |
4223 prep_redo_cmd(cap); | 4254 prep_redo_cmd(cap); |
4224 } | 4255 } |
4225 else | 4256 else |
4226 clearopbeep(cap->oap); | 4257 clearopbeep(cap->oap); |
4227 if (visual) | 4258 if (visual) |
4228 { | 4259 { |
4229 VIsual_active = FALSE; | 4260 VIsual_active = FALSE; |
4230 redraw_later(CLEAR); | 4261 redo_VIsual_busy = FALSE; |
4262 redraw_later(INVERTED); | |
4231 } | 4263 } |
4232 } | 4264 } |
4233 | 4265 |
4234 /* | 4266 /* |
4235 * CTRL-F, CTRL-B, etc: Scroll page up or down. | 4267 * CTRL-F, CTRL-B, etc: Scroll page up or down. |