[ZeroBrane Studio] Re: Change the tooltip formatting via interpreter? How to distribute interpreter & api?

  • From: Jan Drabner <jan@xxxxxxxxxxx>
  • To: zerobrane@xxxxxxxxxxxxx
  • Date: Wed, 29 Oct 2014 01:16:47 +0100



You need to attach an event handler to
editor:Connect(wxstc.wxEVT_STC_UPDATEUI, function(event) end) or
editor:Connect(wxstc.wxEVT_STC_STYLENEEDED, function(event) end)
events; at that time GetEndStyled() should return the correct value
needed for that function to work. Scintilla documentation has bit more
information, although the styling process is missing some details:
http://www.scintilla.org/ScintillaDoc.html#SCN_STYLENEEDED

I'd try to do this in three steps:

1. Take unmodified MarkupStyle and make it work for the text in
Reference panel. It will require several things: (1) attaching an
event handler (as described above); (2) calling MarkupStyle with the
right parameters, and (3) applying styles to your editor (see
StylesApplyToEditor). These styles will only be applied to markup in
comments.

2. Provide "fake" editor.spec.iscomment to make it work with markup
not in comments. You'd need to set editor.spec.iscomment[style] to
true for all the styles you want to style it on; the simplest way is
to set it to "true" for values 0..30 (at least for now).

3. Update markup symbols to make it work for your markup (similar to
what you've done).

Since UPDATEUI and STYLENEEDED can't be triggered directly, which
makes it a bit difficult to test, you can use
editor:Colorise(startpos, endpos) method to force restyling of a
fragment of the document.

Please keep me updated as I'm interested in getting this to work, but
don't have time to try myself at the moment. Thank you.
I think we have similar problem, then. 2. and 3. I could do easily as that is basic coding or Lua knowledge.

But 1. and all those events and Scintilla functions require in-depth Scintilla and wxWidgets knowledge, two things I do not have. Honestly, I would not know where to start. On what editor to call connect? What should be the content of the attached function? How do Scintilla events even work? What does GetEndStyled() even do? What are "right" parameters for MarkupStyled? etc... I am used to working with interface libraries like Qt, OpenFL/Flash, haxeui, Mono, librocket, all of which allow you to style via HTML/CSS. This kind of effort just to have something written bold honestly scares me away :)

While that sounds like an interesting thing to to toy around with, unfortunately I do not have the time to learn Scintilla/wxWidgets right now, especially for such a "small" gain. Having that permanent documentation window with full content control is already a HUGE help.
Having it styled would "only" be the icing on the cake ;)

Other related posts: