Patch for SC_MARK_BAR to have a minimum width

35 views
Skip to first unread message

Mitchell

unread,
Apr 8, 2025, 12:22:53 PMApr 8
to scintilla-interest
Hi Neil,

I like to use a thin margin for markers in conjunction with SC_MARK_LEFTRECT. If I enable change history, the change history markers are drawn a single pixel in width. I’d like to propose a minimum width: 4 pixels (2 for the left and right foreground border, and 2 for the background fill). I know I can redefine the change history markers, but I think SC_MARK_BAR has benefits for wrapped lines and stuff that SC_MARK_LEFTRECT does not have.

src/LineMarker.cxx:
```
case MarkerSymbol::Bar: {
PRectangle rcBar = rcWhole;
- const XYPOSITION widthBar = std::floor(rcWhole.Width() / 3.0);
+ const XYPOSITION widthBar = std::max(std::floor(rcWhole.Width() / 3.0), 4.0);
rcBar.left = centreX - std::floor(widthBar / 2.0);
rcBar.right = rcBar.left + widthBar;
```

Cheers,
Mitchell

Neil Hodgson

unread,
Apr 9, 2025, 6:40:37 PMApr 9
to Scintilla mailing list
Hi Mitchell,

> I like to use a thin margin for markers in conjunction with SC_MARK_LEFTRECT. If I enable change history, the change history markers are drawn a single pixel in width. I’d like to propose a minimum width: 4 pixels (2 for the left and right foreground border, and 2 for the background fill).

2 and 3 pixel wide bars seem reasonable to me and are used by other applications. 2 pixel wide bars don't have space for any background fill but just showing the frame colour is a fine decay path.

Even 1 pixel isn't dreadful if you place another light-coloured margin to the left (like line numbers). On low-resolution (800x600) screens it's fairly clear.

Some tweaks to the size could be made like using ceil instead of floor on the width but requiring it to always be at least 4 pixels wide seems limiting to me.

Neil

Mitchell

unread,
Apr 9, 2025, 6:51:37 PMApr 9
to scintilla...@googlegroups.com
Hi Neil,
I felt like 4 pixels is the minimum that allows a visual distinction between foreground and background. That said, I’ll take anything more than the current 1 pixel minimum. I’m on a Retina display and 1 pixel is not pleasant, no matter what margin it’s next to.

Cheers,
Mitchell

Neil Hodgson

unread,
Apr 9, 2025, 6:59:52 PMApr 9
to Scintilla mailing list
Mitchell:

> I felt like 4 pixels is the minimum that allows a visual distinction between foreground and background. That said, I’ll take anything more than the current 1 pixel minimum. I’m on a Retina display and 1 pixel is not pleasant, no matter what margin it’s next to.

How wide is your margin and can the change marker be moved onto a different margin?

Neil

Mitchell

unread,
Apr 9, 2025, 7:16:50 PMApr 9
to scintilla...@googlegroups.com
Hi Neil,
My symbol margin is 4 pixels wide and in-between a line number margin to the left and fold marker margin to the right. Both of those margins are wider. Since the symbol margin is its own margin, I wouldn’t move it to another margin.

Cheers,
Mitchell

Neil Hodgson

unread,
Apr 17, 2025, 7:44:03 PMApr 17
to scintilla-interest
Committed a change that uses ceil instead of floor for the width calculation. This will produce a bar width of 2 for a 4-pixel wide margin which still leaves a pixel of space either side.

I think that allowing thin bar markers is valuable with even single pixel wide bars being useful on low resolution screens although 2 pixels is better and 4 or more is great when there is enough space.

Further changes here could be handled by a new marker type but that would depend on more demand and consensus on the appearance.


Neil

Mitchell

unread,
Apr 19, 2025, 11:11:52 AMApr 19
to scintilla...@googlegroups.com
Hi Neil,

> On Apr 17, 2025, at 7:44 PM, Neil Hodgson <nyama...@gmail.com> wrote:
>
> Committed a change that uses ceil instead of floor for the width calculation. This will produce a bar width of 2 for a 4-pixel wide margin which still leaves a pixel of space either side.
>
> I think that allowing thin bar markers is valuable with even single pixel wide bars being useful on low resolution screens although 2 pixels is better and 4 or more is great when there is enough space.

Thanks. I’ll take anything more than 1 :)

Cheers,
Mitchell
Reply all
Reply to author
Forward
0 new messages