This PR fixes the issue by calculating the row position based on the terminal's column size. Inspired by #139.
wrong position of hint
Multibyte character handling was incorrect, so as a starship user thumbs always printed abnormaly.
(mentioned by #76)
This PR attempts a new way to insert the hint in the appropriate position, which renders each line just once.
So it works well on all the samples including samples/test1.
As in the comment, it tries to find the position of the hint inside the line:
This is because the executor returns as soon as the new window is created and does not block until the whole command in the parameter tmux capture-pane ~~ is executed.
Assume the active pane is small. There is an issue for each of the execution flow:
swap-pane - capture-pane and `thumbs: Active pane is captured in the bigger pane (created by new-window), so more lines including the lines that were not visible in the small pane are captured. This causes rendering issues on thumbs.
capture-pane and thumbs - swap-pane: thumbs screen is rendered on the bigger pane, and then moved to the smaller pane, which causes long lines to be trimmed.
This PR tries to enforce the execution flow of the former, by inserting sleep before capture-pane (although this isn't strict. please tell me a better idea)
The issue mentioned is fixed by the new render function.
Issue with this PR
If osc52 is enabled, tmux enters search mode with blank screen after thumbs selection, so you must press enter one more time. I have no idea why this issue occurs, but it has to do something with the new rendering function.
I should mention that I'm new to rust (literally my first writing in rust), so if there's any quirk in the style please let me know. Thanks.
Bug fix
There are several bugs that this PR addresses:
long line bug
This PR fixes the issue by calculating the row position based on the terminal's column size. Inspired by #139.
wrong position of hint
Multibyte character handling was incorrect, so as a starship user thumbs always printed abnormaly. (mentioned by #76)
This PR attempts a new way to insert the hint in the appropriate position, which renders each line just once. So it works well on all the samples including
samples/test1
.As in the comment, it tries to find the position of the hint inside the line:
race-condition in tmux-thumbs
There's a race condition between new-window command and swap-pane command. (also mentioned by #69 )
This is because the executor returns as soon as the new window is created and does not block until the whole command in the parameter
tmux capture-pane ~~
is executed.Assume the active pane is small. There is an issue for each of the execution flow:
swap-pane
-capture-pane
and `thumbs: Active pane is captured in the bigger pane (created by new-window), so more lines including the lines that were not visible in the small pane are captured. This causes rendering issues on thumbs.capture-pane
andthumbs
-swap-pane
: thumbs screen is rendered on the bigger pane, and then moved to the smaller pane, which causes long lines to be trimmed.This PR tries to enforce the execution flow of the former, by inserting
sleep
beforecapture-pane
(although this isn't strict. please tell me a better idea) The issue mentioned is fixed by the new render function.Issue with this PR
If osc52 is enabled, tmux enters search mode with blank screen after thumbs selection, so you must press enter one more time. I have no idea why this issue occurs, but it has to do something with the new rendering function.
I should mention that I'm new to rust (literally my first writing in rust), so if there's any quirk in the style please let me know. Thanks.