diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 9692009e8be..49fa537304d 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -221,7 +221,13 @@ This section describes some noteworthy details on how certain features are imple ### Command History Retrieval -**TODO** +Let's consider the scenario where the user wants to retrieve the last command executed. The user can do this by +pressing the UP key on +the keyboard. + +The UP key press event is captured by the `CommandBox` class, which then +retrieves the last command from the `CommandHistory` Singleton object. + {{ newPage }} diff --git a/docs/diagrams/CommandHistorySequenceDiagram.puml b/docs/diagrams/CommandHistorySequenceDiagram.puml new file mode 100644 index 00000000000..79ff5e3036a --- /dev/null +++ b/docs/diagrams/CommandHistorySequenceDiagram.puml @@ -0,0 +1,32 @@ +@startuml +!include style.puml +skinparam ArrowFontStyle plain + +box Command History UI_COLOR_T2 +participant ":CommandBox" as Model UI_COLOR_T3 +participant ":CommandHistory" as ModelCH UI_COLOR_T3 +end box + +[-> Model : keyPress(e) +activate Model + +Model -> Model : handleKeyPressEvent(e) +Model -> Model : handleArrowKeyPress(e) +activate Model +Model -> ModelCH : getInstance() +activate ModelCH +ModelCH --> Model : +deactivate ModelCH + +Model -> ModelCH : getCommandHistory(direction) +activate ModelCH + +ModelCH --> Model : previousCommand +deactivate ModelCH + +Model -> Model : setText(previousCommand) + +[<-- Model +deactivate Model + +@enduml