Skip to content

Commit

Permalink
Fix an unexpected error during tab completion
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Dec 10, 2022
1 parent aed43ee commit dbce444
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions dev/gaptest.expect
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@ expect "gap> "
send -- "g!.S\t"
expect "ize"
send -- ";;\r"

# issue 5241
expect "gap> "
# this used to trigger an error
send -- "g.x.\t"
# ctrl-u to clear the input given so far
send -- "\025"
# just start a new line to verify we are not in a break loop
send -- "\r"
expect "gap> "
# this also used to trigger an error
send -- "g!.x.\t"
# ctrl-u to clear the input given so far
send -- "\025"
# just start a new line to verify we are not in a break loop
send -- "\r"
expect "gap> "

exit

4 changes: 2 additions & 2 deletions lib/cmdledit.g
Original file line number Diff line number Diff line change
Expand Up @@ -969,9 +969,9 @@ GAPInfo.CommandLineEditFunctions.Functions.Completion := function(l)
if Length(cmps) > 0 and cmps[1] in idbnd then
r := ValueGlobal(cmps[1]);
for j in [2..Length(cmps)] do
if not hasbang[j-1] and IsBound(r.(cmps[j])) then
if not hasbang[j-1] and IsRecord(r) and IsBound(r.(cmps[j])) then
r := r.(cmps[j]);
elif hasbang[j-1] and IsBound(r!.(cmps[j])) then
elif hasbang[j-1] and (IsRecord(r) or IsComponentObjectRep(r)) and IsBound(r!.(cmps[j])) then
r := r!.(cmps[j]);
else
r := fail;
Expand Down

0 comments on commit dbce444

Please sign in to comment.