Mercurial > vim
comparison src/edit.c @ 661:e93a99ef31d0
updated for version 7.0195
author | vimboss |
---|---|
date | Thu, 09 Feb 2006 23:53:20 +0000 |
parents | d6a69271cb9a |
children | 21ab9abf0f08 |
comparison
equal
deleted
inserted
replaced
660:13296f8d1d3d | 661:e93a99ef31d0 |
---|---|
147 #define BACKSPACE_CHAR 1 | 147 #define BACKSPACE_CHAR 1 |
148 #define BACKSPACE_WORD 2 | 148 #define BACKSPACE_WORD 2 |
149 #define BACKSPACE_WORD_NOT_SPACE 3 | 149 #define BACKSPACE_WORD_NOT_SPACE 3 |
150 #define BACKSPACE_LINE 4 | 150 #define BACKSPACE_LINE 4 |
151 | 151 |
152 static void ins_redraw __ARGS((void)); | 152 static void ins_redraw __ARGS((int ready)); |
153 static void ins_ctrl_v __ARGS((void)); | 153 static void ins_ctrl_v __ARGS((void)); |
154 static void undisplay_dollar __ARGS((void)); | 154 static void undisplay_dollar __ARGS((void)); |
155 static void insert_special __ARGS((int, int, int)); | 155 static void insert_special __ARGS((int, int, int)); |
156 static void check_auto_format __ARGS((int)); | 156 static void check_auto_format __ARGS((int)); |
157 static void redo_literal __ARGS((int c)); | 157 static void redo_literal __ARGS((int c)); |
648 | 648 |
649 /* | 649 /* |
650 * Redraw the display when no characters are waiting. | 650 * Redraw the display when no characters are waiting. |
651 * Also shows mode, ruler and positions cursor. | 651 * Also shows mode, ruler and positions cursor. |
652 */ | 652 */ |
653 ins_redraw(); | 653 ins_redraw(TRUE); |
654 | 654 |
655 #ifdef FEAT_SCROLLBIND | 655 #ifdef FEAT_SCROLLBIND |
656 if (curwin->w_p_scb) | 656 if (curwin->w_p_scb) |
657 do_check_scrollbind(TRUE); | 657 do_check_scrollbind(TRUE); |
658 #endif | 658 #endif |
730 * CTRL-\ CTRL-G goes to mode selected with 'insertmode', | 730 * CTRL-\ CTRL-G goes to mode selected with 'insertmode', |
731 * CTRL-\ CTRL-O is like CTRL-O but without moving the cursor. */ | 731 * CTRL-\ CTRL-O is like CTRL-O but without moving the cursor. */ |
732 if (c == Ctrl_BSL) | 732 if (c == Ctrl_BSL) |
733 { | 733 { |
734 /* may need to redraw when no more chars available now */ | 734 /* may need to redraw when no more chars available now */ |
735 ins_redraw(); | 735 ins_redraw(FALSE); |
736 ++no_mapping; | 736 ++no_mapping; |
737 ++allow_keys; | 737 ++allow_keys; |
738 c = safe_vgetc(); | 738 c = safe_vgetc(); |
739 --no_mapping; | 739 --no_mapping; |
740 --allow_keys; | 740 --allow_keys; |
1036 #endif | 1036 #endif |
1037 | 1037 |
1038 case K_IGNORE: /* Something mapped to nothing */ | 1038 case K_IGNORE: /* Something mapped to nothing */ |
1039 break; | 1039 break; |
1040 | 1040 |
1041 #ifdef FEAT_AUTOCMD | |
1042 case K_CURSORHOLD: /* Didn't type something for a while. */ | |
1043 apply_autocmds(EVENT_CURSORHOLDI, NULL, NULL, FALSE, curbuf); | |
1044 did_cursorhold = TRUE; | |
1045 break; | |
1046 #endif | |
1047 | |
1041 #ifdef FEAT_GUI_W32 | 1048 #ifdef FEAT_GUI_W32 |
1042 /* On Win32 ignore <M-F4>, we get it when closing the window was | 1049 /* On Win32 ignore <M-F4>, we get it when closing the window was |
1043 * cancelled. */ | 1050 * cancelled. */ |
1044 case K_F4: | 1051 case K_F4: |
1045 if (mod_mask != MOD_MASK_ALT) | 1052 if (mod_mask != MOD_MASK_ALT) |
1343 * This is postponed until getting the next character to make '$' in the 'cpo' | 1350 * This is postponed until getting the next character to make '$' in the 'cpo' |
1344 * option work correctly. | 1351 * option work correctly. |
1345 * Only redraw when there are no characters available. This speeds up | 1352 * Only redraw when there are no characters available. This speeds up |
1346 * inserting sequences of characters (e.g., for CTRL-R). | 1353 * inserting sequences of characters (e.g., for CTRL-R). |
1347 */ | 1354 */ |
1355 /*ARGSUSED*/ | |
1348 static void | 1356 static void |
1349 ins_redraw() | 1357 ins_redraw(ready) |
1358 int ready; /* not busy with something */ | |
1350 { | 1359 { |
1351 if (!char_avail()) | 1360 if (!char_avail()) |
1352 { | 1361 { |
1362 #ifdef FEAT_AUTOCMD | |
1363 /* Trigger CursorMoved if the cursor moved. */ | |
1364 if (ready && has_cursormovedI() | |
1365 && !equalpos(last_cursormoved, curwin->w_cursor)) | |
1366 { | |
1367 apply_autocmds(EVENT_CURSORMOVEDI, NULL, NULL, FALSE, curbuf); | |
1368 last_cursormoved = curwin->w_cursor; | |
1369 } | |
1370 #endif | |
1353 if (must_redraw) | 1371 if (must_redraw) |
1354 update_screen(0); | 1372 update_screen(0); |
1355 else if (clear_cmdline || redraw_cmdline) | 1373 else if (clear_cmdline || redraw_cmdline) |
1356 showmode(); /* clear cmdline and show mode */ | 1374 showmode(); /* clear cmdline and show mode */ |
1357 showruler(FALSE); | 1375 showruler(FALSE); |
1367 ins_ctrl_v() | 1385 ins_ctrl_v() |
1368 { | 1386 { |
1369 int c; | 1387 int c; |
1370 | 1388 |
1371 /* may need to redraw when no more chars available now */ | 1389 /* may need to redraw when no more chars available now */ |
1372 ins_redraw(); | 1390 ins_redraw(FALSE); |
1373 | 1391 |
1374 if (redrawing() && !char_avail()) | 1392 if (redrawing() && !char_avail()) |
1375 edit_putchar('^', TRUE); | 1393 edit_putchar('^', TRUE); |
1376 AppendToRedobuff((char_u *)CTRL_V_STR); /* CTRL-V */ | 1394 AppendToRedobuff((char_u *)CTRL_V_STR); /* CTRL-V */ |
1377 | 1395 |
6650 */ | 6668 */ |
6651 pc_status = PC_STATUS_UNSET; | 6669 pc_status = PC_STATUS_UNSET; |
6652 if (redrawing() && !char_avail()) | 6670 if (redrawing() && !char_avail()) |
6653 { | 6671 { |
6654 /* may need to redraw when no more chars available now */ | 6672 /* may need to redraw when no more chars available now */ |
6655 ins_redraw(); | 6673 ins_redraw(FALSE); |
6656 | 6674 |
6657 edit_putchar('"', TRUE); | 6675 edit_putchar('"', TRUE); |
6658 #ifdef FEAT_CMDL_INFO | 6676 #ifdef FEAT_CMDL_INFO |
6659 add_to_showcmd_c(Ctrl_R); | 6677 add_to_showcmd_c(Ctrl_R); |
6660 #endif | 6678 #endif |
8322 | 8340 |
8323 pc_status = PC_STATUS_UNSET; | 8341 pc_status = PC_STATUS_UNSET; |
8324 if (redrawing() && !char_avail()) | 8342 if (redrawing() && !char_avail()) |
8325 { | 8343 { |
8326 /* may need to redraw when no more chars available now */ | 8344 /* may need to redraw when no more chars available now */ |
8327 ins_redraw(); | 8345 ins_redraw(FALSE); |
8328 | 8346 |
8329 edit_putchar('?', TRUE); | 8347 edit_putchar('?', TRUE); |
8330 #ifdef FEAT_CMDL_INFO | 8348 #ifdef FEAT_CMDL_INFO |
8331 add_to_showcmd_c(Ctrl_K); | 8349 add_to_showcmd_c(Ctrl_K); |
8332 #endif | 8350 #endif |
8354 if (c != ESC) | 8372 if (c != ESC) |
8355 { | 8373 { |
8356 if (redrawing() && !char_avail()) | 8374 if (redrawing() && !char_avail()) |
8357 { | 8375 { |
8358 /* may need to redraw when no more chars available now */ | 8376 /* may need to redraw when no more chars available now */ |
8359 ins_redraw(); | 8377 ins_redraw(FALSE); |
8360 | 8378 |
8361 if (char2cells(c) == 1) | 8379 if (char2cells(c) == 1) |
8362 { | 8380 { |
8363 /* first remove the '?', otherwise it's restored when typing | 8381 /* first remove the '?', otherwise it's restored when typing |
8364 * an ESC next */ | 8382 * an ESC next */ |
8365 edit_unputchar(); | 8383 edit_unputchar(); |
8366 ins_redraw(); | 8384 ins_redraw(FALSE); |
8367 edit_putchar(c, TRUE); | 8385 edit_putchar(c, TRUE); |
8368 } | 8386 } |
8369 #ifdef FEAT_CMDL_INFO | 8387 #ifdef FEAT_CMDL_INFO |
8370 add_to_showcmd_c(c); | 8388 add_to_showcmd_c(c); |
8371 #endif | 8389 #endif |