Error message not being wrapped to the right length #4534
Open
Description
opened on Jun 4, 2021
This is happening for me in the master branch, on a Mac, with readline. It seems as if the output of Error
is being wrapped as if it didn't have the 7 characters of "Error,
" prepended to it:
$ bin/gap.sh -A -r
┌───────┐ GAP 4.12dev-909-gca1c659 built on 2021-06-04 10:33:48+0100
│ GAP │ https://www.gap-system.org
└───────┘ Architecture: x86_64-apple-darwin20.4.0-default64-kv8
Configuration: gmp 6.2.1, GASMAN, readline
Loading the library and packages ...
Packages: GAPDoc 1.dev, PrimGrp 3.4.1, SmallGrp 1.4.2, TransGrp 3.3
Try '??help' for help. See also '?copyright', '?cite' and '?authors'
gap> str := "this is an error message that going to be more than 80 character long although my terminal is only 80 characters wide";
"this is an error message that going to be more than 80 character long althoug\
h my terminal is only 80 characters wide"
gap> Length(str);
117
So the string itself wrapped as I would expect. But:
gap> Error(str);
Error, this is an error message that going to be more than 80 character long although\
my terminal is only 80 characters wide called from
not in any function at *stdin*:8
which is wrapped too long. It seems like this only affects the first line:
gap> str := "this is an error message that going to be more than 160 character long although my terminal is only 80 characters wide. I will do this by adding some nonsense to the end";
"this is an error message that going to be more than 160 character long althou\
gh my terminal is only 80 characters wide. I will do this by adding some nonse\
nse to the end"
gap> Length(str);
169
gap> Error(str);
Error, this is an error message that going to be more than 160 character long althoug\
h my terminal is only 80 characters wide. I will do this by adding some nonsen\
se to the end called from
not in any function at *stdin*:15
Also...
I'm not sure if this is exactly related, but if I add this example to a test file, then GAP happily accepts the correct behaviour. Contents of test file:
gap> str := "this is an error message that going to be more than 80 character long although my terminal is only 80 characters wide";;
gap> Length(str);
117
gap> Error(str);
Error, this is an error message that going to be more than 80 character long a\
lthough my terminal is only 80 characters wide
Result of test:
gap> Test("width.tst");
true
But if I break the error message then the suggested correct version looks very weird. Contents of test file (last word changed):
gap> str := "this is an error message that going to be more than 80 character long although my terminal is only 80 characters wide";;
gap> Length(str);
117
gap> Error(str);
Error, this is an error message that going to be more than 80 character long a\
lthough my terminal is only 80 characters tall
Result of test:
gap> Test("width.tst");
########> Diff in width.tst:4
# Input is:
Error(str);
# Expected output:
Error, this is an error message that going to be more than 80 charac\
ter long a\
lthough my terminal is only 80 characters tall
# But found:
Error, this is an error message that going to be more than 80 charac\
ter long a\
lthough my terminal is only 80 characters wide
########
false
(As always: maybe I am just doing something 'wrong'?)
Activity