Flowless icon indicating copy to clipboard operation
Flowless copied to clipboard

Added refreshCells method

Open Jugen opened this issue 5 months ago • 5 comments

This adds the ability to refresh a Cell without updating it's item. This is needed in situations where the context the item is in changes the way it is displayed, without the item itself changing.

Jugen avatar Aug 13 '25 14:08 Jugen

The changes seem fine, but I have to say that I don't understand what situation you are tackling with this one. The index is needed only when we create them item isn't it ? And if that is not the case, normally the update on the LiveList should change the item itself (as shown by the UT for the LiveList).

Could you give a case where this would be broken?

Symeon94 avatar Aug 13 '25 14:08 Symeon94

I'm thinking of the following use case in RichTextFX when using setVisibleOnlyStyler:

Say you have a code editor and for comment blocks you have one colour and for JavaDoc you have another. When the developer changes the first line of the comment block to a JavaDoc then that line will automatically get restyled as it has changed. However the following lines of the comment will not be restyled unless a change of some sort occurs on them. There are two options here:

  1. Change the styling on the succeeding lines with something like codeArea.setStyle( p, List.of("JavaDoc") ), or
  2. Invoke a new public method codeArea.refreshParagraph( p ) which will call virtualFlow.refreshCell( p ) here.

In both cases above the visible only styler will be invoked and which you use is dependent on your circumstances. If for example your document has imbedded styling that you don't want to mess with then the 2nd option is available.

Jugen avatar Aug 13 '25 15:08 Jugen

Ok. My only comment (but maybe that will come with your changes in RichTextFX) is that maybe we should test via a UT that it does refresh the paragraph with the appropriate index number (for instance, instead of modifying line i you replace two lines by an open group comment /* which should change style to all following paragraph but changing their index at the same time).

Aside from this little proposal, your in better position than me to assess the validity of your change (I confess that I have not touch my style code for a few weeks, I'm waiting for your change to fix the style update issue).

Symeon94 avatar Aug 13 '25 17:08 Symeon94

Added another UT, if you think there are other cases that should be checked please let me know.

Jugen avatar Aug 15 '25 14:08 Jugen

Thanks for taking the time to do that. I listed them previously:

  • fromItem == toItem
  • fromItem > toItem
  • min > start
  • max < end
  • min == start
  • max == end
  • min < start
  • max > end

Symeon94 avatar Aug 15 '25 14:08 Symeon94