Readline clearing fixes & cowsay replacement

Replaces the silly cow with an ASCII Loki logo:

            .
          oooo
        oooo
      oooo   .           You Loki Wallet has been locked to
    oooo    oooo         protect you while you were away.
      oooo    oooo
        oooo    oooo     (Use `set inactivity-lock-timeout 0`
          oooo    oooo   to disable this inactivity timeout)
            .   oooo
              oooo
            oooo
             .

Also includes a few related miscellaneous updates to how we suspend
input and clear the screen.
This commit is contained in:
Jason Rhinelander 2020-06-21 22:07:09 -03:00
parent cc04770b85
commit 5009de02a5
2 changed files with 14 additions and 18 deletions

View file

@ -46,6 +46,7 @@
#ifdef HAVE_READLINE
#include "readline_buffer.h"
#endif
#include "readline_suspend.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "console_handler"
@ -521,16 +522,12 @@ eof:
}
catch (const invalid_command &e)
{
#ifdef HAVE_READLINE
rdln::suspend_readline pause_readline;
#endif
std::cout << "Unknown command: " << e.what() << ". Try 'help' for available commands\n";
}
catch (const std::exception &e)
{
#ifdef HAVE_READLINE
rdln::suspend_readline pause_readline;
#endif
std::cout << "Command errored: " << cmd.front() << ", " << e.what();
}

View file

@ -5600,24 +5600,23 @@ void simple_wallet::check_for_inactivity_lock(bool user)
if (m_locked)
{
rdln::suspend_readline pause_readline;
#ifdef HAVE_READLINE
rdln::clear_screen();
#endif
tools::clear_screen();
command_line::clear_screen();
m_in_command = true;
if (!user)
{
tools::msg_writer() << R"(
______________________________________________
/ I locked your Loki Wallet to protect you \
| while you were away see "help set" to |
\ to configure/disable /
----------------------------------------------
\ (__)
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
.
oooo
oooo
oooo . You Loki Wallet has been locked to
oooo oooo protect you while you were away.
oooo oooo
oooo oooo (Use `set inactivity-lock-timeout 0`
oooo oooo to disable this inactivity timeout)
. oooo
oooo
oooo
.
)";
}