Hello,
I'm designing a text field where the user can position a cursor in a middle of a text field, and select chunks of text to copy or overwrite the selected text.
One of my concerns with my plans is rendering the highlighted text. A solution I thought of is having 3 instanced sf::Text (One Text contains the text before the highlight, the second contains the highlighted text with inverted colors, and the third is the text after the highlighted part). Then I'll was thinking about drawing rectangles (one for each selected line) to represent the highlighted part.
This method sounds slower than it needs to be, and it seems strange to pass characters from one Text instance to another whenever the user is dragging the mouse. I was curious if there was a better way of doing this. Does this seem to be the right approach?