Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repl: Support cross-session history #301

Merged
merged 1 commit into from
Mar 3, 2021

Conversation

xTVaser
Copy link
Member

@xTVaser xTVaser commented Mar 3, 2021

Linenoise had all the tools already to support this, the problem (and i could very well have solved it in a less than ideal way) is that the history is stored in a static vector. Being as we have to interact with the history in different points of the app (ie, load the history on startup / save it on exit / etc) these are all in different files, and when doing so the history would be empty.

Wrapping everything to have a single linenoise include, "solves" this problem, and history now works as expected.

It will save a .opengoal.repl.history file in your (linux) $HOME or (windows) $USERPROFILE directory.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 616358995

  • 3 of 24 (12.5%) changed or added relevant lines in 5 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.03%) to 69.051%

Changes Missing Coverage Covered Lines Changed/Added Lines %
goalc/compiler/compilation/CompilerControl.cpp 0 1 0.0%
goalc/main.cpp 0 1 0.0%
common/goos/Reader.cpp 1 3 33.33%
common/util/FileUtil.cpp 0 3 0.0%
common/goos/ReplHistory.cpp 2 16 12.5%
Files with Coverage Reduction New Missed Lines %
goalc/compiler/compilation/CompilerControl.cpp 1 48.4%
Totals Coverage Status
Change from base Build 615022921: -0.03%
Covered Lines: 30948
Relevant Lines: 44819

💛 - Coveralls

@water111
Copy link
Collaborator

water111 commented Mar 3, 2021

This is awesome, it makes such a difference to have the history saved.

The static history is really annoying, but I think your wrapper is a good solution.

@water111 water111 merged commit 2eca9ab into open-goal:master Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants