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

Allow appending to the command line history #3077

Merged
merged 1 commit into from
Dec 18, 2018

Conversation

ChrisJefferson
Copy link
Contributor

Also, some minor cleanups to reading command line history, including correctly setting 'Pos' after the history has been read.

It is possible no-one other than me will care about this. I have been using this patch myself for a while, as I find attach read command line history to the end more useful, as I tend to read command line history because I want to access it!

Also, some minor cleanups to reading command line history,
including correctly setting 'Pos' after the history has been read.
@codecov
Copy link

codecov bot commented Dec 2, 2018

Codecov Report

Merging #3077 into master will decrease coverage by <.01%.
The diff coverage is 0%.

@@            Coverage Diff             @@
##           master    #3077      +/-   ##
==========================================
- Coverage   83.85%   83.85%   -0.01%     
==========================================
  Files         688      688              
  Lines      343238   343235       -3     
==========================================
- Hits       287818   287807      -11     
- Misses      55420    55428       +8
Impacted Files Coverage Δ
lib/cmdledit.g 24.32% <0%> (-0.64%) ⬇️
lib/record.gi 75.94% <0%> (-2.63%) ⬇️
src/vector.c 93.07% <0%> (-1.39%) ⬇️
lib/files.gd 74.28% <0%> (-0.37%) ⬇️
lib/record.gd 100% <0%> (ø) ⬆️
lib/string.gd 100% <0%> (ø) ⬆️
hpcgap/lib/hpc/stdtasks.g 72.18% <0%> (+0.4%) ⬆️
lib/string.gi 77.88% <0%> (+0.43%) ⬆️
lib/files.gi 68.04% <0%> (+1.92%) ⬆️

@fingolfin
Copy link
Member

I don't understand what difference this makes. Could you explain with an example?

@ChrisJefferson
Copy link
Contributor Author

Assume your current history is:

f(1);
g(1);

And you load the file:

x := 3;

Then the original code treats the read commands as if they were the oldest things typed:

x := 3;
f(1);
g(1);

And the new option treats the read commands as if they were the newest things typed:

f(1);
g(1);
x := 3;

In practice, the most important detail is that if your history is already full, then ReadCommandLineHistory(file) doesn't do anything, because it tries to put the history in the oldest position, but the history is already full. The new option will throw away existing history to store the stuff read from the file.

@ChrisJefferson ChrisJefferson added kind: new feature topic: library release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Dec 10, 2018
@ChrisJefferson ChrisJefferson merged commit 715320f into gap-system:master Dec 18, 2018
@ChrisJefferson ChrisJefferson deleted the readhistory branch January 20, 2019 13:22
@DominikBernhardt DominikBernhardt added release notes: added PRs introducing changes that have since been mentioned in the release notes 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 22, 2019
@olexandr-konovalov olexandr-konovalov added this to the GAP 4.11.0 milestone Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: new feature release notes: added PRs introducing changes that have since been mentioned in the release notes topic: library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants