diff options
| author | Chong Yidong | 2008-11-16 21:02:05 +0000 |
|---|---|---|
| committer | Chong Yidong | 2008-11-16 21:02:05 +0000 |
| commit | d4a263ba04623f28736e004c295d8dc483a0b23e (patch) | |
| tree | 582602250364ec39f1267862095d05bcf2642830 | |
| parent | 71a00ac2df7df0bb82d4d7198bdb322f2ca4dc3c (diff) | |
| download | emacs-d4a263ba04623f28736e004c295d8dc483a0b23e.tar.gz emacs-d4a263ba04623f28736e004c295d8dc483a0b23e.zip | |
(read-passwd): Use read-event instead of read-char-exclusive.
| -rw-r--r-- | lisp/subr.el | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index fac523d4a7f..eb4cf15e141 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -1811,16 +1811,27 @@ by doing (clear-string STRING)." | |||
| 1811 | (c 0) | 1811 | (c 0) |
| 1812 | (echo-keystrokes 0) | 1812 | (echo-keystrokes 0) |
| 1813 | (cursor-in-echo-area t) | 1813 | (cursor-in-echo-area t) |
| 1814 | (message-log-max nil)) | 1814 | (message-log-max nil) |
| 1815 | (stop-keys (list 'return ?\r ?\n ?\e)) | ||
| 1816 | (rubout-keys (list 'backspace ?\b ?\177))) | ||
| 1815 | (add-text-properties 0 (length prompt) | 1817 | (add-text-properties 0 (length prompt) |
| 1816 | minibuffer-prompt-properties prompt) | 1818 | minibuffer-prompt-properties prompt) |
| 1817 | (while (progn (message "%s%s" | 1819 | (while (progn (message "%s%s" |
| 1818 | prompt | 1820 | prompt |
| 1819 | (make-string (length pass) ?.)) | 1821 | (make-string (length pass) ?.)) |
| 1820 | (setq c (read-char-exclusive nil t)) | 1822 | ;; We used to use read-char-exclusive, that that |
| 1821 | (and (/= c ?\r) (/= c ?\n) (/= c ?\e))) | 1823 | ;; gives funny behavior when the user presses, |
| 1824 | ;; e.g., the arrow keys. | ||
| 1825 | (setq c (read-event nil t)) | ||
| 1826 | (not (memq c stop-keys))) | ||
| 1822 | (clear-this-command-keys) | 1827 | (clear-this-command-keys) |
| 1823 | (cond ((= c ?\C-u) ; kill line | 1828 | (cond ((memq c rubout-keys) ; rubout |
| 1829 | (when (> (length pass) 0) | ||
| 1830 | (let ((new-pass (substring pass 0 -1))) | ||
| 1831 | (and (arrayp pass) (clear-string pass)) | ||
| 1832 | (setq pass new-pass)))) | ||
| 1833 | ((not (numberp c))) | ||
| 1834 | ((= c ?\C-u) ; kill line | ||
| 1824 | (and (arrayp pass) (clear-string pass)) | 1835 | (and (arrayp pass) (clear-string pass)) |
| 1825 | (setq pass "")) | 1836 | (setq pass "")) |
| 1826 | ((= c ?\C-y) ; yank | 1837 | ((= c ?\C-y) ; yank |
| @@ -1835,16 +1846,12 @@ by doing (clear-string STRING)." | |||
| 1835 | (and (arrayp pass) (clear-string pass)) | 1846 | (and (arrayp pass) (clear-string pass)) |
| 1836 | (setq c ?\0) | 1847 | (setq c ?\0) |
| 1837 | (setq pass new-pass)))) | 1848 | (setq pass new-pass)))) |
| 1838 | ((and (/= c ?\b) (/= c ?\177)) ; insert char | 1849 | ((characterp c) ; insert char |
| 1839 | (let* ((new-char (char-to-string c)) | 1850 | (let* ((new-char (char-to-string c)) |
| 1840 | (new-pass (concat pass new-char))) | 1851 | (new-pass (concat pass new-char))) |
| 1841 | (and (arrayp pass) (clear-string pass)) | 1852 | (and (arrayp pass) (clear-string pass)) |
| 1842 | (clear-string new-char) | 1853 | (clear-string new-char) |
| 1843 | (setq c ?\0) | 1854 | (setq c ?\0) |
| 1844 | (setq pass new-pass))) | ||
| 1845 | ((> (length pass) 0) ; rubout | ||
| 1846 | (let ((new-pass (substring pass 0 -1))) | ||
| 1847 | (and (arrayp pass) (clear-string pass)) | ||
| 1848 | (setq pass new-pass))))) | 1855 | (setq pass new-pass))))) |
| 1849 | (message nil) | 1856 | (message nil) |
| 1850 | (or pass default ""))))) | 1857 | (or pass default ""))))) |