@b4n commented on this pull request.
> + if (sci_get_line_from_position(sci, pos_next) == line)
+ char_width = SSM(sci, SCI_POINTXFROMPOSITION, 0, pos_next) - x;
As I'm a sucker for weird corner cases, this actually does not work if line
wrapping is enabled and the caret is right before the wrap position (popup
would be anchored to the start of the next line).
Something like this works though:
```suggestion
/* if it's on the same Y (same line and not after wrapping), diff the X
*/
if (SSM(sci, SCI_POINTYFROMPOSITION, 0, pos_next) == y)
char_width = SSM(sci, SCI_POINTXFROMPOSITION, 0, pos_next) - x;
/* otherwise, if it's not at the end of the document, use the
character's width
* -- which would work in case above, but it feels slower (I didn't get
numbers) */
else if (pos_next > pos)
{
gint style = SSM(sci, SCI_GETSTYLEAT, 0, pos);
gchar *text = sci_get_contents_range(sci, pos, pos_next);
char_width = sci_text_width(sci, style, text);
g_free(text);
}
```
--
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/3316#pullrequestreview-1663599640
You are receiving this because you are subscribed to this thread.
Message ID: <geany/geany/pull/3316/review/[email protected]>