Skip to content

Commit

Permalink
fix window pane capture (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmoulton authored Sep 1, 2024
1 parent b23e8a0 commit aabdd32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ fn windows_command(config: &Config, tmux: &Tmux) -> Result<()> {
.map(|s| s.to_string())
.collect();

if let Some(target_window) = get_single_selection(&windows, Preview::SessionPane, config, tmux)?
if let Some(target_window) = get_single_selection(&windows, Preview::WindowPane, config, tmux)?
{
if let Some((windex, _)) = target_window.split_once(' ') {
tmux.select_window(windex);
Expand Down
7 changes: 7 additions & 0 deletions src/picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ use crate::{

pub enum Preview {
SessionPane,
WindowPane,
None,
Directory,
}
Expand Down Expand Up @@ -277,6 +278,12 @@ impl<'a> Picker<'a> {
if let Some(item) = snapshot.get_matched_item(index as u32) {
let output = match self.preview {
Preview::SessionPane => self.tmux.capture_pane(item.data),
Preview::WindowPane => self.tmux.capture_pane(
item.data
.split_once(' ')
.map(|val| val.0)
.unwrap_or_default(),
),
Preview::Directory => process::Command::new("ls")
.args(["-1", item.data])
.output()
Expand Down

0 comments on commit aabdd32

Please sign in to comment.