1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:08:12 +00:00

LibLine: Handle history across multiple concurrent sessions better

- Store history entries as (timestamp)::(entry)\n\n
- Merge the entries together when saving to avoid loss of history
  entries

To ideally make having two concurrently open shells
(or `js` repls or whatever) not overwrite each others' history entries.
This commit is contained in:
AnotherTest 2021-01-11 18:58:42 +03:30 committed by Andreas Kling
parent 711ced80c0
commit 510030971b
5 changed files with 88 additions and 18 deletions

View file

@ -269,7 +269,7 @@ int main(int argc, char** argv)
Optional<Debug::DebugSession::DebugDecision> decision;
if (command.is_empty() && !editor->history().is_empty()) {
command = editor->history().last();
command = editor->history().last().entry;
}
if (command == "cont") {
decision = Debug::DebugSession::DebugDecision::Continue;
@ -300,7 +300,7 @@ int main(int argc, char** argv)
if (success && !command.is_empty()) {
// Don't add repeated commands to history
if (editor->history().is_empty() || editor->history().last() != command)
if (editor->history().is_empty() || editor->history().last().entry != command)
editor->add_to_history(command);
}
if (!success) {