show feedback when processing input and copying result
This commit is contained in:
parent
33016aa171
commit
9c1004d13b
|
@ -136,7 +136,8 @@ module Fingers::Commands
|
||||||
hinter: hinter,
|
hinter: hinter,
|
||||||
state: state,
|
state: state,
|
||||||
output: pane_printer,
|
output: pane_printer,
|
||||||
original_pane: target_pane
|
original_pane: target_pane,
|
||||||
|
tmux: tmux
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,14 @@ module Fingers
|
||||||
@state : State
|
@state : State
|
||||||
@output : Printer
|
@output : Printer
|
||||||
@original_pane : Tmux::Pane
|
@original_pane : Tmux::Pane
|
||||||
|
@tmux : Tmux
|
||||||
|
|
||||||
def initialize(
|
def initialize(
|
||||||
@hinter,
|
@hinter,
|
||||||
@output,
|
@output,
|
||||||
@original_pane,
|
@original_pane,
|
||||||
@state
|
@state,
|
||||||
|
@tmux
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -51,6 +53,8 @@ module Fingers
|
||||||
match: state.result,
|
match: state.result,
|
||||||
original_pane: original_pane
|
original_pane: original_pane
|
||||||
).run
|
).run
|
||||||
|
|
||||||
|
tmux.display_message("Copied: #{state.result}", 500) unless state.result.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
private def hide_cursor
|
private def hide_cursor
|
||||||
|
@ -67,6 +71,7 @@ module Fingers
|
||||||
match = hinter.lookup(state.input)
|
match = hinter.lookup(state.input)
|
||||||
|
|
||||||
handle_match(match) if match
|
handle_match(match) if match
|
||||||
|
tmux.display_message(state.input, 300)
|
||||||
end
|
end
|
||||||
|
|
||||||
private def process_multimode
|
private def process_multimode
|
||||||
|
@ -80,7 +85,7 @@ module Fingers
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private getter :output, :hinter, :original_pane, :state
|
private getter :output, :hinter, :original_pane, :state, :tmux
|
||||||
|
|
||||||
private def handle_match(match)
|
private def handle_match(match)
|
||||||
if state.multi_mode
|
if state.multi_mode
|
||||||
|
|
|
@ -279,8 +279,8 @@ class Tmux
|
||||||
socket
|
socket
|
||||||
end
|
end
|
||||||
|
|
||||||
def display_message(msg)
|
def display_message(msg, delay = 100)
|
||||||
exec("display-message \"#{msg}\"")
|
exec(Process.quote(["display-message", "-d", delay.to_s, msg]))
|
||||||
end
|
end
|
||||||
|
|
||||||
private def exec(cmd)
|
private def exec(cmd)
|
||||||
|
|
Loading…
Reference in New Issue