FreeBSD Bugzilla – Attachment 10529 Details for
Bug 21089
[patch] vi(1) silently corrupts open file on SIGINT when entering :wq in command mode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
nvi-netbsd-v_txt.c-1.diff
nvi-netbsd-v_txt.c-1.diff (text/x-diff; charset=us-ascii), 2.85 KB, created by
Jaakko Heinonen
on 2008-02-21 13:23:34 UTC
(
hide
)
Description:
nvi-netbsd-v_txt.c-1.diff
Filename:
MIME Type:
Creator:
Jaakko Heinonen
Created:
2008-02-21 13:23:34 UTC
Size:
2.85 KB
patch
obsolete
>Obtained from: NetBSD > >date: 2005/09/06 21:30:36; author: aymeric; state: Exp; lines: +21 -10 >Finally handle ^C the correct way. This indeed requires to separate the case >of text-recording input (usually text in insert mode) from the other cases >(e.g. ex command input). If recording, morph to escape key so that the input >is correctly finished for a potential replay; if not, simply bail out and >notify that something wrong occurs. Callers will cope. >The previous fix could make ^C sometimes produce a file completion >or a command edition, depending on the settings of the user. >I think this is the correct fix for since closed PR bin/11544 by pooka@. ;-) >---------------------------- >date: 2001/04/30 21:34:12; author: aymeric; state: Exp; lines: +20 -13 >Now, ^C behaves just like <ESC> (but for the ``Interrupt'' message). >It is consistent with what Solaris' vi and vim do. >This addresses PR #11544 by pooka. > >Index: v_txt.c >=================================================================== >RCS file: /home/ncvs/src/contrib/nvi/vi/v_txt.c,v >retrieving revision 1.1.1.1 >diff -p -u -r1.1.1.1 v_txt.c >--- v_txt.c 1 Nov 1996 06:45:33 -0000 1.1.1.1 >+++ v_txt.c 18 Feb 2008 19:16:07 -0000 >@@ -510,15 +510,6 @@ next: if (v_event_get(sp, evp, 0, ec_fla > case E_EOF: > F_SET(sp, SC_EXIT_FORCE); > return (1); >- case E_INTERRUPT: >- /* >- * !!! >- * Historically, <interrupt> exited the user from text input >- * mode or cancelled a colon command, and returned to command >- * mode. It also beeped the terminal, but that seems a bit >- * excessive. >- */ >- goto k_escape; > case E_REPAINT: > if (vs_repaint(sp, &ev)) > return (1); >@@ -526,10 +517,37 @@ next: if (v_event_get(sp, evp, 0, ec_fla > case E_WRESIZE: > /* <resize> interrupts the input mode. */ > v_emsg(sp, NULL, VIM_WRESIZE); >- goto k_escape; >+ /* FALLTHROUGH */ > default: >- v_event_err(sp, evp); >- goto k_escape; >+ if (evp->e_event != E_INTERRUPT && evp->e_event != E_WRESIZE) >+ v_event_err(sp, evp); >+ /* >+ * !!! >+ * Historically, <interrupt> exited the user from text input >+ * mode or cancelled a colon command, and returned to command >+ * mode. It also beeped the terminal, but that seems a bit >+ * excessive. >+ */ >+ /* >+ * If we are recording, morph into <escape> key so that >+ * we can repeat the command safely: there is no way to >+ * invalidate the repetition of an instance of a command, >+ * which would be the alternative possibility. >+ * If we are not recording (most likely on the command line), >+ * simply discard the input and return to command mode >+ * so that an INTERRUPT doesn't become for example a file >+ * completion request. -aymeric >+ */ >+ if (LF_ISSET(TXT_RECORD)) { >+ evp->e_event = E_CHARACTER; >+ evp->e_c = 033; >+ evp->e_flags = 0; >+ evp->e_value = K_ESCAPE; >+ break; >+ } else { >+ tp->term = TERM_ESC; >+ goto k_escape; >+ } > } > > /*
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 21089
:
10526
|
10527
|
10528
| 10529 |
10530
|
10531
|
10532