mirror of
https://github.com/Morantron/tmux-fingers.git
synced 2026-09-10 07:26:32 -04:00
wip
This commit is contained in:
parent
c7e0d058e2
commit
595760d7a6
2
Makefile
2
Makefile
|
|
@ -5,7 +5,7 @@ shell: default
|
|||
docker run -it --rm -v $(shell pwd):/app fingers bash
|
||||
|
||||
dev: default
|
||||
docker run -it --rm -v $(shell pwd):/app fingers bash -c "/opt/use-tmux.sh 3.6a; FINGERS_LOG_PATH='/app/fingers.log' shards build; tmux -f spec/conf/dev.conf \; new-session \; split-window 'tail -f /root/.local/state/tmux-fingers/fingers.log' \; last-pane"
|
||||
docker run -it --rm -v $(shell pwd):/app fingers bash -c "/opt/use-tmux.sh float-border-offset; FINGERS_LOG_PATH='/app/fingers.log' shards build; tmux -f spec/conf/dev.conf \; new-session \; split-window 'tail -f /root/.local/state/tmux-fingers/fingers.log' \; last-pane"
|
||||
|
||||
test: default
|
||||
docker run -it --rm -v $(shell pwd):/app fingers bash -c "shards install && crystal spec"
|
||||
|
|
|
|||
|
|
@ -4,9 +4,13 @@ set -e
|
|||
if [[ -n "$CI_TMUX_VERSION" ]]; then
|
||||
VERSIONS=("$CI_TMUX_VERSION")
|
||||
else
|
||||
VERSIONS=("3.0a" "3.1c" "3.2a" "3.3a" "3.4" "3.5a" "3.6a" "3.7-rc" "master")
|
||||
#VERSIONS=("3.0a" "3.1c" "3.2a" "3.3a" "3.4" "3.5a" "3.6a" "master")
|
||||
VERSIONS=("float-border-offset")
|
||||
fi
|
||||
|
||||
# clone as bare repo
|
||||
git clone --bare https://github.com/daneofmanythings/tmux /opt/tmux-repo
|
||||
|
||||
mkdir -p /opt
|
||||
|
||||
pushd /tmp
|
||||
|
|
@ -16,10 +20,12 @@ pushd /tmp
|
|||
continue
|
||||
fi
|
||||
|
||||
echo "Downloading tmux version ${version}"
|
||||
git clone --depth 1 --branch "${version}" https://github.com/tmux/tmux /opt/tmux-${version}
|
||||
echo "Building tmux version ${version}"
|
||||
|
||||
git clone /opt/tmux-repo /opt/tmux-${version}
|
||||
|
||||
pushd "/opt/tmux-${version}"
|
||||
git checkout "${version}"
|
||||
sh autogen.sh
|
||||
./configure
|
||||
make
|
||||
|
|
|
|||
|
|
@ -172,24 +172,8 @@ module Fingers::Commands
|
|||
end
|
||||
|
||||
private def show_hints
|
||||
# It is very important to resize the window at this point to match the
|
||||
# dimensions of the target pane. Otherwise weird linejumping will occur
|
||||
# when we have wrapped lines.
|
||||
tmux.resize_window(
|
||||
fingers_window.window_id,
|
||||
target_pane.pane_width,
|
||||
target_pane.pane_height,
|
||||
) if needs_resize?
|
||||
|
||||
# Swapping panes with -Z flag causes some issues with rendering panes
|
||||
# with tabs or double width characters
|
||||
if target_pane.window_zoomed_flag
|
||||
tmux.swap_panes(fingers_window.pane_id, target_pane.pane_id)
|
||||
view.render
|
||||
else
|
||||
view.render
|
||||
tmux.swap_panes(fingers_window.pane_id, target_pane.pane_id)
|
||||
end
|
||||
fingers_pane
|
||||
view.render
|
||||
end
|
||||
|
||||
private def handle_input
|
||||
|
|
@ -241,7 +225,6 @@ module Fingers::Commands
|
|||
end
|
||||
|
||||
private def teardown
|
||||
tmux.swap_panes(fingers_pane_id, target_pane.pane_id)
|
||||
tmux.kill_pane(fingers_pane_id)
|
||||
|
||||
restore_last_pane
|
||||
|
|
@ -261,16 +244,16 @@ module Fingers::Commands
|
|||
@mode.not_nil!
|
||||
end
|
||||
|
||||
private getter fingers_window : Tmux::Window do
|
||||
tmux.create_window("[fingers]", "cat", 80, 24)
|
||||
private getter fingers_pane : Tmux::Pane do
|
||||
tmux.new_pane(target_pane.pane_left, target_pane.pane_top, target_pane.pane_width, target_pane.pane_height, "cat")
|
||||
end
|
||||
|
||||
private getter fingers_pane_id : String do
|
||||
fingers_window.pane_id
|
||||
fingers_pane.pane_id
|
||||
end
|
||||
|
||||
private getter pane_printer : PanePrinter do
|
||||
PanePrinter.new(fingers_window.pane_tty)
|
||||
PanePrinter.new(fingers_pane.pane_tty)
|
||||
end
|
||||
|
||||
private getter state : Fingers::State do
|
||||
|
|
|
|||
10
src/tmux.cr
10
src/tmux.cr
|
|
@ -67,6 +67,7 @@ class Tmux
|
|||
|
||||
property pane_id : String
|
||||
property window_id : String
|
||||
property pane_tty : String
|
||||
property pane_width : Int32
|
||||
property pane_height : Int32
|
||||
property pane_top : Int32
|
||||
|
|
@ -91,6 +92,7 @@ class Tmux
|
|||
PANE_FORMAT = build_tmux_format({
|
||||
pane_id: String,
|
||||
window_id: String,
|
||||
pane_tty: String,
|
||||
pane_width: Int32,
|
||||
pane_height: Int32,
|
||||
pane_left: Int32,
|
||||
|
|
@ -157,6 +159,14 @@ class Tmux
|
|||
end
|
||||
end
|
||||
|
||||
def new_pane(x, y, width, height, cmd) : Pane
|
||||
args = ["new-pane", "-B", "none", "-X", x.to_s, "-Y", y.to_s, "-x", width.to_s, "-y", height.to_s, "-F", PANE_FORMAT, "-P", cmd]
|
||||
|
||||
output = exec(Process.quote(args))
|
||||
|
||||
Pane.from_json(output)
|
||||
end
|
||||
|
||||
def find_pane_by_id(id) : Pane | Nil
|
||||
output = exec("display-message -t '#{id}' -F '#{PANE_FORMAT}' -p").chomp
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue