notepad-plus-plus icon indicating copy to clipboard operation
notepad-plus-plus copied to clipboard

FR: Allow specifying padding above/below folded code horizontal indicator lines

Open Gitoffthelawn opened this issue 2 years ago • 8 comments

Description of the Issue

When lines of code are folded within the editor, a 1px horizontal line appears. Please allow specifying the number of pixels of padding to add above and below those horizontal lines. Ideally, the values (above/below) will be independent.

Steps to Reproduce the Issue

  1. Enable a dark theme in Notepad++
  2. Write code in any language that has collapsible blocks, such as C, C++, or C#
  3. Collapse a block
  4. Notice the lack of vertical spacing between the horizontal fold line and the code

Behavior

Not a bug, but would be a nice improvement. I showed a friend Notepad++, and it was the first thing they wanted to change.

Debug Information

Notepad++ v8.4.8 (32-bit) Admin mode : OFF Local Conf mode : ON Cloud Config : OFF OS Name : Windows

Gitoffthelawn avatar Jan 03 '23 07:01 Gitoffthelawn

Are you suggesting that when lines are folded, the height of lines around the fold point actually changes?

My suggestion might be to allow Notepad++ users to configure these Scintilla settings instead:

  • https://www.scintilla.org/ScintillaDoc.html#SCI_SETEXTRAASCENT
  • https://www.scintilla.org/ScintillaDoc.html#SCI_SETEXTRADESCENT

More info on those may be found HERE.

alankilborn avatar Jan 03 '23 11:01 alankilborn

Are you suggesting that when lines are folded, the height of lines around the fold point actually changes?

Close, but not quite... instead of changing the height of the line itself, change the height of the padding above and below it (to use CSS terminology).

For example, keep the horizontal line as 1px, but add 1px above it, and 2px below it (with each numeric value being user-definable). Allowing the user to adjust the thickness of the horizontal line itself (from 1px) would be a nice additional touch, but I wasn't specifically requesting that nicety.

Gitoffthelawn avatar Jan 04 '23 08:01 Gitoffthelawn

Such control would have to be allowable in Scintilla. I didn't specifically do the research, but from memory I don't recall such control being available.

alankilborn avatar Jan 04 '23 12:01 alankilborn

Such control would have to be allowable in Scintilla. I didn't specifically do the research, but from memory I don't recall such control being available.

Like you, I also am not currently familiar enough with Scintilla to know whether or not this is possible. I'm also not familiar enough with the Notepad++ codebase to know whether or not it is relying 100% on Scintilla for the code folding functionality and displaying the horizontal fold indicator line.

Solely to mention another possible implementation, the horizontal fold line could hypothetically be changed from a single 1px line to a 3-5px line consisting of a gradient that makes it appear like a 1px line with padding. In other words, simply display a thicker line, but using colours that blend into the background so that it looks like a thin line with padding above and below it.

For example, let's say you're currently using a Notepad++ theme that makes the background rgb(20,20,20) and the horizontal fold line rgb(190,190,190). Instead of drawing a 1px horizontal line of rgb(190,190,190), Notepad++ could (hypothetically) draw a 3px horizontal bar with the top 1px of that bar being rgb(20,20,20), the middle 1px of that bar being rgb(190,190,190), and the bottom 1px of that bar being rgb(20,20,20). This would effectively simulate 1px of padding above and below the horizontal fold line.

Gitoffthelawn avatar Jan 05 '23 09:01 Gitoffthelawn

Such control would have to be allowable in Scintilla.

It is.

SC_ELEMENT_* Value Translucent? Active Base Description
... ... ... ... ... ...
SC_ELEMENT_HIDDEN_LINE 81 Translucent All Colour of line drawn to show there are lines hidden at that point

https://www.scintilla.org/ScintillaDoc.html#ElementColours

rdipardo avatar Jan 05 '23 11:01 rdipardo

I don't see how something like the color capability of SC_ELEMENT_HIDDEN_LINE would achieve "keep the horizontal line as 1px, but add 1px above it, and 2px below it (with each numeric value being user-definable)", but hey, software can do amazing things.

alankilborn avatar Jan 05 '23 12:01 alankilborn

Uniform display line height is a strong invariant in Scintilla. It would take significant work to allow each line to have a separately defined height and this would decrease performance. If anyone wants to implement this feature as an option then it could be included.

A whole blank 'annotation' line can be added after any fold with https://www.scintilla.org/ScintillaDoc.html#SCI_ANNOTATIONSETTEXT but that would be quite chunky.

nyamatongwe avatar Jan 06 '23 22:01 nyamatongwe

Uniform display line height is a strong invariant in Scintilla. It would take significant work to allow each line to have a separately defined height and this would decrease performance.

@Gitoffthelawn In case you don't know, the comment I quoted was from the author of Scintilla. So, realistically, I don't see your feature request for N++ ever happening

alankilborn avatar Jan 06 '23 23:01 alankilborn