Fix cursor line overwriting in prepare_registration

When I issue a `prepare_registration` command the cursor gets positioned
at the beginning of the line instead of the end of the line, so typing
things in results in overwriting the text that I was asked.

E.g.:

```
Current staking requirement: 15000.000000000 oxen
yill the operator contribute the entire stake? (Y/Yes/N/No/C/Cancel):
`-- the y I typed replaced the "W"
```
or:
```
Enter the oxen address for the solo staker (B/Back/C/Cancel):
```
and because the cursor is positioned at the beginning, my address
overwrites the prompt as I type/paste it:
```
L6JasonXTGoxen address for the solo staker (B/Back/C/Cancel):
```

This is caused because we were suspending the readline buffer *after*
printing things out, and something (perhaps local config, or perhaps an
update to libreadline) repositions to cursor at column 0.

This commit suspends the readline handler *before* we print the message,
which makes it sane again:
```
Enter the oxen address for the solo staker (B/Back/C/Cancel): L6JasonXTG
```
This commit is contained in:
Jason Rhinelander 2022-04-15 11:01:07 -03:00
parent ef51e5dd63
commit d5551009f9
No known key found for this signature in database
GPG Key ID: C4992CE7A88D4262
1 changed files with 1 additions and 1 deletions

View File

@ -63,9 +63,9 @@ namespace {
std::string input_line(std::string const &prompt)
{
rdln::suspend_readline pause_readline;
std::cout << prompt << std::flush;
std::string result;
rdln::suspend_readline pause_readline;
std::cin >> result;
return result;