zsh:glog: Require 152 columns for preview on right

This seem to make more sense especially for smaller terminals where the
previous formula would have resulted in both sides being unreadable.
This commit is contained in:
2022-10-15 18:56:26 +02:00
parent 896970de81
commit 87e3232780

View File

@@ -104,13 +104,11 @@ local -a fzf_args=(
)
# The preview-window should be placed differently depending on the dimensions of
# the terminal.
# 0.45 seems to be round about the ratio between cols and lines on my system.
# With that I get somewhat decent results with. This probably depends on the
# font and font-size of the terminal and needs to be changed potentially.
# the terminal. It should have at least 152 columns to fit a preview window on
# the right (12 hash, 50 subject, 80 patch, 10 git graph and fzf ui).
local -a tty_size
tty_size=(${=$(command stty size 2>/dev/null)})
if (( ! $? )) && (( $tty_size[2] * 0.4 > $tty_size[1] )); then
if (( ! $? )) && (( $tty_size[2] > 152 )); then
fzf_args+=(--preview-window=right)
else
fzf_args+=(--preview-window=down)