#935 More padding for calltips

Scintilla (358)

Calltips have 1px line border and 1px line padding. Then comes the text with 5px left inset and font-dependent top ascent. It gives the text a cca half-letter wide padding on the left and right and just a 1px one on the top and bottom. It makes me fee uneasy seeing the text so squashed agains the corners. MSVS leaves a little more free space around the border.

I tried to increase the padding from 1:1 to 3:6 (W:H) and it showed quite pleasing look, what do you think? I attached a screenshot showing original and padded sample. I left the padding constants at the top of CallTip.cxx but if you feel that having it configurable is not an overkill, I can implement also messages to get and set it including SciTE properties.


  • Ferdinand Prantl

    Patch that adds more calltip padding. Diff against 3.1.0 and the modified CallTip.cxx too.

  • Neil Hodgson

    Neil Hodgson - 2012-05-07
    • assigned_to: nobody --> nyamatongwe
    • priority: 5 --> 3
  • Neil Hodgson

    Neil Hodgson - 2012-05-07

    Its more common for calltips to be a single line which makes the 3x6 change appear far too padded. I don't consider it better even for the attached example images.

  • Ferdinand Prantl

    Comparison of the tooltip padding with MSVS.

  • Ferdinand Prantl

    Second version of the patch fixing 1px bottom line not cleared.

  • Ferdinand Prantl

    I admit that a single-line box doesn't look so cramped as a multiline one but the feeling from the narrowed layout is still there. I attached a comparison with MSVS which gives tooltips a gratious border space making them more pleasing.

    If you wanted to recosidered it I'm willing to make it configurable. And if it helped, also with the rounded rectangle and gradient ;-)

  • Ferdinand Prantl

    Third version - more padding, rounded rectangle (single border color), gradient fill.

  • Ferdinand Prantl

    I added the rounded rectangle (using just the darker border color) and gradent fill from bottom to top, mimicing MSVS. Configurability just internally by properties of the CallTip class; no SCI_ messages (yet?):

    int paddingX = 3;
    int paddingY = 6;
    bool rounded = true;
    bool gradient = true;

    Computing colours and filling multiple rectangles by FillRect does not create smooth transition; probably the GetNearestColor makes it too discrete. Using GradientFill is smooth for the price of linking msimg32.lib.

    I test it with these colours:


    What do you think?

  • Neil Hodgson

    Neil Hodgson - 2012-05-19

    Achieving gradient roundrects on other platforms would require much work. The implementation in PlatWin is also overly specific as it only works for one gradient direction and only for roundrects. While I might have accepted adding some padding parameters, it looks like you want something much more customized which would be better maintained outside core Scintilla.

  • Ferdinand Prantl

    I intentionally coded the roundrect and gradient as a proof of concept - in one way without configuration not to spend too much time; initially to see how it would look like. Configurability could've beed added if it were acceptable.

    While the roundrect alone is quite nice I feel a little uneasy about the gradient; the colour transition can be felt like making the tooltip separation from the code weaker. Apparently you're not thrilled either.

    So, getting back to the original topic. If you should accept padding parameters, how would you think that they would look like? SCI_ messages?

  • Marko Njezic

    Marko Njezic - 2012-05-19

    There is actually no need for more padding.

    Scintilla uses 5 pixels for horizontal padding, while Windows uses 6, so there's no big difference here. Besides, adding more horizontal padding by your patch will cause calltip to be misaligned, because you added those pixels separately instead of changing the value of insetX.

    Only big difference is in vertical text placement. Scintilla purposely subtracts internal font leading from font ascent in order to eliminate character accents, so that the text is tightly fitted. But, there's a catch. Internal font leading calculation is only implemented on Windows, while on every other platform (GTK, Cocoa, QT) a zero is returned. This results in calltips being tightly fitted only on Windows, while on every other platform there is quite enough vertical space already and there's no need for more. With that in mind, at best there should be an option to control whether internal leading is subtracted from ascent, which will allow container application to choose if tight fit is desired or not.

    As far as rounded rectangle is concerned, I took a very brief look at your patch and noticed that you did not make the underlying calltip window round. Because window corners are not made transparent, calltips will look ugly if they go outside editor boundary and overlap with desktop for example.

  • Neil Hodgson

    Neil Hodgson - 2012-05-20

    It seems you are heading towards a small documentation viewer rather than call tips. Calltips are small and simple so could be reasonably included in Scintilla. For documentation, additional features may be wanted such as multiple styles, hyperlinks (with return button) and a scroll bar when the documentation gets too large. This is all great functionality but its a large enough project that it won't fit into Scintilla's scope. It would also be reasonable for there to be multiple implementations.

    I'd much rather include in Scintilla just the hooks needed for other people to build their own documentation viewers. Maybe there needs to be some more events so the window can move when Scintilla moves or scrolls or that the normal key bindings (say for up and down arrows) can be diverted while a viewer is shown.

  • Neil Hodgson

    Neil Hodgson - 2012-05-20

    Gradients had their peak of popularity about 5 years ago and have diminished since then with flatter designs such as Metro looking like the future on Windows. Heavy gradients will look almost as old-fashioned as the overdone 3D appearance popular in the early '90s.

    It would be reasonable to add some gradient capability to the cross-platform graphics layer, but I don't think it would be used much.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks