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

  • From: Paul K <paul@xxxxxxxxxxxxx>
  • To: "zerobrane@xxxxxxxxxxxxx" <zerobrane@xxxxxxxxxxxxx>
  • Date: Tue, 28 Oct 2014 16:01:43 -0700

Hi Jan,

> It does: nothing. What I changed is that I tried to remove everything that 
> had to do with comments (as I want to style the whole panel).

I haven't tested, but I suspect it won't work that way because
editor:GetEndStyled() doesn't return what you need for this function
to work.

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.

Paul.

Other related posts: