comparison src/getchar.c @ 841:c2cae213194d v7.0e07

updated for version 7.0e07
author vimboss
date Sun, 23 Apr 2006 22:40:29 +0000
parents 2c885fab04e3
children a209672376fd
comparison
equal deleted inserted replaced
840:2c885fab04e3 841:c2cae213194d
1032 return OK; 1032 return OK;
1033 } 1033 }
1034 1034
1035 /* 1035 /*
1036 * Return TRUE if the typeahead buffer was changed (while waiting for a 1036 * Return TRUE if the typeahead buffer was changed (while waiting for a
1037 * character to arrive). Happens when a message was received from a client. 1037 * character to arrive). Happens when a message was received from a client or
1038 * from pushkeys().
1038 * But check in a more generic way to avoid trouble: When "typebuf.tb_buf" 1039 * But check in a more generic way to avoid trouble: When "typebuf.tb_buf"
1039 * changed it was reallocated and the old pointer can no longer be used. 1040 * changed it was reallocated and the old pointer can no longer be used.
1040 * Or "typebuf.tb_off" may have been changed and we would overwrite characters 1041 * Or "typebuf.tb_off" may have been changed and we would overwrite characters
1041 * that was just added. 1042 * that was just added.
1042 */ 1043 */
1043 int 1044 int
1044 typebuf_changed(tb_change_cnt) 1045 typebuf_changed(tb_change_cnt)
1045 int tb_change_cnt; /* old value of typebuf.tb_change_cnt */ 1046 int tb_change_cnt; /* old value of typebuf.tb_change_cnt */
1046 { 1047 {
1047 return (tb_change_cnt != 0 && (typebuf.tb_change_cnt != tb_change_cnt 1048 return (tb_change_cnt != 0 && (typebuf.tb_change_cnt != tb_change_cnt
1048 #ifdef FEAT_CLIENTSERVER 1049 #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL)
1049 || received_from_client 1050 || typebuf_was_filled
1050 #endif 1051 #endif
1051 )); 1052 ));
1052 } 1053 }
1053 1054
1054 /* 1055 /*
1140 typebuf.tb_no_abbr_cnt = offset; 1141 typebuf.tb_no_abbr_cnt = offset;
1141 else 1142 else
1142 typebuf.tb_no_abbr_cnt -= len; 1143 typebuf.tb_no_abbr_cnt -= len;
1143 } 1144 }
1144 1145
1145 #ifdef FEAT_CLIENTSERVER 1146 #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL)
1146 /* Reset the flag that text received from a client was inserted in the 1147 /* Reset the flag that text received from a client or from pushkeys()
1147 * typeahead buffer. */ 1148 * was inserted in the typeahead buffer. */
1148 received_from_client = FALSE; 1149 typebuf_was_filled = FALSE;
1149 #endif 1150 #endif
1150 if (++typebuf.tb_change_cnt == 0) 1151 if (++typebuf.tb_change_cnt == 0)
1151 typebuf.tb_change_cnt = 1; 1152 typebuf.tb_change_cnt = 1;
1152 } 1153 }
1153 1154
2915 2916
2916 #if defined(USE_INPUT_BUF) || defined(PROTO) 2917 #if defined(USE_INPUT_BUF) || defined(PROTO)
2917 /* 2918 /*
2918 * Return TRUE when bytes are in the input buffer or in the typeahead buffer. 2919 * Return TRUE when bytes are in the input buffer or in the typeahead buffer.
2919 * Normally the input buffer would be sufficient, but the server_to_input_buf() 2920 * Normally the input buffer would be sufficient, but the server_to_input_buf()
2920 * may insert characters in the typeahead buffer while we are waiting for 2921 * or pushkeys() may insert characters in the typeahead buffer while we are
2921 * input to arrive. 2922 * waiting for input to arrive.
2922 */ 2923 */
2923 int 2924 int
2924 input_available() 2925 input_available()
2925 { 2926 {
2926 return (!vim_is_input_buf_empty() 2927 return (!vim_is_input_buf_empty()
2927 # ifdef FEAT_CLIENTSERVER 2928 # if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL)
2928 || received_from_client 2929 || typebuf_was_filled
2929 # endif 2930 # endif
2930 ); 2931 );
2931 } 2932 }
2932 #endif 2933 #endif
2933 2934