emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: better than read-hide-char


From: Clément Pit-Claudel
Subject: Re: better than read-hide-char
Date: Tue, 31 Jul 2018 12:10:46 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 2018-07-30 22:25, Richard Stallman wrote:
> How about a feature whereby instead of ******************* or .............
> the password echoes as 012345678901234567890123456789...
> That way, you could tell how many characters you have successfully typed
> even when they are 20, 30, 40, 50, 60 or 70 characters.
> That would help people notice some mistakes in long passwords.

This sounds like a good idea, but I think it'd be even better to put that 
information in the modeline of the window above the minibuffer, rather than in 
the minibuffer itself. Something like this, partly copied from eldoc:

(progn
  (defvar passwd-mode-line nil)
  (put 'passwd-mode-line 'risky-local-variable t)

  (minibuffer-with-setup-hook
      (lambda ()
        (add-hook 'minibuffer-exit-hook (lambda () (setq passwd-mode-line nil)) 
nil t)
        (let ((prefix-len (buffer-size)))
          (with-current-buffer
              (window-buffer
               (or (window-in-direction 'above (minibuffer-window))
                   (minibuffer-selected-window)
                   (get-largest-window)))
            (when mode-line-format
              (unless (and (listp mode-line-format)
                           (assq 'passwd-mode-line mode-line-format))
                (setq mode-line-format
                      `("" (passwd-mode-line passwd-mode-line) 
,mode-line-format))))
            (setq passwd-mode-line
                  (concat (make-string (1+ prefix-len) ?\s)
                          "0123456789012345678901234567890"))
            (force-mode-line-update))))
    (read-passwd "Test: ")))

Clément.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]