mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
handle backspace when entering password
This commit is contained in:
parent
6bb1d3c509
commit
9a64f80182
@ -103,6 +103,15 @@ static std::string readStringFromKeyboard(bool passwd_mode)
|
|||||||
|
|
||||||
while((c=getchar()) != '\n')
|
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)
|
if(passwd_mode)
|
||||||
putchar('*') ;
|
putchar('*') ;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user