FLTK logo

Re: [fltk.general] Re: Can I get Fl_Text_Editor/Display highlight_data styleBuffer as a pointer from a function?

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Re: Can I get Fl_Text_Editor/Display highlight_data styleBuffer as a pointer from a function? "anmol.... Sep 27, 2021  
  Hi Sanel.

Is there a way to dynamically change the modes ? Or even the scheme from lite to dark ?
For example, one may decide to load the file via a string. When this happens - the loadfile() code is not used and the styletable is not loaded. 
The ability to set the styletable (modes) and change schemes dynamically is useful. 

On Thursday, February 7, 2019 at 12:57:01 AM UTC+5:30 Sanel Zukan wrote:
> Does it parse the entire textbuffer on each modified callback?

Only modified parts.

> Also, I am interested in how the styletable is handled, so I'll
> definitely look into it Thanks!

Styletable is loaded and set when file extension is detected, based on
mode rules [1].

Modes are similar to Emacs modes - script files with custom keywords and
colors/faces for those keywords (eg. for c++ files [2]).

Faces are abstracted from color values (face is actually color + font +
font size) so creating new themes is fairly trivial. Here is example how
dark theme is defined [3].

[1] https://github.com/sanel/Fl_Highlight_Editor/blob/master/scheme/editor.ss#L157
[2] https://github.com/sanel/Fl_Highlight_Editor/blob/master/scheme/modes/c%2B%2B-mode.ss
[3] https://github.com/sanel/Fl_Highlight_Editor/blob/master/scheme/editor.ss#L223

Best,
Sanel

israel dahl <israe...@gmail.com> writes:
> On Sunday, February 3, 2019 at 10:53:51 AM UTC-6, Sanel Zukan wrote:
>>
>> You can also try with https://github.com/sanel/Fl_Highlight_Editor
>>
>> New languages can be added easily and built-in interpreter will compile
>> everything when object is loaded, so there will be minimal performance hit.
>>
>> Best,
>> Sanel
>>
>> Hi Sanel,
> I will check this out! Does it parse the entire textbuffer on each
> modified callback?
> I may make a secondary version of my text editor that uses yours and
> compare the two outputs. Also, I am interested in how the styletable is
> handled, so I'll definitely look into it Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups "fltk.general" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/65ef8422-4b75-4b75-924f-5628c0b386a5n%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.