mirror of
https://github.com/monero-project/monero.git
synced 2025-07-16 21:38:46 -04:00
readline_buffer: fix "cursor in prompt" bug
It happens when readline displays a prompt just before switching to a shorter one
This commit is contained in:
parent
77e1ebff26
commit
8f3c793749
2 changed files with 5 additions and 1 deletions
contrib/epee/src
|
@ -44,7 +44,7 @@ std::vector<std::string>& rdln::readline_buffer::completion_commands()
|
|||
}
|
||||
|
||||
rdln::readline_buffer::readline_buffer()
|
||||
: std::stringbuf(), m_cout_buf(NULL)
|
||||
: std::stringbuf(), m_cout_buf(NULL), m_prompt_length(0)
|
||||
{
|
||||
current = this;
|
||||
}
|
||||
|
@ -86,8 +86,11 @@ void rdln::readline_buffer::set_prompt(const std::string& prompt)
|
|||
if(m_cout_buf == NULL)
|
||||
return;
|
||||
boost::lock_guard<boost::mutex> lock(sync_mutex);
|
||||
rl_set_prompt(std::string(m_prompt_length, ' ').c_str());
|
||||
rl_redisplay();
|
||||
rl_set_prompt(prompt.c_str());
|
||||
rl_redisplay();
|
||||
m_prompt_length = prompt.size();
|
||||
}
|
||||
|
||||
void rdln::readline_buffer::add_completion(const std::string& command)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue