comparison src/normal.c @ 30467:072c61082148 v9.0.0569

patch 9.0.0569: cannot easily get out when using "vim file | grep word" Commit: https://github.com/vim/vim/commit/5939c357431f8e43853ad80b03303167f39763df Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 24 12:50:45 2022 +0100 patch 9.0.0569: cannot easily get out when using "vim file | grep word" Problem: Cannot easily get out when using "vim file | grep word". Solution: Without changes let CTRL-C exit Vim. Otherwise give a message on stderr. (closes #11209)
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Sep 2022 14:00:04 +0200
parents 914b3c64ab92
children 584231b9b37e
comparison
equal deleted inserted replaced
30466:adb1bc2b3cb6 30467:072c61082148
6791 && cmdwin_type == 0 6791 && cmdwin_type == 0
6792 #endif 6792 #endif
6793 && !VIsual_active 6793 && !VIsual_active
6794 && no_reason) 6794 && no_reason)
6795 { 6795 {
6796 int out_redir = !stdout_isatty
6797 #ifdef FEAT_GUI
6798 && !gui.in_use
6799 #endif
6800 ;
6801 // The user may accidentally do "vim file | grep word" and then
6802 // CTRL-C doesn't show anything. With a changed buffer give the
6803 // message on stderr. Without any changes might as well exit.
6796 if (anyBufIsChanged()) 6804 if (anyBufIsChanged())
6797 msg(_("Type :qa! and press <Enter> to abandon all changes and exit Vim")); 6805 {
6806 char *ms = _("Type :qa! and press <Enter> to abandon all changes and exit Vim");
6807
6808 if (out_redir)
6809 mch_errmsg(ms);
6810 else
6811 msg(ms);
6812 }
6798 else 6813 else
6799 msg(_("Type :qa and press <Enter> to exit Vim")); 6814 {
6815 if (out_redir)
6816 {
6817 got_int = FALSE;
6818 do_cmdline_cmd((char_u *)"qa");
6819 }
6820 else
6821 msg(_("Type :qa and press <Enter> to exit Vim"));
6822 }
6800 } 6823 }
6801 6824
6802 if (restart_edit != 0) 6825 if (restart_edit != 0)
6803 redraw_mode = TRUE; // remove "-- (insert) --" 6826 redraw_mode = TRUE; // remove "-- (insert) --"
6804 6827