tmux: Use e prefix when comparing numbers

This commit is contained in:
2023-06-14 11:17:23 +02:00
parent 998c1c3fda
commit d4d29b0c64

View File

@@ -117,19 +117,17 @@ bind -T copy-mode-vi i send -X cancel
# scrolling when the respective line is visible. This mimics the behaviour of
# vim's C-y at the top of the file.
bind -T copy-mode-vi C-e \
if -F "#{>:#{scroll_position},0}" {
if -F "#{e|>:#{scroll_position},0}" {
send-keys -X scroll-down
if -F "#{>:#{copy_cursor_y},#{scroll_region_upper}}" {
if -F "#{e|>:#{copy_cursor_y},#{scroll_region_upper}}" {
send-keys -X cursor-up
}
}
# TODO: C-y bugs shortly after the start for a couple of lines. I have no idea
# why, but I think the problem lays in the first if, as nothing happens at all
bind -T copy-mode-vi C-y \
if -F "#{<:#{scroll_position},#{history_size}}" {
if -F "#{e|<:#{scroll_position},#{history_size}}" {
send-keys -X scroll-up
if -F "#{<:#{copy_cursor_y},#{scroll_region_lower}}" {
if -F "#{e|<:#{copy_cursor_y},#{scroll_region_lower}}" {
send-keys -X cursor-down
}
}
@@ -211,6 +209,8 @@ set -g mode-style 'bg=#{@accent_color},fg=#{@text_fg}'
#
# NOTE: `<` does string comparison with `strcmp()`. This means that the
# condition will break from a double digit major version (e.g. `10.0`) on.
# TODO: Use #{e|<|f:, but cut off trailing non-numbers and convert the result
# (i.e. 1.00 or 0.00) back into an int.
if -F "#{<:#{version},3.2}" {
set -g pane-border-style 'bg=default,fg=#{@ui_color}'
set -g pane-active-border-style 'bg=default,fg=#{@accent_color}'