comparison src/os_unix.c @ 32619:76b147a4ea40 v9.0.1641

patch 9.0.1641: the log file does not give information about window sizes Commit: https://github.com/vim/vim/commit/55f1b822d8516a5afa42c9e5ac980f2395c70ad0 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jun 21 13:42:48 2023 +0100 patch 9.0.1641: the log file does not give information about window sizes Problem: The log file does not give information about window sizes. Solution: Add a few log messages about obtaining the window size.
author Bram Moolenaar <Bram@vim.org>
date Wed, 21 Jun 2023 14:45:07 +0200
parents a1e1527d1cb8
children ed7d5e3bdb00
comparison
equal deleted inserted replaced
32618:bb5377777679 32619:76b147a4ea40
442 resize_func(int check_only) 442 resize_func(int check_only)
443 { 443 {
444 if (check_only) 444 if (check_only)
445 return do_resize; 445 return do_resize;
446 while (do_resize) 446 while (do_resize)
447 {
448 ch_log(NULL, "calling handle_resize() in resize_func()");
447 handle_resize(); 449 handle_resize();
450 }
448 return FALSE; 451 return FALSE;
449 } 452 }
450 453
451 /* 454 /*
452 * mch_inchar(): low level input function. 455 * mch_inchar(): low level input function.
4164 fd = read_cmd_fd; 4167 fd = read_cmd_fd;
4165 if (ioctl(fd, TIOCGWINSZ, &ws) == 0) 4168 if (ioctl(fd, TIOCGWINSZ, &ws) == 0)
4166 { 4169 {
4167 columns = ws.ws_col; 4170 columns = ws.ws_col;
4168 rows = ws.ws_row; 4171 rows = ws.ws_row;
4172 ch_log(NULL, "Got size with TIOCGWINSZ: %ld x %ld", columns, rows);
4169 } 4173 }
4170 } 4174 }
4171 # else // TIOCGWINSZ 4175 # else // TIOCGWINSZ
4172 # ifdef TIOCGSIZE 4176 # ifdef TIOCGSIZE
4173 { 4177 {
4179 fd = read_cmd_fd; 4183 fd = read_cmd_fd;
4180 if (ioctl(fd, TIOCGSIZE, &ts) == 0) 4184 if (ioctl(fd, TIOCGSIZE, &ts) == 0)
4181 { 4185 {
4182 columns = ts.ts_cols; 4186 columns = ts.ts_cols;
4183 rows = ts.ts_lines; 4187 rows = ts.ts_lines;
4188 ch_log(NULL, "Got size with TIOCGSIZE: %ld x %ld", columns, rows);
4184 } 4189 }
4185 } 4190 }
4186 # endif // TIOCGSIZE 4191 # endif // TIOCGSIZE
4187 # endif // TIOCGWINSZ 4192 # endif // TIOCGWINSZ
4188 4193
4192 * the ioctl() values! 4197 * the ioctl() values!
4193 */ 4198 */
4194 if (columns == 0 || rows == 0 || vim_strchr(p_cpo, CPO_TSIZE) != NULL) 4199 if (columns == 0 || rows == 0 || vim_strchr(p_cpo, CPO_TSIZE) != NULL)
4195 { 4200 {
4196 if ((p = (char_u *)getenv("LINES"))) 4201 if ((p = (char_u *)getenv("LINES")))
4202 {
4197 rows = atoi((char *)p); 4203 rows = atoi((char *)p);
4204 ch_log(NULL, "Got 'lines' from $LINES: %ld", rows);
4205 }
4198 if ((p = (char_u *)getenv("COLUMNS"))) 4206 if ((p = (char_u *)getenv("COLUMNS")))
4207 {
4199 columns = atoi((char *)p); 4208 columns = atoi((char *)p);
4209 ch_log(NULL, "Got 'columns' from $COLUMNS: %ld", columns);
4210 }
4200 } 4211 }
4201 4212
4202 #ifdef HAVE_TGETENT 4213 #ifdef HAVE_TGETENT
4203 /* 4214 /*
4204 * 3. try reading "co" and "li" entries from termcap 4215 * 3. try reading "co" and "li" entries from termcap
4205 */ 4216 */
4206 if (columns == 0 || rows == 0) 4217 if (columns == 0 || rows == 0)
4218 {
4207 getlinecol(&columns, &rows); 4219 getlinecol(&columns, &rows);
4220 ch_log(NULL, "Got size from termcap: %ld x %ld", columns, rows);
4221 }
4208 #endif 4222 #endif
4209 4223
4210 /* 4224 /*
4211 * 4. If everything fails, use the old values 4225 * 4. If everything fails, use the old values
4212 */ 4226 */
4239 ws.ws_col = cols; 4253 ws.ws_col = cols;
4240 ws.ws_row = rows; 4254 ws.ws_row = rows;
4241 ws.ws_xpixel = cols * 5; 4255 ws.ws_xpixel = cols * 5;
4242 ws.ws_ypixel = rows * 10; 4256 ws.ws_ypixel = rows * 10;
4243 retval = ioctl(tty_fd, TIOCSWINSZ, &ws); 4257 retval = ioctl(tty_fd, TIOCSWINSZ, &ws);
4244 ch_log(NULL, "ioctl(TIOCSWINSZ) %s", 4258 ch_log(NULL, "ioctl(TIOCSWINSZ) %s", retval == 0 ? "success" : "failed");
4245 retval == 0 ? "success" : "failed");
4246 # elif defined(TIOCSSIZE) 4259 # elif defined(TIOCSSIZE)
4247 struct ttysize ts; 4260 struct ttysize ts;
4248 4261
4249 ts.ts_cols = cols; 4262 ts.ts_cols = cols;
4250 ts.ts_lines = rows; 4263 ts.ts_lines = rows;
4251 retval = ioctl(tty_fd, TIOCSSIZE, &ts); 4264 retval = ioctl(tty_fd, TIOCSSIZE, &ts);
4252 ch_log(NULL, "ioctl(TIOCSSIZE) %s", 4265 ch_log(NULL, "ioctl(TIOCSSIZE) %s", retval == 0 ? "success" : "failed");
4253 retval == 0 ? "success" : "failed");
4254 # endif 4266 # endif
4255 if (tty_fd != fd) 4267 if (tty_fd != fd)
4256 close(tty_fd); 4268 close(tty_fd);
4257 return retval == 0 ? OK : FAIL; 4269 return retval == 0 ? OK : FAIL;
4258 } 4270 }
6504 } 6516 }
6505 6517
6506 // Check whether window has been resized, EINTR may be caused by 6518 // Check whether window has been resized, EINTR may be caused by
6507 // SIGWINCH. 6519 // SIGWINCH.
6508 if (do_resize) 6520 if (do_resize)
6521 {
6522 ch_log(NULL, "calling handle_resize() in RealWaitForChar()");
6509 handle_resize(); 6523 handle_resize();
6524 }
6510 6525
6511 // Interrupted by a signal, need to try again. We ignore msec 6526 // Interrupted by a signal, need to try again. We ignore msec
6512 // here, because we do want to check even after a timeout if 6527 // here, because we do want to check even after a timeout if
6513 // characters are available. Needed for reading output of an 6528 // characters are available. Needed for reading output of an
6514 // external command after the process has finished. 6529 // external command after the process has finished.