I am using a mono editor font (JetBrains-Regular) but the images are appearing on the top left of the screen. They do try to follow the cursor, but they begin at the top left corner and move less than a line space vertically or a character space horizontally.
EDIT:
I think the Godot get_ functions in TextEdit are having issues on macOS because they are def returning weird values (the get_line, get_column functions are really messed up and the line_space one is pretty bad as well).
This should work but it does not at all:
pos.y = (line - vscroll) * (fontsize.y + line_spacing) + 6
('6' is the #pixels between the top of the editor viewport and the first line)
After playing around with the cursor location formula in 'plugin.gd', I was able to get it working for a few font sizes:
this will work well for a size 14 font
pos.x = (column)(11.0/6.0) * (fontsize.x) - hscroll + 140
pos.y = (line - vscroll)(11.0/6.0) * (fontsize.y + line_spacing) + 28
for a size 16 font:
pos.x = (column)(9.0/5.0) * (fontsize.x) - hscroll + 140
pos.y = (line - vscroll)(9.0/5.0) * (fontsize.y + line_spacing) + 30
The ratios in those formulas I got by finding the slope between two points of error visually. IE, cursor on line 25, image at line 14 = (25,14); cursor on 15, image at line 9 = (15,9). Slope = (25-14)/(15-9) = 11/6. idk why that worked really, but it did for every font size I tried. So if you prefer another font size, you can just do that and then enter the ratio in the formula and it should work lol.
I am using a mono editor font (JetBrains-Regular) but the images are appearing on the top left of the screen. They do try to follow the cursor, but they begin at the top left corner and move less than a line space vertically or a character space horizontally.
EDIT:
I think the Godot get_ functions in TextEdit are having issues on macOS because they are def returning weird values (the get_line, get_column functions are really messed up and the line_space one is pretty bad as well).
This should work but it does not at all:
pos.y = (line - vscroll) * (fontsize.y + line_spacing) + 6
('6' is the #pixels between the top of the editor viewport and the first line)
After playing around with the cursor location formula in 'plugin.gd', I was able to get it working for a few font sizes:
this will work well for a size 14 font
pos.x = (column)(11.0/6.0) * (fontsize.x) - hscroll + 140
pos.y = (line - vscroll)(11.0/6.0) * (fontsize.y + line_spacing) + 28
for a size 16 font:
pos.x = (column)(9.0/5.0) * (fontsize.x) - hscroll + 140
pos.y = (line - vscroll)(9.0/5.0) * (fontsize.y + line_spacing) + 30
The ratios in those formulas I got by finding the slope between two points of error visually. IE, cursor on line 25, image at line 14 = (25,14); cursor on 15, image at line 9 = (15,9). Slope = (25-14)/(15-9) = 11/6. idk why that worked really, but it did for every font size I tried. So if you prefer another font size, you can just do that and then enter the ratio in the formula and it should work lol.