-
Notifications
You must be signed in to change notification settings - Fork 161
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
#4132 breaks indentation in displayed functions in certain cases #4486
Comments
I didn't realise SetPrintFormattingStatus on stdout ever did thisl. The formatting for line breaking and indentation are generally mixed together -- for example if I go back to GAP 4.10 (from 2019), or use current the current master, and use PrintTo to print functions to files, when I set So, I think the behaviour you observed, while I agree a useful behaviour, might have technically been "a bug" (certainly SetPrintFormattingStatus should either effect all function indenting, or none, regardless of how functions are printed). I do think generally "fixing" this would be good, and separating these two concepts. However, the problem is to decide what various options should do -- should we always indent functions regardless of formatting status for example? Or have another option to change the behaviour of that? |
Mhh, I see. I cannot think of a situation where I not would want indentation, so "always indenting functions regardless of formatting status" sounds sensible to me. (At least, removing the indentation if one does not need it is easy, while adding it is really hard :D ) But seeing that this might be more complicated than I expected: Could one simply increase the limit imposed on the number of columns in |
Huh, I am confused. @zickgraf says he bisected this to PR #4132. But as a matter of fact, with the
However, I can reproduce it in stable-4.11 -- which does not contain PR #4132. |
From reading your code section I assume that you have tried this in a REPL? My issue only occurs if the code is in a file. But your test is still interesting, it shows that before #4132 the problem was reversed (i.e., there was indentation when reading from a file, but not in a REPL). Here is an output of all combinations:
|
Ah indeed I was trying the REPL, oops. But this issue only happend for me with 4.11, it was fine in 4.10. Haven't tried file mode or older versions yet |
Just a comment, I believed PrintFormattingStatus always disabled indentation (I may be wrong). The reason the indentation appears in the REPL is because SetPrintFormattingStatus is being ignored. You can see this by printing something like |
I investigated this in #4496 . That PR probably isn't final. In particular, it would be a change to make |
GAP uses the characters The GAP kernel code that prints a function body was written at a time when nobody thought about A part of what happens can be seen in the function When the formatting status is I'm not sure how this should be changed. There is probably no general agreement which of
or
or, on a narrower screen
is the nicer or more useful output. I tend to prefer the first version (from which it is very easy to produce the more compact versions in an editor). One could also argue that the output of function bodies should depend on the formatting status (version 1 above if the status is |
I agree functions not being indented isn't something I want, but I always assumed that turning off I do agree that over time there seems to be confusion about exactly what < and > are for (at least, I've been confused about it!) |
Put the following code in a file
test.g
:and execute
gap test.g
.Observed behaviour
The output is:
Expected behaviour
The output should be:
Notes
SetPrintFormattingStatus( "*stdout*", false );
from working as expected #4132 (e62d395).SetPrintFormattingStatus( "*stdout*", false );
in my gaprc because I'd like my terminal to reflow long lines if I change the size of my terminal.SetPrintFormattingStatus
tofalse
without losing the indentation.The text was updated successfully, but these errors were encountered: