Skip to content

Commit

Permalink
Do not store duplicate history entries
Browse files Browse the repository at this point in the history
  • Loading branch information
zickgraf committed Feb 6, 2023
1 parent fdc3aef commit a4b80e0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/cmdledit.g
Original file line number Diff line number Diff line change
Expand Up @@ -510,12 +510,14 @@ GAPInfo.CommandLineEditFunctions.Functions.AddHistory := function(l)
return [false, 1, i+1, 1];
fi;
hist := GAPInfo.History.Lines;
while Length(hist) >= max do
# overrun, throw oldest line away
Remove(hist, 1);
GAPInfo.History.Last := GAPInfo.History.Last - 1;
od;
Add(hist, l[3]);
if Last( hist ) <> l[3] then
while Length(hist) >= max do
# overrun, throw oldest line away
Remove(hist, 1);
GAPInfo.History.Last := GAPInfo.History.Last - 1;
od;
Add(hist, l[3]);
fi;
GAPInfo.History.Pos := Length(hist) + 1;
if i = 0 then
return [];
Expand Down

0 comments on commit a4b80e0

Please sign in to comment.