From 3278f20eee991e78086bb3b93391ccf68001f586 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 18 Oct 2007 22:07:34 +0000 Subject: [PATCH] (read_key_sequence): Undo a change introduced by multi-tty which caused key-translation-map to applied repeatedly (thus breaking double-mode). --- src/ChangeLog | 6 ++++++ src/keyboard.c | 22 +++++++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index dcd9f0955dd..c50b6286407 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2007-10-18 Stefan Monnier + + * keyboard.c (read_key_sequence): Undo a change introduced by multi-tty + which caused key-translation-map to applied repeatedly (thus breaking + double-mode). + 2007-10-17 Stefan Monnier * xselect.c (x_own_selection, x_handle_selection_clear) diff --git a/src/keyboard.c b/src/keyboard.c index fccf5c88eaa..ddb0b4407b7 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -9185,13 +9185,16 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, orig_keymap = get_local_map (PT, current_buffer, Qkeymap); from_string = Qnil; - /* We jump here when the key sequence has been thoroughly changed, and - we need to rescan it starting from the beginning. When we jump here, - keybuf[0..mock_input] holds the sequence we should reread. */ - replay_sequence: - - /* We may switch keyboards between rescans, so we need to - reinitialize fkey and keytran before each replay. */ + /* The multi-tty merge moved the code below to right after + `replay_sequence' which caused alll these translation maps to be applied + repeatedly, even tho their doc says very clearly they are not applied to + their own output. + The reason for this move was: "We may switch keyboards between rescans, + so we need to reinitialize fkey and keytran before each replay". + This move was wrong (even if we switch keyboards, keybuf still holds the + keys we've read already from the original keyboard and some of those keys + may have already been translated). So there may still be a bug out there + lurking. */ indec.map = indec.parent = current_kboard->Vinput_decode_map; fkey.map = fkey.parent = current_kboard->Vlocal_function_key_map; keytran.map = keytran.parent = Vkey_translation_map; @@ -9199,6 +9202,11 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, fkey.start = fkey.end = 0; keytran.start = keytran.end = 0; + /* We jump here when the key sequence has been thoroughly changed, and + we need to rescan it starting from the beginning. When we jump here, + keybuf[0..mock_input] holds the sequence we should reread. */ + replay_sequence: + starting_buffer = current_buffer; first_unbound = bufsize + 1; -- 2.11.4.GIT