From 5d33e2a37b68441dbe9d835203d3eb0c460740bd Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Sun, 29 Mar 2020 03:14:20 +0000 Subject: [PATCH] Add a string command (e.g. sysop command) parameter history (persisted in bbs.mods.str_cmds_parameter_history): the sysop can use the up/down arrow keys to scroll back through command parameter history (for the current login-session). --- exec/str_cmds.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/exec/str_cmds.js b/exec/str_cmds.js index ea07a6ad15..1f0fa56821 100644 --- a/exec/str_cmds.js +++ b/exec/str_cmds.js @@ -835,15 +835,22 @@ function str_cmds(str) //### Generic routine to ask user for parameter if one wasn't specified ### -function get_arg(str, parm) +function get_arg(str, parm, history) { + if(!history) { + if(!bbs.mods.str_cmds_parameter_history) + bbs.mods.str_cmds_parameter_history = []; + history = bbs.mods.str_cmds_parameter_history; + } if(parm == undefined) parm = "Parameter(s)"; str=str.replace(/^\s+/,""); if(str=="") { write(format("%s: ", parm)); - str=console.getstr(); + str=console.getstr(history); } + if(str && history.indexOf(str) < 0) + history.unshift(str); return(str); } -- GitLab