From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Borja Tarraso Hueso Newsgroups: gmane.emacs.bugs Subject: bug#3287: GNU/Emacs bug when typed in prompt password fields using keypad Date: Thu, 14 May 2009 16:52:51 +0100 Message-ID: <1f62569f0905140852j553dbfbby7f00797d23988832@mail.gmail.com> Reply-To: Borja Tarraso Hueso , 3287@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=000e0cd251520404ac0469e1526f X-Trace: ger.gmane.org 1242362010 17609 80.91.229.12 (15 May 2009 04:33:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 15 May 2009 04:33:30 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 15 06:33:23 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1M4p6m-0006nP-19 for geb-bug-gnu-emacs@m.gmane.org; Fri, 15 May 2009 06:33:22 +0200 Original-Received: from localhost ([127.0.0.1]:54884 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M4p6l-0001o5-KV for geb-bug-gnu-emacs@m.gmane.org; Fri, 15 May 2009 00:33:19 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M4dXU-0002FD-OT for bug-gnu-emacs@gnu.org; Thu, 14 May 2009 12:12:08 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M4dXP-00029y-JP for bug-gnu-emacs@gnu.org; Thu, 14 May 2009 12:12:08 -0400 Original-Received: from [199.232.76.173] (port=50454 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M4dXP-00029i-FS for bug-gnu-emacs@gnu.org; Thu, 14 May 2009 12:12:03 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:43503) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M4dXM-0001yp-Le for bug-gnu-emacs@gnu.org; Thu, 14 May 2009 12:12:03 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n4EGBtPC020185; Thu, 14 May 2009 09:11:55 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n4EG06lC014495; Thu, 14 May 2009 09:00:06 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Borja Tarraso Hueso Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 14 May 2009 16:00:05 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 3287 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.124231638112495 (code B ref -1); Thu, 14 May 2009 16:00:05 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 14 May 2009 15:53:01 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n4EFqs3U012473 for ; Thu, 14 May 2009 08:52:55 -0700 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M4dEs-00035s-5V for bug-gnu-emacs@gnu.org; Thu, 14 May 2009 11:52:54 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M4dEr-000354-D7 for bug-gnu-emacs@gnu.org; Thu, 14 May 2009 11:52:53 -0400 Original-Received: from [199.232.76.173] (port=47918 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M4dEr-00034z-Ar for bug-gnu-emacs@gnu.org; Thu, 14 May 2009 11:52:53 -0400 Original-Received: from fg-out-1718.google.com ([72.14.220.158]:28811) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M4dEq-0006np-EB for bug-gnu-emacs@gnu.org; Thu, 14 May 2009 11:52:53 -0400 Original-Received: by fg-out-1718.google.com with SMTP id e12so437236fga.7 for ; Thu, 14 May 2009 08:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:cc:content-type; bh=VUTV1/tJr1cIZGyhyynUPr+k1o5n14l/w7DUaeH3VSw=; b=OFu0hzj7L1yFOOYVh/0lVW/PdORwyfGc+lw5ZfReGovfvVLeJ5J9KwADr6UxB9dcu2 cOupUfJeZtVeA8lYf8tVsTFfLdruYROkeNX1EgV2hOWb1ky49pQOB0dobEoIexaE9r38 vXJiun4A9GJgww8Kxu/7XzTl5hj7EGPqY3rks= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=q+Fz/iYqFxdeq3IuiFMKzdJfTUUYdw2S9wHRoeknP+gLq66jfOZa4niYTlfRusc/Bl kbJ4f6GN/i4LeDZ51bsm9HHUvnYe27k+fs9RWCj+WYXvV99iNKaSFvwKvM73zNNbX/n9 tdcvCrSwlJVXf+F2NQcJcALD5zlaPoXCiTPP4= Original-Received: by 10.86.65.9 with SMTP id n9mr2637627fga.43.1242316371395; Thu, 14 May 2009 08:52:51 -0700 (PDT) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Thu, 14 May 2009 12:12:08 -0400 X-Mailman-Approved-At: Fri, 15 May 2009 00:33:14 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:27894 Archived-At: --000e0cd251520404ac0469e1526f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi people, I just found a bug when is used keypad under password input field in emacs, that's not doing anything, so these diffs provided by Stefan and slightly modified by us, to handle C-g case, fix the problem . ==> Bug: Under GNU/Linux trying to write numbers using keypad in a prompt input password field does not works. This is not happening under Windows OS. Not other OS tested. This is reproducible in any gnu/emacs version from cvs (e.g. 23.0.90.2). ==> Fix: Usage of read-key instead read-event. As read-key is getting each key but not inserted and handled until pressed return, so we should take care about C-g case as well to provide user's cancellation. ==> Diffs: *** emacs/lisp/subr.el 2009-02-14 09:06:56.000000000 +0000 --- emacs_hack/lisp/subr.el 2009-05-14 01:29:52.000000000 +0100 *************** *** 1721,1726 **** --- 1721,1767 ---- - Mostrar texto citado - ;;;; Input and display facilities. + (defconst read-key-empty-map (make-sparse-keymap)) + (defvar read-key-delay 0.1) + + (defun read-key (&optional prompt) + "Read a key from the keyboard. + Contrary to `read-event' this will not return a raw event but instead will + obey the input decoding and translations usually done by `read-key-sequence'. + So escape sequences and keyboard encoding are taken into account. + When there's an ambiguity because the key looks like the prefix of + some sort of escape sequence, the ambiguity is resolved via `read-key-delay'." + (let ((overriding-terminal-local-map read-key-empty-map) + (overriding-local-map nil) + (old-global-map (current-global-map)) + (timer (run-with-idle-timer + ;; Wait long enough that Emacs has the time to receive and + ;; process all the raw events associated with the single-key. + ;; But don't wait too long, or the user may find the delay + ;; annoying (or keep hitting more keys which may then get + ;; lost or misinterpreted). + ;; This is only relevant for keys which Emacs perceives as + ;; "prefixes", such as C-x (because of the C-x 8 map in + ;; key-translate-table and the C-x @ map in function-key-map) + ;; or ESC (because of terminal escape sequences in + ;; input-decode-map). + read-key-delay t + (lambda () + (let ((keys (this-command-keys-vector))) + (unless (zerop (length keys)) + ;; `keys' is non-empty, so the user has hit at least + ;; one key; there's no point waiting any longer, even + ;; though read-key-sequence thinks we should wait + ;; for more input to decide how to interpret the + ;; current input. + (throw 'read-key keys))))))) + (unwind-protect + (progn + (use-global-map read-key-empty-map) + (aref (catch 'read-key (read-key-sequence prompt nil t)) 0)) + (cancel-timer timer) + (use-global-map old-global-map)))) + (defvar read-quoted-char-radix 8 "*Radix for \\[quoted-insert] and other uses of `read-quoted-char'. Legitimate radix values are 8, 10 and 16.") *************** *** 1837,1846 **** (while (progn (message "%s%s" prompt (make-string (length pass) ?.)) ! ;; We used to use read-char-exclusive, but that ! ;; gives funny behavior when the user presses, ! ;; e.g., the arrow keys. ! (setq c (read-event nil t)) (not (memq c stop-keys))) (clear-this-command-keys) (cond ((memq c rubout-keys) ; rubout --- 1878,1884 ---- (while (progn (message "%s%s" prompt (make-string (length pass) ?.)) ! (setq c (read-key)) (not (memq c stop-keys))) (clear-this-command-keys) (cond ((memq c rubout-keys) ; rubout *************** *** 1848,1855 **** (let ((new-pass (substring pass 0 -1))) (and (arrayp pass) (clear-string pass)) (setq pass new-pass)))) ((not (numberp c))) ! ((= c ?\C-u) ; kill line (and (arrayp pass) (clear-string pass)) (setq pass "")) ((= c ?\C-y) ; yank --- 1886,1895 ---- (let ((new-pass (substring pass 0 -1))) (and (arrayp pass) (clear-string pass)) (setq pass new-pass)))) + ((eq c ?\C-g) + (keyboard-quit)) ((not (numberp c))) ! ((eq c ?\C-u) ; kill line (and (arrayp pass) (clear-string pass)) (setq pass "")) ((= c ?\C-y) ; yank ==> End. Thanks! Borja Tarraso --000e0cd251520404ac0469e1526f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi people,

