From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jason Rumney Newsgroups: gmane.emacs.devel Subject: Re: Next pretest Date: Wed, 27 Jan 2010 22:03:21 +0800 Message-ID: <87aavz63x2.fsf@wanchan.jasonrumney.net> References: <87fx5vef1j.fsf@stupidchicken.com> <87sk9sga2k.fsf@stupidchicken.com> <83aaw068mj.fsf@gnu.org> <4B5F9ECB.1010601@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1264601818 25373 80.91.229.12 (27 Jan 2010 14:16:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Jan 2010 14:16:58 +0000 (UTC) Cc: emacs-devel@gnu.org To: Juanma Barranquero Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 27 15:16:49 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Na8hE-0004bg-C8 for ged-emacs-devel@m.gmane.org; Wed, 27 Jan 2010 15:16:40 +0100 Original-Received: from localhost ([127.0.0.1]:38256 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Na8hF-0004Df-Et for ged-emacs-devel@m.gmane.org; Wed, 27 Jan 2010 09:16:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Na8UY-0004Zj-IG for emacs-devel@gnu.org; Wed, 27 Jan 2010 09:03:34 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Na8UV-0004YA-3h for emacs-devel@gnu.org; Wed, 27 Jan 2010 09:03:34 -0500 Original-Received: from [199.232.76.173] (port=37287 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Na8UU-0004Y5-LT for emacs-devel@gnu.org; Wed, 27 Jan 2010 09:03:30 -0500 Original-Received: from mail-yw0-f172.google.com ([209.85.211.172]:50035) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Na8UU-0005rt-5j for emacs-devel@gnu.org; Wed, 27 Jan 2010 09:03:30 -0500 Original-Received: by ywh2 with SMTP id 2so1901596ywh.27 for ; Wed, 27 Jan 2010 06:03:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:received:from:to:cc :subject:references:date:in-reply-to:message-id:user-agent :mime-version:content-type; bh=+xHWkbT/IK3uBXIPKVv2CxRyA70OFoLb7xsTLgR5dpU=; b=lNzRl5ExtMbYahxiK+qbJH8hyWnfkDWPz0TgwRaiJlP8ZP7txpBc/MplreZXBLriQu lSV7ikwfR2llX+0ED8q92OTs92NO2fpn18nGcBoxKDzAXAFrA0DmP2mSOQ84fthFi6AU 2exhwX7AsPZ9tA6NAxKfazGlu7Pmj7F8pR9rQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=K0LtWC7ImMaEq24UFO7na8efh/BUKQZ3uM5Gdpw6K0XUu3vXrXaeVNf1pIDx35hlMl 2cBZ94THo4kvcojFk/sozXFnDpDxWJuR2Q4nuChJRMzEVNGZHH1VZ0N6sTmViQj9IW8K M4jSBrEoqSYXtiH7XkjN8Dq0HXtCkQoFxDrxI= Original-Received: by 10.150.235.6 with SMTP id i6mr7974906ybh.256.1264601008660; Wed, 27 Jan 2010 06:03:28 -0800 (PST) Original-Received: from wanchan.jasonrumney.net ([202.87.221.133]) by mx.google.com with ESMTPS id 7sm2406042yxg.50.2010.01.27.06.03.25 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 27 Jan 2010 06:03:26 -0800 (PST) Original-Received: by wanchan.jasonrumney.net (Postfix, from userid 1000) id 63007E91; Wed, 27 Jan 2010 22:03:21 +0800 (MYT) In-Reply-To: (Juanma Barranquero's message of "Wed, 27 Jan 2010 10:50:14 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:120502 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Juanma Barranquero writes: > On Wed, Jan 27, 2010 at 03:02, Jason Rumney wrote: > >> w32inevt.c needs the equivalent of this code from w32term.c at the point >> where it currently sets the event kind to ASCII_KEYSTROKE_EVENT. >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0inev.kind =3D inev.code = < 128 ? ASCII_KEYSTROKE_EVENT >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0: MULTIBYTE_CHAR_KEYSTROKE_EVENT; > > =C3=B1 -> "A-C-H-M-S-s-\244 is undefined" > > so something more needs to be done. > > Juanma Please try the following patch: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=w32-console-kbd.patch # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: jasonr@gnu.org-20100127135913-w5ki5nt0nlgk9803 # target_branch: sftp://jasonr@bzr.savannah.gnu.org/srv/bzr/emacs\ # /trunk # testament_sha1: c5057dffd8857a57cd7e41fafad303e6e94981c9 # timestamp: 2010-01-27 22:00:49 +0800 # base_revision_id: handa@m17n.org-20100127052918-sjr9309swfbh2ay4 # # Begin patch === modified file 'src/ChangeLog' --- src/ChangeLog 2010-01-27 05:28:39 +0000 +++ src/ChangeLog 2010-01-27 13:59:13 +0000 @@ -1,3 +1,8 @@ +2010-01-27 Jason Rumney + + * w32inevt.c (w32_kbd_patch_key): Save the unicode character. + (key_event): Use unicode for characters 128 and higher. + 2010-01-27 Kenichi Handa * regex.c (analyse_first): Fix setting of fastmap for unibyte === modified file 'src/w32inevt.c' --- src/w32inevt.c 2010-01-13 08:35:10 +0000 +++ src/w32inevt.c 2010-01-27 13:59:13 +0000 @@ -81,6 +81,9 @@ static INPUT_RECORD event_queue[EVENT_QUEUE_SIZE]; static INPUT_RECORD *queue_ptr = event_queue, *queue_end = event_queue; +/* Temporarily store lead byte of DBCS input sequences. */ +static char dbcs_lead = 0; + static int fill_queue (BOOL block) { @@ -253,13 +256,15 @@ keystate, buf, 128, 0); if (isdead > 0) { - char cp[20]; - int cpId; - - GetLocaleInfo (GetThreadLocale (), + char cp[20]; + int cpId; + + event->uChar.UnicodeChar = buf[isdead - 1]; + + GetLocaleInfo (GetThreadLocale (), LOCALE_IDEFAULTANSICODEPAGE, cp, 20); - cpId = atoi (cp); - isdead = WideCharToMultiByte (cpId, 0, buf, isdead, + cpId = atoi (cp); + isdead = WideCharToMultiByte (cpId, 0, buf, isdead, ansi_code, 4, NULL, NULL); } else @@ -425,8 +430,6 @@ if (lispy_function_keys[event->wVirtualKeyCode] == 0) { - emacs_ev->kind = ASCII_KEYSTROKE_EVENT; - if (!NILP (Vw32_recognize_altgr) && (event->dwControlKeyState & LEFT_CTRL_PRESSED) && (event->dwControlKeyState & RIGHT_ALT_PRESSED)) @@ -461,9 +464,65 @@ else if (event->uChar.AsciiChar == 0) w32_kbd_patch_key (event); } + if (event->uChar.AsciiChar == 0) - return 0; - emacs_ev->code = event->uChar.AsciiChar; + { + emacs_ev->kind = NO_EVENT; + return 0; + } + else if (event->uChar.AsciiChar < 128) + { + emacs_ev->kind = ASCII_KEYSTROKE_EVENT; + emacs_ev->code = event->uChar.AsciiChar; + } + else if (event->uChar.UnicodeChar > 0) + { + emacs_ev->kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT; + emacs_ev->code = event->uChar.UnicodeChar; + } + else + { + /* Fallback for non-Unicode versions of Windows. */ + wchar_t code; + char dbcs[2]; + char cp[20]; + int cpId; + + /* Get the codepage to interpret this key with. */ + GetLocaleInfo (GetThreadLocale (), + LOCALE_IDEFAULTANSICODEPAGE, cp, 20); + cpId = atoi (cp); + + dbcs[0] = dbcs_lead; + dbcs[1] = event->uChar.AsciiChar; + if (dbcs_lead) + { + dbcs_lead = 0; + if (!MultiByteToWideChar (cpId, 0, dbcs, 2, &code, 1)) + { + /* Garbage */ + DebPrint (("Invalid DBCS sequence: %d %d\n", + dbcs[0], dbcs[1])); + emacs_ev.kind = NO_EVENT; + } + } + else if (IsDBCSLeadByteEx (cpId, dbcs[1])) + { + dbcs_lead = dbcs[1]; + emacs_ev.kind = NO_EVENT; + } + else + { + if (!MultiByteToWideChar (cpId, 0, &dbcs[1], 1, &code, 1)) + { + /* Garbage */ + DebPrint (("Invalid character: %d\n", dbcs[1])); + emacs_ev.kind = NO_EVENT; + } + } + emacs_ev->kind = MULTIBYTE_CHAR_KEYSTROKE_EVENT; + emacs_ev->code = code; + } } else { # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWXaAsuIADTzfgHEwc3f//3// 366////6YBG8+uz1z3wZPPsUltqTfc94N62g0vdnuH33u7ha4+8a83uwdQpKlKj5sKVhlE0yjTT1 Eekyek8o9qYkaGQAaZAAAAAGSABMJkQmhJlPNJPRDQBkZAAAAAZTTCEqfkFPTTapoeUDIAGgyGgA AAaASaopiNRHqepp5MiNGTR6nqADQBoAAAA0EUk0AJkTBBkAKeFNopo9E0DQ00NAMmTQRRJMKYEa ZE8mp6aTamQBP1TymmR6jQAGNQeiNiS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