https://bugzilla.redhat.com/show_bug.cgi?id=2130717
--- Comment #3 from Mike FABIAN <mfabian(a)redhat.com> ---
Input methods always have this problem in terminals.
There seems to be no way an input method can know that a password prompt is
currently visible in a terminal.
In “normal” GUI programs (Gtk, Qt, ... programs which have “normal” entry
fields), the program usually either disables input methods completely on
entries which take a password *or* the program sets an input hint that this is
a password entry and the input method can react.
For example in ibus-typing-booster I have:
https://github.com/mike-fabian/ibus-typing-booster/blob/main/engine/hunsp...
```
if (not self._input_mode
or (self._input_purpose
in [itb_util.InputPurpose.PASSWORD.value,
itb_util.InputPurpose.PIN.value])):
return self._return_false(keyval, keycode, state)
```
But terminals do not disable input methods when a password prompt is shown and
they do not set such hints either.
In some programs, there is a feature surrounding text which means that and
input method can query what text is there in the vicinity of the cursor. With
surrounding text, it would be theoretically possible for an input method to get
the text next to the cursor and parse it to find out whether there is a
password prompt or not. This would be quite error prone though, there are many
variations of password prompts: Trying to match all password prompts with
regular expressions reliably without false positives is quite hard.
And I cannot even try to do this using surrounding text because none of the
terminals I know of supports surrounding text. See this issue:
https://gitlab.gnome.org/GNOME/vte/-/issues/2065
https://gitlab.gnome.org/GNOME/vte/-/blob/master/src/vte.cc#L4457
```
bool
Terminal::im_retrieve_surrounding()
{
/* FIXME: implement this! Bug #726191 */
return false;
}
```
I think vte is used by gnome-terminal *and* xfce4-terminal. I don’t know any
other terminals supporting surrounding text either.
I was wondering whether the terminals have any knowledge at all about whether a
password prompt is shown or not.
Usually, when a password prompt is shown, either the typed characters are not
echoed at all or one sees a row of asterisks *****
But who does this? The terminal or the program showing the password prompt,
i.e.is this hiding done by ssh or by the terminal?
As I was not sure I tried to ask the xfce4 developers:
https://gitlab.xfce.org/apps/xfce4-terminal/-/issues/112
But there was no reply.
*If* the terminals know that a password prompt is shown, *then* they could set
InputPurpose.PASSWORD. But my guess is that the terminal does not know that
either, only the program doing the prompt (like ssh) knows.
--
You are receiving this mail because:
You are on the CC list for the bug.
https://bugzilla.redhat.com/show_bug.cgi?id=2130717