Error() should word-wrap error messages, not break them in the middle of a word #1197
Open
Description
opened on Mar 26, 2017
From a comment by @james-d-mitchell on issue #1195:
Error, IsomorphismTransformationMonoid: usage, the argument must be a semigroup w
ith a multiplicative neutral element, at /Users/jdm/gap/lib/semitran.gi:360 call
ed from
<function "unknown">( <arguments> )
called from read-eval loop at *stdin*:2
type 'quit;' to quit to outer loop
brk>
Note how the word "with" is split after the "w". Here is an experiment I just did myself:
gap> Error("This is a very long text. Bla bla. More word. and it is present in one of the GAP root directories. and it is present in one of the GAP root directories");
Error, This is a very long text. Bla bla. More word. and it is present in one of the GAP root directori\
es. and it is present in one of the GAP root directories called from
not in any function at *stdin*:1
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk>
Note how this is not only breaking the message in the middle of a word (though at least with a \
indicating this), but it also breaks too late, and thus we end up with a very short text line between two longer ones (my guess is that GAP fails to take the string Error,
into account for the wrapping).
Both of these issues should be fixed. Here is a suggestion:
- First try to break at a whitespace;
- if that fails, fallback to breaking after non-letter/digit symbols;
- if that fails, fallback to breaking anywhere.
The wrapping indicator \
probably should only be shown in the last case.
Activity