mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #1278 from sehraf/pr_improve-nogui-password-entry
handle backspace when entering password
This commit is contained in:
commit
0bc77749d0
@ -103,6 +103,15 @@ static std::string readStringFromKeyboard(bool passwd_mode)
|
||||
|
||||
while((c=getchar()) != '\n')
|
||||
{
|
||||
// handle backspace
|
||||
if (c == 127) {
|
||||
if(s.length()!=0) {
|
||||
std::cout << "\b \b";
|
||||
s.resize(s.length()-1);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if(passwd_mode)
|
||||
putchar('*') ;
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user