comparison src/ex_docmd.c @ 36:125e80798a85 v7.0021

updated for version 7.0021
author vimboss
date Thu, 09 Dec 2004 21:34:53 +0000
parents f6033dcbaf31
children fdf55076c53f
comparison
equal deleted inserted replaced
35:8f3a526c2fe1 36:125e80798a85
7890 */ 7890 */
7891 static void 7891 static void
7892 ex_normal(eap) 7892 ex_normal(eap)
7893 exarg_T *eap; 7893 exarg_T *eap;
7894 { 7894 {
7895 oparg_T oa;
7896 int save_msg_scroll = msg_scroll; 7895 int save_msg_scroll = msg_scroll;
7897 int save_restart_edit = restart_edit; 7896 int save_restart_edit = restart_edit;
7898 int save_msg_didout = msg_didout; 7897 int save_msg_didout = msg_didout;
7899 int save_State = State; 7898 int save_State = State;
7900 tasave_T tabuf; 7899 tasave_T tabuf;
7994 * range given, execute it just once, without positioning the cursor 7993 * range given, execute it just once, without positioning the cursor
7995 * first. 7994 * first.
7996 */ 7995 */
7997 do 7996 do
7998 { 7997 {
7999 clear_oparg(&oa);
8000 finish_op = FALSE;
8001 if (eap->addr_count != 0) 7998 if (eap->addr_count != 0)
8002 { 7999 {
8003 curwin->w_cursor.lnum = eap->line1++; 8000 curwin->w_cursor.lnum = eap->line1++;
8004 curwin->w_cursor.col = 0; 8001 curwin->w_cursor.col = 0;
8005 } 8002 }
8006 8003
8007 /* 8004 exec_normal_cmd(
8008 * Stuff the argument into the typeahead buffer.
8009 * Execute normal_cmd() until there is no typeahead left.
8010 */
8011 ins_typebuf(
8012 #ifdef FEAT_MBYTE 8005 #ifdef FEAT_MBYTE
8013 arg != NULL ? arg : 8006 arg != NULL ? arg :
8014 #endif 8007 #endif
8015 eap->arg, eap->forceit ? REMAP_NONE : REMAP_YES, 0, 8008 eap->arg, eap->forceit ? REMAP_NONE : REMAP_YES, FALSE);
8016 TRUE, FALSE);
8017 while ((!stuff_empty() || (!typebuf_typed() && typebuf.tb_len > 0))
8018 && !got_int)
8019 {
8020 update_topline_cursor();
8021 normal_cmd(&oa, FALSE); /* execute a Normal mode cmd */
8022 }
8023 } 8009 }
8024 while (eap->addr_count > 0 && eap->line1 <= eap->line2 && !got_int); 8010 while (eap->addr_count > 0 && eap->line1 <= eap->line2 && !got_int);
8025 } 8011 }
8026 8012
8027 /* Might not return to the main loop when in an event handler. */ 8013 /* Might not return to the main loop when in an event handler. */
8080 ex_stopinsert(eap) 8066 ex_stopinsert(eap)
8081 exarg_T *eap; 8067 exarg_T *eap;
8082 { 8068 {
8083 restart_edit = 0; 8069 restart_edit = 0;
8084 stop_insert_mode = TRUE; 8070 stop_insert_mode = TRUE;
8071 }
8072 #endif
8073
8074 #if defined(FEAT_EX_EXTRA) || defined(FEAT_MENU) || defined(PROTO)
8075 /*
8076 * Execute normal mode command "cmd".
8077 * "remap" can be REMAP_NONE or REMAP_YES.
8078 */
8079 void
8080 exec_normal_cmd(cmd, remap, silent)
8081 char_u *cmd;
8082 int remap;
8083 int silent;
8084 {
8085 oparg_T oa;
8086
8087 /*
8088 * Stuff the argument into the typeahead buffer.
8089 * Execute normal_cmd() until there is no typeahead left.
8090 */
8091 clear_oparg(&oa);
8092 finish_op = FALSE;
8093 ins_typebuf(cmd, remap, 0, TRUE, silent);
8094 while ((!stuff_empty() || (!typebuf_typed() && typebuf.tb_len > 0))
8095 && !got_int)
8096 {
8097 update_topline_cursor();
8098 normal_cmd(&oa, FALSE); /* execute a Normal mode cmd */
8099 }
8085 } 8100 }
8086 #endif 8101 #endif
8087 8102
8088 #ifdef FEAT_FIND_ID 8103 #ifdef FEAT_FIND_ID
8089 static void 8104 static void
8740 return FAIL; 8755 return FAIL;
8741 vim_free(sname); 8756 vim_free(sname);
8742 } 8757 }
8743 8758
8744 /* 8759 /*
8760 * If there is an empty, unnamed buffer we will wipe it out later.
8761 * Remember the buffer number.
8762 */
8763 if (put_line(fd, "if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''") == FAIL)
8764 return FAIL;
8765 if (put_line(fd, " let s:wipebuf = bufnr('%')") == FAIL)
8766 return FAIL;
8767 if (put_line(fd, "endif") == FAIL)
8768 return FAIL;
8769
8770 /*
8745 * Now save the current files, current buffer first. 8771 * Now save the current files, current buffer first.
8746 */ 8772 */
8747 if (put_line(fd, "set shortmess=aoO") == FAIL) 8773 if (put_line(fd, "set shortmess=aoO") == FAIL)
8748 return FAIL; 8774 return FAIL;
8749 8775
8871 8897
8872 /* 8898 /*
8873 * Restore cursor to the current window if it's not the first one. 8899 * Restore cursor to the current window if it's not the first one.
8874 */ 8900 */
8875 if (cnr > 1 && (fprintf(fd, "%dwincmd w", cnr) < 0 || put_eol(fd) == FAIL)) 8901 if (cnr > 1 && (fprintf(fd, "%dwincmd w", cnr) < 0 || put_eol(fd) == FAIL))
8902 return FAIL;
8903
8904 /*
8905 * Wipe out an empty unnamed buffer we started in.
8906 */
8907 if (put_line(fd, "if exists('s:wipebuf')") == FAIL)
8908 return FAIL;
8909 if (put_line(fd, " exe 'bwipe ' . s:wipebuf") == FAIL)
8910 return FAIL;
8911 if (put_line(fd, "endif") == FAIL)
8912 return FAIL;
8913 if (put_line(fd, "unlet! s:wipebuf") == FAIL)
8876 return FAIL; 8914 return FAIL;
8877 8915
8878 /* 8916 /*
8879 * Restore window sizes again after jumping around in windows, because the 8917 * Restore window sizes again after jumping around in windows, because the
8880 * current window has a minimum size while others may not. 8918 * current window has a minimum size while others may not.