From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.bugs Subject: bug#8522: Arrow key trouble when keyboard encoding is euc-japan Date: Tue, 16 Jul 2013 15:08:31 -0400 Message-ID: <70ppui8gr4.fsf@fencepost.gnu.org> References: <4DADA451.7080809@dennougedougakkai-ndd.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1374001747 26113 80.91.229.3 (16 Jul 2013 19:09:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Jul 2013 19:09:07 +0000 (UTC) Cc: 8522@debbugs.gnu.org, IIJIMA Hiromitsu To: Kenichi Handa Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 16 21:09:09 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UzAcW-0002uE-Ss for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Jul 2013 21:09:09 +0200 Original-Received: from localhost ([::1]:36430 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzAcW-0000EP-7c for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Jul 2013 15:09:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42624) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzAcS-0000E8-DX for bug-gnu-emacs@gnu.org; Tue, 16 Jul 2013 15:09:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UzAcR-0004w7-3A for bug-gnu-emacs@gnu.org; Tue, 16 Jul 2013 15:09:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzAcQ-0004w2-Um for bug-gnu-emacs@gnu.org; Tue, 16 Jul 2013 15:09:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1UzAcQ-0002yR-EX for bug-gnu-emacs@gnu.org; Tue, 16 Jul 2013 15:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Jul 2013 19:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8522 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 8522-submit@debbugs.gnu.org id=B8522.137400171511372 (code B ref 8522); Tue, 16 Jul 2013 19:09:02 +0000 Original-Received: (at 8522) by debbugs.gnu.org; 16 Jul 2013 19:08:35 +0000 Original-Received: from localhost ([127.0.0.1]:58968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UzAby-0002xL-Uv for submit@debbugs.gnu.org; Tue, 16 Jul 2013 15:08:35 -0400 Original-Received: from fencepost.gnu.org ([208.118.235.10]:58199 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UzAbx-0002xD-7E for 8522@debbugs.gnu.org; Tue, 16 Jul 2013 15:08:34 -0400 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1UzAbv-0002SC-TY; Tue, 16 Jul 2013 15:08:31 -0400 X-Spook: plutonium Semtex Abbas Taiwan computer terrorism NASA X-Ran: vDde>#mrS$Cbm7is=6eU|$VgiUMKiOo5\/GG=/B|c:jMG)@Eg@8R3IXaxM`:w@`69W>(l' X-Hue: white X-Attribution: GM In-Reply-To: <4DADA451.7080809@dennougedougakkai-ndd.org> (IIJIMA Hiromitsu's message of "Wed, 20 Apr 2011 00:03:45 +0900") User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:76399 Archived-At: Please could you take a look at this report? http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8522 IIJIMA Hiromitsu wrote: > I am using Emacs 23.2.1 on FreeBSD and RedHat (32-bit versions). > > I have configured keyboard-encoding-system be "euc-japan" because > it is the terminal's default. > > But when I upgraded Emacs to ver. 23, arrow keys began to cause > troubles when I run Emacs inside a terminal window (emacs -nw). > > When I move cursor with an arrow key, the cursor movement is > reflected to the screen with one stroke delay. > C-l shows the cursor's "real" position. > It does not happen when I move cursor by C-f, C-n, etc. > > HOW-TO-REPEAT: Open a file and type C-x RET k euc-japan RET. > > According to the following site (in Japanese), > http://slashdot.jp/~doda/journal/516198 > the cause of this trouble is that arrow keys are passed to Emacs as > ESC O {A,B,C,D} sequence and this "ESC O" is interpreted as ISO/IEC > 2022's SS3 (single-shift 3) code. > > This trouble occurs when the following conditions are all met: > - ISO/IEC 2022 compliant or their variants > - Using SS3 > - A character set designated to G3 by default > > At this moment, only Japanese EUC and its variants match the conditions. > > There are some encodings that use single-shifts: iso-2022-jp-2, > iso-2022-cn, and iso-2022-cn-ext. But > > - iso-2022-jp-2 and iso-2022-cn use SS2 and do not use SS3, > and > - iso-2022-cn-ext uses SS3 but in this encoding G3 is empty > at the boot time. > > In addition, iso-2022-cn-ext is a 7-bit encoding and therefore you can > assume that in a 8-bit encoding, namely only Japanese EUC and its > variants, a SS3 is followed by GR byte sequence, and treat the sequence > "SS3 + GL-byte" as a void character. > > The site above published the following patch. > Would you consider applying it? Thanks in advance. > > --- src/coding.c.orig 2010-04-04 07:26:13.000000000 +0900 > +++ src/coding.c 2010-09-24 16:42:33.000000000 +0900 > @@ -3853,8 +3853,14 @@ > else > charset = CHARSET_FROM_ID (charset_id_2); > ONE_MORE_BYTE (c1); > - if (c1 < 0x20 || (c1 >= 0x80 && c1 < 0xA0)) > - goto invalid_code; > + if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SEVEN_BITS) { > + if (c1 < 0x20 || c1 >= 0x80) > + goto invalid_code; > + } > + else { > + if (c1 < 0xA0) > + goto invalid_code; > + } > break; > > case 'O': /* invocation of single-shift-3 */ > @@ -3867,8 +3873,14 @@ > else > charset = CHARSET_FROM_ID (charset_id_3); > ONE_MORE_BYTE (c1); > - if (c1 < 0x20 || (c1 >= 0x80 && c1 < 0xA0)) > - goto invalid_code; > + if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SEVEN_BITS) { > + if (c1 < 0x20 || c1 >= 0x80) > + goto invalid_code; > + } > + else { > + if (c1 < 0xA0) > + goto invalid_code; > + } > break; > > case '0': case '2': case '3': case '4': /* start composition */