To: vim-dev@vim.org Subject: Patch 6.1.175 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.175 Problem: When reading commands from a pipe and a CTRL-C is pressed, Vim will hang. (Piet Delport) Solution: Don't keep reading characters to clear typeahead when an interrupt was detected, stop when a single CTRL-C is read. Files: src/getchar.c, src/ui.c *** ../vim61.174/src/getchar.c Sun Aug 18 21:27:29 2002 --- src/getchar.c Thu Sep 5 21:55:25 2002 *************** *** 2577,2582 **** --- 2577,2584 ---- /* * If we got an interrupt, skip all previously typed characters and * return TRUE if quit reading script file. + * Stop reading typeahead when a single CTRL-C was read, + * fill_input_buf() returns this when not able to read from stdin. * Don't use buf[] here, closescript() may have freed typebuf.tb_buf[] * and buf may be pointing inside typebuf.tb_buf[]. */ *************** *** 2585,2592 **** #define DUM_LEN MAXMAPLEN * 3 + 3 char_u dum[DUM_LEN + 1]; ! while (ui_inchar(dum, DUM_LEN, 0L) != 0) ! ; return retesc; } --- 2587,2598 ---- #define DUM_LEN MAXMAPLEN * 3 + 3 char_u dum[DUM_LEN + 1]; ! for (;;) ! { ! len = ui_inchar(dum, DUM_LEN, 0L); ! if (len == 0 || (len == 1 && dum[0] == 3)) ! break; ! } return retesc; } *** ../vim61.174/src/ui.c Sun Apr 28 22:00:14 2002 --- src/ui.c Thu Sep 5 21:50:47 2002 *************** *** 1708,1714 **** # endif if (len <= 0 && !got_int) read_error_exit(); ! did_read_something = TRUE; if (got_int) { inbuf[inbufcount] = 3; --- 1708,1715 ---- # endif if (len <= 0 && !got_int) read_error_exit(); ! if (len > 0) ! did_read_something = TRUE; if (got_int) { inbuf[inbufcount] = 3; *** ../vim61.174/src/version.c Sat Sep 7 22:20:49 2002 --- src/version.c Sat Sep 14 16:55:08 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 175, /**/ -- Why i like vim: > I like VIM because, when I ask a question in this newsgroup, I get a > one-line answer. With xemacs, I get a 1Kb lisp script with bugs in it ;-) /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///