What changed, and why it matters
This commit adds a simple 'clear' command to the Monero command-line wallet that clears the terminal screen, similar to typing 'clear' in a shell. It is a user-interface convenience feature with no security relevance.
No security action needed; this is a benign UI convenience feature.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch exposes the existing tools::clear_screen() helper as a new ‘clear’ command in simplewallet. It adds a command handler, usage string, and method declaration. PAUSE_READLINE() is used to prevent readline’s streambuf substitution from interleaving ANSI escape sequences with prompt redraws. No cryptographic, network, or wallet-handling code is modified.
Changed components
src/simplewallet/simplewallet.cppsrc/simplewallet/simplewallet.hInspect captured patch +13 / −0
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 066c1d1..7eff5d1 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -279,6 +279,7 @@ namespace
const char* USAGE_WELCOME("welcome");
const char* USAGE_SHOW_QR_CODE("show_qr_code [<subaddress_index>]");
const char* USAGE_VERSION("version");
+ const char* USAGE_CLEAR("clear");
const char* USAGE_HELP("help [<command> | all]");
const char* USAGE_APROPOS("apropos <keyword> [<keyword> ...]");
const char* USAGE_SCAN_TX("scan_tx <txid> [<txid> ...]");
@@ -2148,6 +2149,13 @@ bool simple_wallet::version(const std::vector<std::string> &args)
return true;
}
+bool simple_wallet::clear(const std::vector<std::string> &args)
+{
+ PAUSE_READLINE();
+ tools::clear_screen();
+ return true;
+}
+
bool simple_wallet::on_unknown_command(const std::vector<std::string> &args)
{
if (args[0] == "exit" || args[0] == "q") // backward compat
@@ -3516,6 +3524,10 @@ simple_wallet::simple_wallet()
boost::bind(&simple_wallet::on_command, this, &simple_wallet::version, _1),
tr(USAGE_VERSION),
tr("Returns version information"));
+ m_cmd_binder.set_handler("clear",
+ boost::bind(&simple_wallet::on_command, this, &simple_wallet::clear, _1),
+ tr(USAGE_CLEAR),
+ tr("Clear the console screen"));
m_cmd_binder.set_handler("show_qr_code",
boost::bind(&simple_wallet::on_command, this, &simple_wallet::show_qr_code, _1),
tr(USAGE_SHOW_QR_CODE),
diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h
index 6d8719a..54c4e00 100644
--- a/src/simplewallet/simplewallet.h
+++ b/src/simplewallet/simplewallet.h
@@ -256,6 +256,7 @@ namespace cryptonote
bool public_nodes(const std::vector<std::string>& args);
bool welcome(const std::vector<std::string>& args);
bool version(const std::vector<std::string>& args);
+ bool clear(const std::vector<std::string>& args);
bool on_unknown_command(const std::vector<std::string>& args);
bool cold_sign_tx(const std::vector<tools::wallet2::pending_tx>& ptx_vector, tools::wallet2::signed_tx_set &exported_txs, std::vector<cryptonote::address_parse_info> &dsts_info, std::function<bool(const tools::wallet2::signed_tx_set &)> accept_func);
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.