comparison src/os_unix.c @ 15603:639b8318472c v8.1.0809

patch 8.1.0809: too many #ifdefs commit https://github.com/vim/vim/commit/a12a161b8ce09d024ed71c2134149fa323f8ee8e Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jan 24 16:39:02 2019 +0100 patch 8.1.0809: too many #ifdefs Problem: Too many #ifdefs. Solution: Graduate FEAT_MBYTE, part 3.
author Bram Moolenaar <Bram@vim.org>
date Thu, 24 Jan 2019 16:45:06 +0100
parents c9230ee2b1ad
children d4a6d575e910
comparison
equal deleted inserted replaced
15602:2ef2028868e2 15603:639b8318472c
2052 if (status && text_prop.value != NULL) 2052 if (status && text_prop.value != NULL)
2053 { 2053 {
2054 retval = TRUE; 2054 retval = TRUE;
2055 if (!test_only) 2055 if (!test_only)
2056 { 2056 {
2057 #if defined(FEAT_XFONTSET) || defined(FEAT_MBYTE) 2057 if (text_prop.encoding == XA_STRING && !has_mbyte)
2058 if (text_prop.encoding == XA_STRING
2059 # ifdef FEAT_MBYTE
2060 && !has_mbyte
2061 # endif
2062 )
2063 { 2058 {
2064 #endif
2065 if (get_title) 2059 if (get_title)
2066 oldtitle = vim_strsave((char_u *)text_prop.value); 2060 oldtitle = vim_strsave((char_u *)text_prop.value);
2067 else 2061 else
2068 oldicon = vim_strsave((char_u *)text_prop.value); 2062 oldicon = vim_strsave((char_u *)text_prop.value);
2069 #if defined(FEAT_XFONTSET) || defined(FEAT_MBYTE)
2070 } 2063 }
2071 else 2064 else
2072 { 2065 {
2073 char **cl; 2066 char **cl;
2074 Status transform_status; 2067 Status transform_status;
2091 oldtitle = vim_strsave((char_u *)text_prop.value); 2084 oldtitle = vim_strsave((char_u *)text_prop.value);
2092 else 2085 else
2093 oldicon = vim_strsave((char_u *)text_prop.value); 2086 oldicon = vim_strsave((char_u *)text_prop.value);
2094 } 2087 }
2095 } 2088 }
2096 #endif
2097 } 2089 }
2098 XFree((void *)text_prop.value); 2090 XFree((void *)text_prop.value);
2099 } 2091 }
2100 } 2092 }
2101 return retval; 2093 return retval;
2103 2095
2104 /* Xutf8 functions are not available on older systems. Note that on some 2096 /* Xutf8 functions are not available on older systems. Note that on some
2105 * systems X_HAVE_UTF8_STRING may be defined in a header file but 2097 * systems X_HAVE_UTF8_STRING may be defined in a header file but
2106 * Xutf8SetWMProperties() is not in the X11 library. Configure checks for 2098 * Xutf8SetWMProperties() is not in the X11 library. Configure checks for
2107 * that and defines HAVE_XUTF8SETWMPROPERTIES. */ 2099 * that and defines HAVE_XUTF8SETWMPROPERTIES. */
2108 #if defined(X_HAVE_UTF8_STRING) && defined(FEAT_MBYTE) 2100 #if defined(X_HAVE_UTF8_STRING)
2109 # if X_HAVE_UTF8_STRING && HAVE_XUTF8SETWMPROPERTIES 2101 # if X_HAVE_UTF8_STRING && HAVE_XUTF8SETWMPROPERTIES
2110 # define USE_UTF8_STRING 2102 # define USE_UTF8_STRING
2111 # endif 2103 # endif
2112 #endif 2104 #endif
2113 2105
4821 # endif 4813 # endif
4822 ) 4814 )
4823 { 4815 {
4824 # define BUFLEN 100 /* length for buffer, pseudo tty limit is 128 */ 4816 # define BUFLEN 100 /* length for buffer, pseudo tty limit is 128 */
4825 char_u buffer[BUFLEN + 1]; 4817 char_u buffer[BUFLEN + 1];
4826 # ifdef FEAT_MBYTE
4827 int buffer_off = 0; /* valid bytes in buffer[] */ 4818 int buffer_off = 0; /* valid bytes in buffer[] */
4828 # endif
4829 char_u ta_buf[BUFLEN + 1]; /* TypeAHead */ 4819 char_u ta_buf[BUFLEN + 1]; /* TypeAHead */
4830 int ta_len = 0; /* valid bytes in ta_buf[] */ 4820 int ta_len = 0; /* valid bytes in ta_buf[] */
4831 int len; 4821 int len;
4832 int p_more_save; 4822 int p_more_save;
4833 int old_State; 4823 int old_State;
5029 len -= 2; 5019 len -= 2;
5030 } 5020 }
5031 } 5021 }
5032 else if (ta_buf[i] == '\r') 5022 else if (ta_buf[i] == '\r')
5033 ta_buf[i] = '\n'; 5023 ta_buf[i] = '\n';
5034 # ifdef FEAT_MBYTE
5035 if (has_mbyte) 5024 if (has_mbyte)
5036 i += (*mb_ptr2len_len)(ta_buf + i, 5025 i += (*mb_ptr2len_len)(ta_buf + i,
5037 ta_len + len - i) - 1; 5026 ta_len + len - i) - 1;
5038 # endif
5039 } 5027 }
5040 5028
5041 /* 5029 /*
5042 * For pipes: echo the typed characters. 5030 * For pipes: echo the typed characters.
5043 * For a pty this does not seem to work. 5031 * For a pty this does not seem to work.
5046 { 5034 {
5047 for (i = ta_len; i < ta_len + len; ++i) 5035 for (i = ta_len; i < ta_len + len; ++i)
5048 { 5036 {
5049 if (ta_buf[i] == '\n' || ta_buf[i] == '\b') 5037 if (ta_buf[i] == '\n' || ta_buf[i] == '\b')
5050 msg_putchar(ta_buf[i]); 5038 msg_putchar(ta_buf[i]);
5051 # ifdef FEAT_MBYTE
5052 else if (has_mbyte) 5039 else if (has_mbyte)
5053 { 5040 {
5054 int l = (*mb_ptr2len)(ta_buf + i); 5041 int l = (*mb_ptr2len)(ta_buf + i);
5055 5042
5056 msg_outtrans_len(ta_buf + i, l); 5043 msg_outtrans_len(ta_buf + i, l);
5057 i += l - 1; 5044 i += l - 1;
5058 } 5045 }
5059 # endif
5060 else 5046 else
5061 msg_outtrans_len(ta_buf + i, 1); 5047 msg_outtrans_len(ta_buf + i, 1);
5062 } 5048 }
5063 windgoto(msg_row, msg_col); 5049 windgoto(msg_row, msg_col);
5064 out_flush(); 5050 out_flush();
5112 */ 5098 */
5113 ++noread_cnt; 5099 ++noread_cnt;
5114 while (RealWaitForChar(fromshell_fd, 10L, NULL, NULL)) 5100 while (RealWaitForChar(fromshell_fd, 10L, NULL, NULL))
5115 { 5101 {
5116 len = read_eintr(fromshell_fd, buffer 5102 len = read_eintr(fromshell_fd, buffer
5117 # ifdef FEAT_MBYTE
5118 + buffer_off, (size_t)(BUFLEN - buffer_off) 5103 + buffer_off, (size_t)(BUFLEN - buffer_off)
5119 # else
5120 , (size_t)BUFLEN
5121 # endif
5122 ); 5104 );
5123 if (len <= 0) /* end of file or error */ 5105 if (len <= 0) /* end of file or error */
5124 goto finished; 5106 goto finished;
5125 5107
5126 noread_cnt = 0; 5108 noread_cnt = 0;
5136 ga_append(&ga, NL); 5118 ga_append(&ga, NL);
5137 else 5119 else
5138 ga_append(&ga, buffer[i]); 5120 ga_append(&ga, buffer[i]);
5139 } 5121 }
5140 } 5122 }
5141 # ifdef FEAT_MBYTE
5142 else if (has_mbyte) 5123 else if (has_mbyte)
5143 { 5124 {
5144 int l; 5125 int l;
5145 char_u *p; 5126 char_u *p;
5146 5127
5179 mch_memmove(buffer, p, buffer_off); 5160 mch_memmove(buffer, p, buffer_off);
5180 continue; 5161 continue;
5181 } 5162 }
5182 buffer_off = 0; 5163 buffer_off = 0;
5183 } 5164 }
5184 # endif /* FEAT_MBYTE */
5185 else 5165 else
5186 { 5166 {
5187 buffer[len] = NUL; 5167 buffer[len] = NUL;
5188 msg_puts((char *)buffer); 5168 msg_puts((char *)buffer);
5189 } 5169 }