-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cursor placement with multi-column characters #94
Comments
(CC jtdaugherty/brick#61) |
My use-case for rendering a text box that overflows by scrolling requires me to work around this clever behavior. Basically I have to compute the opposite transformation and then use that when requesting a cursor position. I working around this feature with the following code: https://github.com/glguy/irc-core/blob/v2/src/Client/Image/Textbox.hs Even better than inverting the operation would be a setting to turn off this more clever behavior. |
This allows advanced applications to compute their own direct cursor placement by absolute column without having to invert the logical cursor computation. Fixes jtdaugherty#94
At some point
vty
started being smarter about multi-column characters and I didn't notice. Now I'm trying out adding multi-column character support tobrick
and I have encountered something interesting.brick
has to do layout of Vty images, and sometimes those images come with cursor placement requests. So we might have to lay out two images as follows:so that the final result would be
with the cursor placed on the
f
. The (currently broken) waybrick
figures out that the new cursor location should be on thef
is by adding theimageWidth
of"寬字"
to the requested cursor position(0,0)
to determine a new position. This approach works when all characters are single-column.But the problem is that the width returned by
imageWidth
is the physical width of the image (in display columns), but the position needed for cursor placement is in characters. So I end up getting4+0=4
rather than2+0=2
and my cursor is placed too far to the right.I don't know how to get this right with the current API. Am I missing something?
The text was updated successfully, but these errors were encountered: