Page MenuHomePhabricator

Move template folding indicator to line number column
Open, Needs TriagePublicFeature

Description

In most code editors, the folding icon is located in the line number column. The benefits is that it is less distractive to users as it won't move as they type.

image.png (423×603 px, 42 KB)

To prevent ambiguity (e.g. in lines with multiple templates), we can restrict the indicator to be visible only on templates spanning multiple lines, and still make the keyboard shortcut work for most templates.

Given that we have not enabled the line number column on most pages, we may need to enable it first, if we decided to move on this.

Related Objects

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

My original idea was to leave the folding gutter for headings and tables. Below is an example:

Screen Shot 2024-06-12 at 12.24.31 PM.png (203×209 px, 10 KB)

However, I just realize that there is no conflict with additional gutters for templates spanning multiple lines.

For now, how about simply hiding the folding tooltip when typing?

For now, how about simply hiding the folding tooltip when typing?

In discussion with @MusikAnimal, we think that making the tooltip semi-transparent by default and fully visible on hover is a good idea, in the short term. It should be tracked in a separate task, though.

Hiding the tooltip or making semi-transparent sounds like a fine improvement. I'm leaning more towards hiding, because semi-transparent could look weird or still be distracting. No one wants to collapse the template while typing anyway, so it makes sense to use a keyup debouncer or whatever so that the tooltip only shows when the user stops typing. Maybe we should both hide until typing stops, and have it be semi-transparent until the user hovers over the tooltip. I say this because one might stop typing to read what you just wrote, and it'd be jarring to have the tooltip suddenly obstruct your view.

However, I just realize that there is no conflict with additional gutters for templates spanning multiple lines.

Yeah, if we could get it working for infoboxes etc. that'd be awesome! So we wouldn't show a fold toggle in the gutter for inline templates, right? I think that would be fine. I'd worry about the logic being too fragile… but I suppose for gutter vs. tooltip it's simply a matter of seeing if the first token is a template bracket and that there's a newline somewhere before the closing bracket.