To: vim-dev@vim.org Subject: Patch 6.0.145 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.145 Problem: When Vim can't read any input it might get stuck. When redirecting stdin and stderr Vim would not read commands from a file. (Servatius Brandt) Solution: When repeatedly trying to read a character when it's not possible, exit Vim. When stdin and stderr are not a tty, still try reading from them, but don't do a blocking wait. Files: src/ui.c *** ../vim60.144/src/ui.c Tue Jan 15 19:50:54 2002 --- src/ui.c Tue Jan 22 13:19:26 2002 *************** *** 134,142 **** #ifdef NO_CONSOLE_INPUT /* Don't wait for character input when the window hasn't been opened yet. ! * Must return something, otherwise we'll loop forever. */ if (no_console_input()) { buf[0] = CR; return 1; } --- 134,151 ---- #ifdef NO_CONSOLE_INPUT /* Don't wait for character input when the window hasn't been opened yet. ! * Do try reading, this works when redirecting stdin from a file. ! * Must return something, otherwise we'll loop forever. If we run into ! * this very often we probably got stuck, exit Vim. */ if (no_console_input()) { + static int count = 0; + + retval = mch_inchar(buf, maxlen, 10L); + if (retval > 0) + return retval; + if (wtime == -1 && ++count == 1000) + read_error_exit(); buf[0] = CR; return 1; } *** ../vim60.144/src/version.c Mon Jan 21 12:52:54 2002 --- src/version.c Tue Jan 22 13:21:08 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 145, /**/ -- Despite the cost of living, have you noticed how it remains so popular? /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///