| [ Return to Bugs & Features | Roadmap 1.3 | SVN ⇄ GIT ]
STR #3159
Application: | FLTK Library |
Status: | 1 - Closed w/Resolution |
Priority: | 1 - Request for Enhancement, e.g. asking for a feature |
Scope: | 3 - Applies to all machines and operating systems |
Subsystem: | Core Library |
Summary: | multiple highlight on Fl_Text_Display |
Version: | 1.3-feature |
Created By: | superbem |
Assigned To: | matt |
Fix Version: | Will Not Fix |
Update Notification: | |
Trouble Report Files:
No files
Trouble Report Comments:
|
#1 | superbem 17:16 Nov 22, 2014 |
| How one can do multiple highlight on Fl_Text_Display?
I suggest: "Fl_Text_Buffer.H" on class FL_EXPORT Fl_Text_Selection a new field std::vector< std::vector <int> > ranges;
then on "Fl_Text_Buffer.cxx" int Fl_Text_Selection::includes(int pos) const { ++> if(selected()){for(int i=0;i<ranges.size();i++){ ++> if(pos >= ranges[i][0] && pos < ranges[i][1]) {return true;} } }; return (selected() && pos >= start() && pos < end() ); }
Thanks | |
|
#2 | AlbrechtS 15:16 Nov 23, 2014 |
| Thanks for your suggestion. However it is very unlikely that this will happen anytime soon, certainly not in FLTK 1.3, for several reasons:
(1) we don't use std::vector internally, but this could be implemented differently (so not a real problem)
(2) This would break the ABI (more important, but still doable)
(3) The suggestion is far from complete, so it involves lots of code (the highlighting, mouse handling, keyboard events, ...)
(4) Fl_Text_Display is a pretty complicated part of the FLTK code, and it is sometimes very time consuming (very slow reaction), because there is lots of text measurement involved. Multiple selections would make it even slower (see also your code proposal).
I'm sorry to say this, but the Fl_Text_Display widget is not a full-blown editor in its own. You can however derive your own class or extend it with character attributes, as the demo program test/editor.cxx shows with its syntax highlighting. Maybe this could help to achieve what you want. | |
|
#3 | superbem 19:33 Nov 23, 2014 |
| In Fl_Text_Display::Style_Table_Entry there isn't a background color to set highlight efect.
Instead a vector a void* would be enough, and a cast on a return bool function call if not null, instead that loops.
Then its up to the user to tune the function to be fast. | |
|
#4 | matt 12:40 Feb 02, 2019 |
| There are three ways to select text independently in FL_Text_Buffer. Check out the documentation for primary and secondary selections, and for Fl_Text_Selection:
https://www.fltk.org/doc-1.4/classFl__Text__Buffer.html#ae4bd251b42c7bcf47a1e549717569be2 | |
[ Return to Bugs & Features ]
|
| |