Buffer.layout_cursor reports incorrectly on visual line breaks
CoralynnMay opened this issue · comments
For my use case I have decided, it doesn't make too much sense to use the editor struct, so I am using Buffer directly, and attempting to render a cursor to the screen. To do so I am calling layout_cursor, the problem being that on visual line breaks, buffer.layout_cursor
seems to fail to get the position and instead uses its fallback value, which is the start of the first line, instead of the start of the current visual line the cursor should be on. In this picture my current cursor position in the string is 23 which should be the start of the second visual line. If I increment the cursor index, it moves past the first character and starts positioning correctly again. I will try to take a crack at fixing this, and submitting a pull request, but in the event that someone is able to get to it before me, or for whatever reason I am unable to, I am submitting this, so it is known.
Does #211 help with this?
It is close to solving it, the cursor no longer defaults to the first line, but it still never makes it to the beginning of the second, though this is more fixable from my end. Thank you.
After some reevaluation, that pull request does fix it. The problem was a misunderstanding on my end on how Affinity works, I thought Affinity::Before would place the cursor before the glyph, and I'm not entirely sure how it is meant to be read, but I am thinking about it in the case of Affinity::After being place the glyph after the cursor. I think the Affinity wording is a bit unclear, but that is another issue and I now mostly understand what was intended.