aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/epee/include/console_handler.h6
-rw-r--r--contrib/epee/include/net/net_utils_base.h5
-rw-r--r--contrib/epee/src/readline_buffer.cpp7
3 files changed, 12 insertions, 6 deletions
diff --git a/contrib/epee/include/console_handler.h b/contrib/epee/include/console_handler.h
index bb20faa65..6832f2ea1 100644
--- a/contrib/epee/include/console_handler.h
+++ b/contrib/epee/include/console_handler.h
@@ -315,7 +315,11 @@ namespace epee
if (!m_prompt.empty())
{
#ifdef HAVE_READLINE
- m_stdin_reader.get_readline_buffer().set_prompt(m_prompt);
+ std::string color_prompt = "\001\033[1;33m\002" + m_prompt;
+ if (' ' != m_prompt.back())
+ color_prompt += " ";
+ color_prompt += "\001\033[0m\002";
+ m_stdin_reader.get_readline_buffer().set_prompt(color_prompt);
#else
epee::set_console_color(epee::console_color_yellow, true);
std::cout << m_prompt;
diff --git a/contrib/epee/include/net/net_utils_base.h b/contrib/epee/include/net/net_utils_base.h
index 1884412dc..3bea11985 100644
--- a/contrib/epee/include/net/net_utils_base.h
+++ b/contrib/epee/include/net/net_utils_base.h
@@ -115,10 +115,9 @@ namespace net_utils
std::string host_str() const { return (*this) ? (*this)->host_str() : "<none>"; }
bool is_loopback() const { return (*this)->is_loopback(); }
bool is_local() const { return (*this)->is_local(); }
- const std::type_info &type() const { return typeid(**this); }
uint8_t get_type_id() const { return (*this)->get_type_id(); }
- template<typename Type> Type &as() { if (type() != typeid(Type)) throw std::runtime_error("Bad type"); return *(Type*)get(); }
- template<typename Type> const Type &as() const { if (type() != typeid(Type)) throw std::runtime_error("Bad type"); return *(const Type*)get(); }
+ template<typename Type> Type &as() { if (get_type_id() != Type::ID) throw std::runtime_error("Bad type"); return *(Type*)get(); }
+ template<typename Type> const Type &as() const { if (get_type_id() != Type::ID) throw std::runtime_error("Bad type"); return *(const Type*)get(); }
BEGIN_KV_SERIALIZE_MAP()
uint8_t type = is_store ? this_ref.get_type_id() : 0;
diff --git a/contrib/epee/src/readline_buffer.cpp b/contrib/epee/src/readline_buffer.cpp
index c959bf560..c846641bd 100644
--- a/contrib/epee/src/readline_buffer.cpp
+++ b/contrib/epee/src/readline_buffer.cpp
@@ -179,8 +179,11 @@ static int handle_enter(int x, int y)
}
free(line);
- rl_set_prompt(last_prompt.c_str());
- rl_redisplay();
+ if(last_line != "exit")
+ {
+ rl_set_prompt(last_prompt.c_str());
+ rl_redisplay();
+ }
rl_done = 1;
return 0;