kolmafia/src/net/sourceforge/kolmafia/swingui/panel/CommandDisplayPanel.java at main · kolmafia/kolmafia
KoLmafia is a cross-platform desktop tool which interfaces with the online adventure game Kingdom of Loathing 🗡️🍸 - kolmafia/kolmafia
Command history has a size of 20, which means you can execute 20 commands before it'll start forgetting stuff.
Two thoughts
So I had two thoughts about this, the first is a preference that lets you control how many entries are saved.
The second is a preference to control if the command history persists across sessions/accounts. Another setting to share history between accounts?
Controlling command history size
So the first suggestion of controlling the size, this is mostly because sometimes when I'm doing dumb stuff in the CLI I'll want to go back to some complicated command. Mostly when I'm testing javascript though, then making lots of tiny changes to the string I'm testing which all counts as a new history entry.
So that's an easy feature, although it may not be a general user consideration as 20 should be plenty for the vast majority.
Then there's a consideration of memory constraints if some really silly shenanigans occur where you raise it to an absurd number and have commands spammed.
Not sure if its possible to determine how "big" the list is in terms of memory usage. Basic counting of string bytes may be enough.
Persistent command history
The second would be storing of command history, between sessions, between accounts. And when I say between sessions, I generally mean restarting the program. Though logging out and in is a thing too I suppose.
My main two thoughts here is that if we share it between sessions, it should be stored in global. Otherwise in user prefs. Checking which pref we read can be dependent on a new preference which controls if all users share it or not.
The logging of the pref changing should be suppressed/silent as we do other prefs, no need to echo that undoubtedly spammy pref where the user is reading.