Skip to content

braille: only set viewport[0] to 0 when the string fits

Samuel Thibault requested to merge sthibaul/orca:caret_end_of_line3 into master

93dae3f2 ("Fix backspacing text") fixed showing the caret when it is exactly one character beyond a string that just fits the output width, by avoiding to reset viewport[0] to 0 as soon as the string fits the output width, but rather when the cursor fits the output width.

But this has the unwanted effect of doing this also when the line is prefixed with some context and the cursor is at the beginning of a line, which does not fit entirely in the output width. In that case the prefix eats a lot of the output, which would be fine if the line could fit in the remaining cells, but that happens also when it does not.

This commit combines both tests, to only reset viewport[0] to 0 when we know that the line completely fits (and thus it is not too cumbersome to have the context prefix eating some of the output), and that the caret will be visible.

Merge request reports