Support for setting stroke colour and width of background shapes in TextExt#497
Support for setting stroke colour and width of background shapes in TextExt#497neilccbrown wants to merge 1 commit intoFXMisc:masterfrom
Conversation
…idth for background shapes in TextExt. Allows you to use stroke as a highlight for some text, instead of or in addition to background colour. The main limitation is noted in the docs: adjacent segments with different styles will get their strokes painted separately.
|
What problem is this PR trying to solve? "support for highlighting" ? |
|
The problem was "the editor doesn't support drawing a border around particular text segments". I was porting an interface which used background colour and a stroked border around the region to highlight search results in the editor. TextExt lacked support for the stroke aspect and I couldn't see a work-around from outside the library, so I added it. I know it's not a desperately lacking feature but I thought I would offer the code, to see if you felt enough other people would have similar use cases. |
|
Ah, sorry -- didn't spot there was already a request for it. Not sure which thread to point this out, but there is already an issue with adjacent segments with different styles and solid backgrounds: a faint sliver of the main editor background colour is visible between adjacent segments with different styles but the same background colour (example below). So I figured it wasn't adding a new restriction, it's just more prominent when you're drawing a stroke. |
No worries! It happens.
Yeah. I think I noted the same thing when the feature was first introduced. However, because it was not super noticeable, nothing else was done. Let's move further discussion to the issue, not this PR. |
|
@twistedsquare Would you like to re-implement this again after I merge #558? The "adjacent segments" issue raised earlier is addressed in that PR. |
|
Closing since #560 added this support. |

I wonder if you're interested in adding this feature. It allows you to use stroke as a highlight for some text, instead of or in addition to background colour. The main limitation is noted in the docs: adjacent segments with different styles will get their strokes painted separately. That will make it less useful for some use cases, but if you just have a fairly plain text editor and want to add support for highlighting e.g. find results by drawing around them instead of using a background colour, it's useful.