Skip to content

Commit

Permalink
Merge pull request #179 from a-kenji/smux-example
Browse files Browse the repository at this point in the history
examples: show cursor on focused pane in the smux example
  • Loading branch information
a-kenji authored Apr 21, 2024
2 parents 91abfec + a03ce28 commit 82c3905
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/smux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use tokio::{
};
use tracing::Level;
use tracing_subscriber::FmtSubscriber;
use tui_term::widget::PseudoTerminal;
use tui_term::widget::{Cursor, PseudoTerminal};

#[derive(Debug, Clone, Copy)]
struct Size {
Expand Down Expand Up @@ -68,18 +68,20 @@ async fn main() -> io::Result<()> {
let block = Block::default()
.borders(Borders::ALL)
.style(Style::default().add_modifier(Modifier::BOLD));
let mut cursor = Cursor::default();
let block = if Some(index) == active_pane {
block.style(
Style::default()
.add_modifier(Modifier::BOLD)
.fg(Color::LightMagenta),
)
} else {
cursor.hide();
block
};
let parser = pane.parser.read().unwrap();
let screen = parser.screen();
let pseudo_term = PseudoTerminal::new(screen).block(block);
let pseudo_term = PseudoTerminal::new(screen).block(block).cursor(cursor);
let pane_chunk = Rect {
x: chunks[0].x,
y: chunks[0].y + (index as u16 * pane_height), /* Adjust the y coordinate for
Expand Down

0 comments on commit 82c3905

Please sign in to comment.