Terminal: Show key when input is hidden

Change-Id: I5fca6a8c4f43ea2b95bad4df247b5df0abad521c
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-06-15 14:16:53 +02:00
parent c32b7067fe
commit e17866e283
11 changed files with 115 additions and 7 deletions

View File

@@ -172,6 +172,12 @@ bool UnixPtyProcess::startProcess(const QString &shellPath,
static std::array<char, maxRead> buffer;
int len = ::read(m_shellProcess.m_handleMaster, buffer.data(), buffer.size());
struct termios termAttributes;
tcgetattr(m_shellProcess.m_handleMaster, &termAttributes);
const bool isPasswordEntry = !(termAttributes.c_lflag & ECHO) && (termAttributes.c_lflag & ICANON);
m_inputFlags.setFlag(PtyInputFlag::InputModeHidden, isPasswordEntry);
if (len > 0) {
m_shellReadBuffer.append(buffer.data(), len);
m_shellProcess.emitReadyRead();