Open vspinu opened 5 years ago
That would be a very very nice addition to ESS .. working around this "horrible" emacs / comint misfeature.
That sounds good! Expansion should probably be done region by region (of contiguously elided lines) rather than line by line.
That's another idea. I thought to elide only very long lines as a minimum. That would already be enough to avoid accidental stalls. But a more complete solution would be to elide entire regions, indeed. For instance if one prints a very long data.frame we would show only beginning and end of it with everything else elided.
oh it seems you're talking about height collapsing/uncollapsing. I was talking about width collapsing. What I meant is that you could uncollapse all lines at once to see the full output:
#> 1. foobar [...]
#> 2. foobar [...]
#> 3. foobar [...]
Clicking on [...]
on any of these lines would expand all the contiguous lines that were also collapsed.
That said, height collapsing seems very useful too, I rarely want to print 1000s of rows.
I really also only thought of long lines. Please don't change the rest. R's own print() method do elide lines already and configurably via options(max.print = *)
ESS should not interfere with that, notably as Emacs has no big problem with buffer with 100'000's of lines.. It' really the columns where emacs sucks, and it's not in the case of many data frame columns, for base R it's really only if you have very long strings [nchar(.) !] which stalls emacs..
Not all print methods obey max.print
. I think it's reasonable to offer the option of folding lengthy outputs, and getting the full output would only be a click away. We could discuss what the default value should be (nil
, 100, 1000?). I don't see why we shouldn't provide this option in ESS, but I agree width-folding is most important.
I was talking about width collapsing.
I see. That's a good idea. There should probably be a cycling command which would (un)fold horizontally all ellipsis in the previous output. Another cycling command for vertical folding. We can do the same for clicks but I think the click should better unfold a single ellipsis.
This feature will not interfere with max.print or how R prints stuff, because it simply hides the output. The user can always unfold the fold at a later stage.
The idea is simple. Detect long lines in the process filter and elide them in the repl buffer such that the user can click on those to unhide and re-display would not be stalled.