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

Enable SaveAndRestoreHistory by default #4275

Merged
merged 1 commit into from
Feb 19, 2021

Conversation

fingolfin
Copy link
Member

@fingolfin fingolfin commented Feb 18, 2021

I think a lot of people are missing out of this; and it should be safe for most. If this turns out to be wrong (as in: we get lots of complaints from people where it broke), we can still go back to the old default.

But perhaps I am missing other reasons that speak against it? @frankluebeck might have some suggestions.

Should IMHO be added to release notes, and even to the "top tier" news, because while being trivial and minor, I think many people will benefit from this (so many people to whom I taught this option reacted like "whaaaat??? I wish I had known about this years ago).

I am also tempted to raise the default number of lines from 1000 to 10000...

Text for release notes

Save and restore input history by default

GAP has supported saving and restoring the interactive input history for a long time, but this feature was off by default. With this release, it is now on by default. That means that if you run GAP, enter some commands, then exit it, and start it again, you can reach the commands entered in the previous session by the usual means of accessing the command history, e.g. by pressing the up-arrow key. Should you prefer the old behaviour, you can get it back by setting the SaveAndRestoreHistory user preference to false. For example, by entering these commands: SetUserPreference( "SaveAndRestoreHistory", false ); WriteGapIniFile();

In addition, the default limit on how many lines are preserved was increased from 1000 to 10000. This can be adjusted via the HistoryMaxLines user preference.

@fingolfin fingolfin added the release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes label Feb 18, 2021
@ssiccha
Copy link
Contributor

ssiccha commented Feb 18, 2021

I'm in favor of this PR. I'd also go with 10000 lines instead of a 1000. :)

@FriedrichRober
Copy link
Contributor

I think this is a very good idea. This should make working with GAP for the user more convenient, since many people do not know how to activate history.

@ChrisJefferson
Copy link
Contributor

I'm in favour of this

@ChrisJefferson
Copy link
Contributor

I approve, I'd also approve raising the limit to 10,000

Copy link
Member

@frankluebeck frankluebeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comment here is essentially the same as for the colored prompts.

The history feature is most useful for relatively recent GAP input, so I doubt that keeping much more than 1000 lines in the history is of much use. But I have no strong opinion about what the best number is.

@fingolfin
Copy link
Member Author

I increased the default value for HistoryMaxLines to 1000, and added a suggestion for the release notes text; feel free to suggest improvements.

@RussWoodroofe
Copy link
Contributor

Is there a convenient way to suppress adding a particular line to the command history? Gap.app issues some commands from its GUI, most of which should probably not be added to the saved history.

@fingolfin
Copy link
Member Author

@RussWoodroofe hmm, I doubt it, but I am not sure (also, in general I know almost nothing about that interface Gap.app and xgap are using). I would suggest opening an issue requesting it; perhaps @frankluebeck has insights, but that's best discussed on such a new issue.

@fingolfin fingolfin merged commit b603a94 into gap-system:master Feb 19, 2021
@fingolfin fingolfin deleted the mh/SaveAndRestoreHistory branch February 19, 2021 13:05
@frankluebeck
Copy link
Member

@RussWoodroofe There is no generic hook for configuring the history. But it is implemented as simple GAP code. I guess you would need to overwrite the function AddHistory which is in lib/cmdledit.g.

@RussWoodroofe
Copy link
Contributor

@frankluebeck To complicating things, Gap.app loads gap without readline, so the less-tested code in cmdeditx.g is the relevant one. But I found a workaround that I think is reasonably clean: I replace LineEditKeyHandlers[1] with a short function that resets it back to CommandLineHistoryHandler. (So GAP skips all end-of-line processing for exactly one command line.) Thanks!

@olexandr-konovalov
Copy link
Member

Like this!

@fingolfin fingolfin changed the title Enable SaveAndRestoreHistory by default Enable SaveAndRestoreHistory by default Aug 17, 2022
@fingolfin fingolfin added kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: library and removed release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants