From bd6ed3b8c139c9ea11c3ca4defd9d64e558fbb77 Mon Sep 17 00:00:00 2001 From: wiz Date: Tue, 26 Aug 2003 08:52:03 +0000 Subject: [PATCH] From OpenBSD: revision 1.21 date: 2003/08/02 19:26:15; author: fgsch; state: Exp; lines: +4 -2 On ESC-y ESC-y (yank-pop), also check that there is something to insert (some text has been killed before). from otto@, fix bug report 3384. On yank-pop error (no yank before), reset the index to killstack so another yank-pop does not mangle the prompt if nothing was yanked, and to avoid replacing a text when it shouldn't (yank yank-pop yank-pop). otto@ ok. --- bin/ksh/emacs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/ksh/emacs.c b/bin/ksh/emacs.c index 3654d6da0948..592a282b294f 100644 --- a/bin/ksh/emacs.c +++ b/bin/ksh/emacs.c @@ -1,4 +1,4 @@ -/* $NetBSD: emacs.c,v 1.19 2003/08/26 08:40:51 wiz Exp $ */ +/* $NetBSD: emacs.c,v 1.20 2003/08/26 08:52:03 wiz Exp $ */ /* * Emacs-like command line editing and history @@ -10,7 +10,7 @@ #include #ifndef lint -__RCSID("$NetBSD: emacs.c,v 1.19 2003/08/26 08:40:51 wiz Exp $"); +__RCSID("$NetBSD: emacs.c,v 1.20 2003/08/26 08:52:03 wiz Exp $"); #endif @@ -1268,7 +1268,9 @@ x_meta_yank(c) int c; { int len; - if (x_last_command != XFUNC_yank && x_last_command != XFUNC_meta_yank) { + if ((x_last_command != XFUNC_yank && x_last_command != XFUNC_meta_yank) + || killstack[killtp] == 0) { + killtp = killsp; x_e_puts("\nyank something first"); x_redraw(-1); return KSTD;