k9s icon indicating copy to clipboard operation
k9s copied to clipboard

History forward truncate

Open uozalp opened this issue 6 months ago • 0 comments

This pull request introduces enhancements to the History functionality in the internal/model package, focusing on enforcing a history limit, handling forward history truncation, and updating test cases to reflect these changes.

Updates to History functionality:

  • internal/model/history.go: Added logic to truncate forward history when a new command is pushed and the active command index is not at the end. Enforced a history limit by removing the oldest entry when the limit is exceeded.

Updates to test cases:

  • internal/model/history_test.go: Updated TestHistory to reflect the new behavior of enforcing the history limit, ensuring the oldest command is removed when the limit is exceeded.
  • internal/model/history_test.go: Updated TestHistoryDups to verify the updated behavior of the Push method, ensuring commands are correctly added while respecting the history limit.

GitHub issue: https://github.com/derailed/k9s/issues/3406

uozalp avatar Jun 19 '25 12:06 uozalp