From d10480a12fe8c77b0c939b35e99c84d374079ba4 Mon Sep 17 00:00:00 2001 From: wowario Date: Sat, 25 Feb 2023 09:42:23 +0300 Subject: [PATCH] add clear screen command --- src/simplewallet/simplewallet.cpp | 15 ++++++++++++++- src/simplewallet/simplewallet.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 8d06d3787..7db3716c3 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -3162,7 +3162,7 @@ bool simple_wallet::help(const std::vector &args/* = std::vector\" - Donate WOW to the development team."); message_writer() << ""; } @@ -3283,6 +3283,9 @@ simple_wallet::simple_wallet() m_cmd_binder.set_handler("refresh", boost::bind(&simple_wallet::on_command, this, &simple_wallet::refresh, _1), tr("Synchronize the transactions and balance.")); + m_cmd_binder.set_handler("clear", + boost::bind(&simple_wallet::on_command, this, &simple_wallet::clear, _1), + tr("Clear screen.")); m_cmd_binder.set_handler("balance", boost::bind(&simple_wallet::on_command, this, &simple_wallet::show_balance, _1), tr(USAGE_SHOW_BALANCE), @@ -6001,6 +6004,16 @@ bool simple_wallet::refresh(const std::vector& args) return refresh_main(start_height, ResetNone); } //---------------------------------------------------------------------------------------------------- +bool simple_wallet::clear(const std::vector& args) +{ +#ifdef HAVE_READLINE + PAUSE_READLINE(); + rdln::clear_screen(); +#endif + tools::clear_screen(); + return true; +} +//---------------------------------------------------------------------------------------------------- bool simple_wallet::show_balance_unlocked(bool detailed) { std::string extra; diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h index 82c355cdf..8e3477ba3 100644 --- a/src/simplewallet/simplewallet.h +++ b/src/simplewallet/simplewallet.h @@ -166,6 +166,7 @@ namespace cryptonote bool set_daemon(const std::vector &args); bool save_bc(const std::vector &args); bool refresh(const std::vector &args); + bool clear(const std::vector &args); bool show_balance_unlocked(bool detailed = false); bool show_balance(const std::vector &args = std::vector()); bool show_incoming_transfers(const std::vector &args);