From f510c10ff3c0222621582d700e5b02e6d97ea22d Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 5 Jul 2013 20:41:55 +0200 Subject: only allow command-line replacements when actually editing the replacement register I felt the urge to implement that after accidentally rubbing out my entire commandline (the work of an hour) just by pressing "}"... --- src/parser.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/parser.cpp') diff --git a/src/parser.cpp b/src/parser.cpp index 66880e3..4572f02 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -908,6 +908,10 @@ StateStart::custom(gchar chr) throw (Error, ReplaceCmdline) * up to the first changed character and inserts * all characters following from the updated command * line into the command stream. + * To prevent the undesired rubout of the entire + * command-line, the replacement command ("}") is only + * allowed when the replacement register currently edited + * since it will otherwise be usually empty. * * .B Note: * - Command line editing only works on command lines, @@ -964,6 +968,9 @@ StateStart::custom(gchar chr) throw (Error, ReplaceCmdline) if (!undo.enabled) throw Error("Command-line editing only possible in " "interactive mode"); + if (QRegisters::current != QRegisters::globals["\x1B"]) + throw Error("Command-line replacement only allowed when " + "editing the replacement register"); /* replace cmdline in the outer macro environment */ throw ReplaceCmdline(); -- cgit v1.2.3