I just found a bug when is used keypad under password inp= ut field in emacs, that's not doing anything, so these diffs provided b= y Stefan and slightly modified by us, to handle C-g case, fix the problem.

=3D=3D> Bug:

Under GNU/Linux trying to write numbers using ke= ypad in a prompt input password field does not works. This is not happening= under Windows OS. Not other OS tested.

This is reproducible in any = gnu/emacs version from cvs (e.g. 23.0.90.2).

=3D=3D> Fix:

Usage of read-key instead read-event. As read-ke= y is getting each key but not inserted and handled until pressed return, so= we should take care about C-g case as well to provide user's cancellat= ion.

=3D=3D> Diffs:

*** emacs/lisp/subr.el =A02009-02-14 09:06:56.000000000 +0000
--- emacs_hack/lisp/subr.el =A0 =A0 2009-05-14 01:29:52.000000000 +0100
***************
*** 1721,1726 ****
--- 1721,1767 ----
- Mostrar texto ci= tado -


=A0;;;; Input and display facilities.

+ (defconst read-key-empty-map (make-sparse-keymap))
+ (defvar read-key-delay 0.1)
+
+ (defun read-key (&optional prompt)
+ =A0 "Read a key from the keyboard.
+ Contrary to `read-event' this will not return a raw event but instead= will
+ obey the input decoding and translations usually done by `read-key-sequen= ce'.
+ So escape sequences and keyboard encoding are taken into account.
+ When there's an ambiguity because the key looks like the prefix of + some sort of escape sequence, the ambiguity is resolved via `read-key-del= ay'."
+ =A0 (let ((overriding-terminal-local-map read-key-empty-map)
+ =A0 =A0 =A0 (overriding-local-map nil)
+ =A0 =A0 =A0 (old-global-map (current-global-map))
+ =A0 =A0 =A0 =A0 (timer (run-with-idle-timer
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; Wait long enough that Emacs has the ti= me to receive and
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; process all the raw events associated = with the single-key.
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; But don't wait too long, or the us= er may find the delay
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; annoying (or keep hitting more keys wh= ich may then get
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; lost or misinterpreted).
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; This is only relevant for keys which E= macs perceives as
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; "prefixes", such as C-x (bec= ause of the C-x 8 map in
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; key-translate-table and the C-x @ map = in function-key-map)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; or ESC (because of terminal escape seq= uences in
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; input-decode-map).
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 read-key-delay t
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (lambda ()
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (let ((keys (this-command-keys-vector= )))
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (unless (zerop (length keys))
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; `keys' is non-empty, s= o the user has hit at least
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; one key; there's no po= int waiting any longer, even
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; though read-key-sequence t= hinks we should wait
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; for more input to decide h= ow to interpret the
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; current input.
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (throw 'read-key keys))))= )))
+ =A0 =A0 (unwind-protect
+ =A0 =A0 =A0 =A0 (progn
+ =A0 =A0 =A0 =A0 (use-global-map read-key-empty-map)
+ =A0 =A0 =A0 =A0 (aref (catch 'read-key (read-key-sequence prompt nil = t)) 0))
+ =A0 =A0 =A0 (cancel-timer timer)
+ =A0 =A0 =A0 (use-global-map old-global-map))))
+
=A0(defvar read-quoted-char-radix 8
=A0 =A0"*Radix for \\[quoted-insert] and other uses of `read-quoted-c= har'.
=A0Legitimate radix values are 8, 10 and 16.")
***************
*** 1837,1846 ****
=A0 =A0 =A0 =A0(while (progn (message "%s%s" =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 prompt
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (make-string (= length pass) ?.))
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; We used to use read-char-exclu= sive, but that
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; gives funny behavior when the = user presses,
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; e.g., the arrow keys.
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq c (read-event nil t))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(not (m= emq c stop-keys)))
=A0 =A0 =A0 =A0 =A0(clear-this-command-keys)
=A0 =A0 =A0 =A0 =A0(cond ((memq c rubout-keys) ; rubout
--- 1878,1884 ----
=A0 =A0 =A0 =A0(while (progn (message "%s%s" =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 prompt
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (make-string (= length pass) ?.))
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq c (read-key))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(not (memq c = stop-keys)))
=A0 =A0 =A0 =A0 =A0(clear-this-command-keys)
=A0 =A0 =A0 =A0 =A0(cond ((memq c rubout-keys) ; rubout
***************
*** 1848,1855 ****
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (let ((new-pass (substring pass 0 -1))= )
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (and (arrayp pas= s) (clear-string pass))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq pass new-pass))))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0((not (numberp c)))
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 ((=3D c ?\C-u) ; kill line
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (and (arrayp pass) (clear-string pass))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq pass ""))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0((=3D c ?\C-y) ; yank
--- 1886,1895 ----
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (let ((new-pass (substring pass 0 -1))= )
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (and (arrayp pas= s) (clear-string pass))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq pass new-pass))))
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 ((eq c ?\C-g)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(keyboard-quit))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0((not (numberp c)))
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 ((eq c ?\C-u) ; kill line
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (and (arrayp pass) (clea= r-string pass))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq pass ""))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0((=3D c ?\C-y) ; yank


=3D=3D> End.

Thanks!

Borja Tarraso


--000e0cd251520404ac0469e1526f--