comparison src/normal.c @ 819:23f82b5d2814 v7.0c10

updated for version 7.0c10
author vimboss
date Wed, 05 Apr 2006 20:41:53 +0000
parents 6897668c467f
children 57c7403f6599
comparison
equal deleted inserted replaced
818:1f929f3ca806 819:23f82b5d2814
380 {K_X1RELEASE, nv_mouse, 0, 0}, 380 {K_X1RELEASE, nv_mouse, 0, 0},
381 {K_X2MOUSE, nv_mouse, 0, 0}, 381 {K_X2MOUSE, nv_mouse, 0, 0},
382 {K_X2DRAG, nv_mouse, 0, 0}, 382 {K_X2DRAG, nv_mouse, 0, 0},
383 {K_X2RELEASE, nv_mouse, 0, 0}, 383 {K_X2RELEASE, nv_mouse, 0, 0},
384 #endif 384 #endif
385 {K_IGNORE, nv_ignore, 0, 0}, 385 {K_IGNORE, nv_ignore, NV_KEEPREG, 0},
386 {K_NOP, nv_nop, 0, 0}, 386 {K_NOP, nv_nop, 0, 0},
387 {K_INS, nv_edit, 0, 0}, 387 {K_INS, nv_edit, 0, 0},
388 {K_KINS, nv_edit, 0, 0}, 388 {K_KINS, nv_edit, 0, 0},
389 {K_BS, nv_ctrlh, 0, 0}, 389 {K_BS, nv_ctrlh, 0, 0},
390 {K_UP, nv_up, NV_SSS|NV_STS, FALSE}, 390 {K_UP, nv_up, NV_SSS|NV_STS, FALSE},
438 #endif 438 #endif
439 #ifdef FEAT_DND 439 #ifdef FEAT_DND
440 {K_DROP, nv_drop, NV_STS, 0}, 440 {K_DROP, nv_drop, NV_STS, 0},
441 #endif 441 #endif
442 #ifdef FEAT_AUTOCMD 442 #ifdef FEAT_AUTOCMD
443 {K_CURSORHOLD, nv_cursorhold, 0, 0}, 443 {K_CURSORHOLD, nv_cursorhold, NV_KEEPREG, 0},
444 #endif 444 #endif
445 }; 445 };
446 446
447 /* Number of commands in nv_cmds[]. */ 447 /* Number of commands in nv_cmds[]. */
448 #define NV_CMDS_SIZE (sizeof(nv_cmds) / sizeof(struct nv_cmd)) 448 #define NV_CMDS_SIZE (sizeof(nv_cmds) / sizeof(struct nv_cmd))
570 int need_flushbuf; /* need to call out_flush() */ 570 int need_flushbuf; /* need to call out_flush() */
571 #endif 571 #endif
572 #ifdef FEAT_VISUAL 572 #ifdef FEAT_VISUAL
573 pos_T old_pos; /* cursor position before command */ 573 pos_T old_pos; /* cursor position before command */
574 int mapped_len; 574 int mapped_len;
575 #endif
576 static int old_mapped_len = 0; 575 static int old_mapped_len = 0;
576 #endif
577 int idx; 577 int idx;
578 578
579 vim_memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */ 579 vim_memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */
580 ca.oap = oap; 580 ca.oap = oap;
581 ca.opcount = opcount; 581 ca.opcount = opcount;
622 622
623 #ifdef FEAT_LANGMAP 623 #ifdef FEAT_LANGMAP
624 LANGMAP_ADJUST(c, TRUE); 624 LANGMAP_ADJUST(c, TRUE);
625 #endif 625 #endif
626 626
627 #ifdef FEAT_VISUAL
627 /* 628 /*
628 * If a mapping was started in Visual or Select mode, remember the length 629 * If a mapping was started in Visual or Select mode, remember the length
629 * of the mapping. This is used below to not return to Insert mode for as 630 * of the mapping. This is used below to not return to Insert mode for as
630 * long as the mapping is being executed. 631 * long as the mapping is being executed.
631 */ 632 */
632 if (restart_edit == 0) 633 if (restart_edit == 0)
633 old_mapped_len = 0; 634 old_mapped_len = 0;
634 else if (old_mapped_len 635 else if (old_mapped_len
635 #ifdef FEAT_VISUAL 636 || (VIsual_active && mapped_len == 0 && typebuf_maplen() > 0))
636 || (VIsual_active && mapped_len == 0 && typebuf_maplen() > 0)
637 #endif
638 )
639 old_mapped_len = typebuf_maplen(); 637 old_mapped_len = typebuf_maplen();
638 #endif
640 639
641 if (c == NUL) 640 if (c == NUL)
642 c = K_ZERO; 641 c = K_ZERO;
643 642
644 #ifdef FEAT_VISUAL 643 #ifdef FEAT_VISUAL
803 /* This command is not allowed wile editing a ccmdline: beep. */ 802 /* This command is not allowed wile editing a ccmdline: beep. */
804 clearopbeep(oap); 803 clearopbeep(oap);
805 text_locked_msg(); 804 text_locked_msg();
806 goto normal_end; 805 goto normal_end;
807 } 806 }
807 #ifdef FEAT_AUTOCMD
808 if ((nv_cmds[idx].cmd_flags & NV_NCW) && curbuf_locked())
809 goto normal_end;
810 #endif
808 811
809 #ifdef FEAT_VISUAL 812 #ifdef FEAT_VISUAL
810 /* 813 /*
811 * In Visual/Select mode, a few keys are handled in a special way. 814 * In Visual/Select mode, a few keys are handled in a special way.
812 */ 815 */
1149 #ifdef FEAT_EVAL 1152 #ifdef FEAT_EVAL
1150 set_reg_var('"'); 1153 set_reg_var('"');
1151 #endif 1154 #endif
1152 } 1155 }
1153 1156
1157 #ifdef FEAT_VISUAL
1154 /* Get the length of mapped chars again after typing a count, second 1158 /* Get the length of mapped chars again after typing a count, second
1155 * character or "z333<cr>". */ 1159 * character or "z333<cr>". */
1156 if (old_mapped_len > 0) 1160 if (old_mapped_len > 0)
1157 old_mapped_len = typebuf_maplen(); 1161 old_mapped_len = typebuf_maplen();
1162 #endif
1158 1163
1159 /* 1164 /*
1160 * If an operation is pending, handle it... 1165 * If an operation is pending, handle it...
1161 */ 1166 */
1162 do_pending_operator(&ca, old_col, FALSE); 1167 do_pending_operator(&ca, old_col, FALSE);
1286 */ 1291 */
1287 if ( oap->op_type == OP_NOP 1292 if ( oap->op_type == OP_NOP
1288 #ifdef FEAT_VISUAL 1293 #ifdef FEAT_VISUAL
1289 && ((restart_edit != 0 && !VIsual_active && old_mapped_len == 0) 1294 && ((restart_edit != 0 && !VIsual_active && old_mapped_len == 0)
1290 || restart_VIsual_select == 1) 1295 || restart_VIsual_select == 1)
1296 #else
1297 && restart_edit != 0
1291 #endif 1298 #endif
1292 && !(ca.retval & CA_COMMAND_BUSY) 1299 && !(ca.retval & CA_COMMAND_BUSY)
1293 && stuff_empty() 1300 && stuff_empty()
1294 && oap->regname == 0) 1301 && oap->regname == 0)
1295 { 1302 {
1301 restart_VIsual_select = 0; 1308 restart_VIsual_select = 0;
1302 } 1309 }
1303 #endif 1310 #endif
1304 if (restart_edit != 0 1311 if (restart_edit != 0
1305 #ifdef FEAT_VISUAL 1312 #ifdef FEAT_VISUAL
1306 && !VIsual_active 1313 && !VIsual_active && old_mapped_len == 0
1307 #endif 1314 #endif
1308 && old_mapped_len == 0) 1315 )
1309 (void)edit(restart_edit, FALSE, 1L); 1316 (void)edit(restart_edit, FALSE, 1L);
1310 } 1317 }
1311 1318
1312 #ifdef FEAT_VISUAL 1319 #ifdef FEAT_VISUAL
1313 if (restart_VIsual_select == 2) 1320 if (restart_VIsual_select == 2)
4063 static void 4070 static void
4064 nv_page(cap) 4071 nv_page(cap)
4065 cmdarg_T *cap; 4072 cmdarg_T *cap;
4066 { 4073 {
4067 if (!checkclearop(cap->oap)) 4074 if (!checkclearop(cap->oap))
4075 {
4076 #ifdef FEAT_WINDOWS
4077 if (mod_mask & MOD_MASK_CTRL)
4078 {
4079 /* <C-PageUp>: tab page back; <C-PageDown>: tab page forward */
4080 if (cap->arg == BACKWARD)
4081 goto_tabpage(-(int)cap->count1);
4082 else
4083 goto_tabpage((int)cap->count0);
4084 }
4085 else
4086 #endif
4068 (void)onepage(cap->arg, cap->count1); 4087 (void)onepage(cap->arg, cap->count1);
4088 }
4069 } 4089 }
4070 4090
4071 /* 4091 /*
4072 * Implementation of "gd" and "gD" command. 4092 * Implementation of "gd" and "gD" command.
4073 */ 4093 */
5912 { 5932 {
5913 clearopbeep(cap->oap); 5933 clearopbeep(cap->oap);
5914 text_locked_msg(); 5934 text_locked_msg();
5915 return; 5935 return;
5916 } 5936 }
5937 #ifdef FEAT_AUTOCMD
5938 if (curbuf_locked())
5939 {
5940 clearop(cap->oap);
5941 return;
5942 }
5943 #endif
5917 5944
5918 ptr = grab_file_name(cap->count1, &lnum); 5945 ptr = grab_file_name(cap->count1, &lnum);
5919 5946
5920 if (ptr != NULL) 5947 if (ptr != NULL)
5921 { 5948 {
6422 cap->nchar == 's' ? TRUE : FALSE, FALSE, NULL) == 0) 6449 cap->nchar == 's' ? TRUE : FALSE, FALSE, NULL) == 0)
6423 { 6450 {
6424 clearopbeep(cap->oap); 6451 clearopbeep(cap->oap);
6425 break; 6452 break;
6426 } 6453 }
6454 # ifdef FEAT_FOLDING
6455 if (cap->oap->op_type == OP_NOP && (fdo_flags & FDO_SEARCH) && KeyTyped)
6456 foldOpenCursor();
6457 # endif
6427 } 6458 }
6428 #endif 6459 #endif
6429 6460
6430 /* Not a valid cap->nchar. */ 6461 /* Not a valid cap->nchar. */
6431 else 6462 else