From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20028 invoked by alias); 17 Mar 2011 10:18:25 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28899 Received: (qmail 13096 invoked from network); 17 Mar 2011 10:18:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at bewatermyfriend.org does not designate permitted sender hosts) From: Frank Terbeck To: Bart Schaefer Cc: zsh-workers@zsh.org Subject: Re: PATCH: edit-command-line: disable `monitor' option locally In-Reply-To: <110316210401.ZM25580@torch.brasslantern.com> (Bart Schaefer's message of "Wed, 16 Mar 2011 21:04:01 -0700") References: <1300306570-24592-1-git-send-email-ft@bewatermyfriend.org> <110316210401.ZM25580@torch.brasslantern.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Date: Thu, 17 Mar 2011 11:08:49 +0100 Message-ID: <87tyf2hxe6.fsf@ft.bewatermyfriend.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Df-Sender: 430444 Bart Schaefer wrote: > On Mar 16, 9:16pm, Frank Terbeck wrote: > } Subject: PATCH: edit-command-line: disable `monitor' option locally > } > } I was just told, that suspending an editor while using > } `edit-command-line' will cause the command line to be lost, yielding > } this: > } > } edit-command-line:zle:17: widgets can only be called when ZLE is active > } > } Which makes sense. > > Hmm. I don't have this problem. Hm. I had trouble reproducing this, too. So, I asked the guys for precise instructions and they came up with something I could reproduce as well. > If I suspend from edit-command-line I get brought back to the prompt > and the previous input is all still there. I can resume the editor > with "fg" (at which point vim gives me an error about the file no > longer existing); if I write, exit, and then repeat the > edit-command-line keystroke, I'm back in the editor looking at the > stuff I wrote out a minute before, and if I now exit again that stuff > is loaded onto the command line. Here is how to get the error: a) Start a new shell. The error seems to only appear the first time the `edit-command-line' widget is called. b) Enter something into the command line buffer. c) Strike your `edit-command-line' shortcut. d) "C-z" to suspend. e) Run another command while being suspended. f) "fg" to get the editor back. g) Exit the editor. This leads to the error I mentioned. Later attempts don't yield the error, but the command line buffer's content is *gone* every time. Which to me is quite a grave problem, as this may lead to rather huge multi-line commands to be gone. > } So, in order to shield users from accidential dataloss, this patch > } unsets the `monitor' option temporarily. That does the trick for me and > } I don't think there is anything this would break. > > On the other hand if I put in this patch, then when I try to resume the > backgrounded editor Um. How do you end up with a backgrounded editor with this patch? Shouldn't it be impossible to background the editor if `monitor' is unset? I can't seem to get that to happen on my linux-based laptop. > I end up in a *very* strange state where the shell is not responding > to anything, and I have to go off to another window and kill -CONT the > editor before I can proceed. In that case vim dies almost immediately > with "Vim: Error reading input, exiting..." > > } If I'm missing something, yell. > > I think perhaps this behaves very differently in different contexts. > Restartable system calls may be the difference, I don't know which > platform has the trouble that you described. This happens for me on various linux systems with different kernel versions. I may be able to try OpenBSD later today, unless someone beats me to it. In any case, I think the widget should protect the user from losing the command line. And disallowing the editor from backgrounding should do that (and in fact does for me). Regards, Frank -- In protocol design, perfection has been reached not when there is nothing left to add, but when there is nothing left to take away. -- RFC 1925