mirror of
https://github.com/monero-project/monero.git
synced 2024-12-13 20:06:32 +02:00
Merge pull request #4573
8f3c7937
readline_buffer: fix "cursor in prompt" bug (moneromooo-monero)
This commit is contained in:
commit
442c58e994
@ -27,6 +27,7 @@ namespace rdln
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::streambuf* m_cout_buf;
|
std::streambuf* m_cout_buf;
|
||||||
|
size_t m_prompt_length;
|
||||||
static std::vector<std::string>& completion_commands();
|
static std::vector<std::string>& completion_commands();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ std::vector<std::string>& rdln::readline_buffer::completion_commands()
|
|||||||
}
|
}
|
||||||
|
|
||||||
rdln::readline_buffer::readline_buffer()
|
rdln::readline_buffer::readline_buffer()
|
||||||
: std::stringbuf(), m_cout_buf(NULL)
|
: std::stringbuf(), m_cout_buf(NULL), m_prompt_length(0)
|
||||||
{
|
{
|
||||||
current = this;
|
current = this;
|
||||||
}
|
}
|
||||||
@ -86,8 +86,11 @@ void rdln::readline_buffer::set_prompt(const std::string& prompt)
|
|||||||
if(m_cout_buf == NULL)
|
if(m_cout_buf == NULL)
|
||||||
return;
|
return;
|
||||||
boost::lock_guard<boost::mutex> lock(sync_mutex);
|
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_set_prompt(prompt.c_str());
|
||||||
rl_redisplay();
|
rl_redisplay();
|
||||||
|
m_prompt_length = prompt.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void rdln::readline_buffer::add_completion(const std::string& command)
|
void rdln::readline_buffer::add_completion(const std::string& command)
|
||||||
|
Loading…
Reference in New Issue
Block a user