Skip to content

Commit

Permalink
Set semantic cell type for OSC 133 escape sequences.
Browse files Browse the repository at this point in the history
Co-authored-by: jean-philippe martel <jpmartel98@gmail.com>
  • Loading branch information
bennetbo and Kampouse committed Sep 13, 2024
1 parent c3eefc5 commit 9038975
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions alacritty_terminal/src/term/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ impl Cell {
pub fn hyperlink(&self) -> Option<Hyperlink> {
self.extra.as_ref()?.hyperlink.clone()
}

#[inline]
pub fn cell_type(&self) -> Option<Osc133CellType> {
self.extra.as_ref()?.cell_type.clone()
}
}

impl GridCell for Cell {
Expand Down
23 changes: 23 additions & 0 deletions alacritty_terminal/src/term/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2239,6 +2239,29 @@ impl<T: EventListener> Handler for Term<T> {

#[inline]
fn handle_osc133(&mut self, command: vte::ansi::Osc133Command) {
match command {
ansi::Osc133Command::FreshLine => {},
ansi::Osc133Command::FreshLineAndStartPrompt { .. } => {
self.grid.cursor.template.set_cell_type(cell::Osc133CellType::Prompt)
},
ansi::Osc133Command::MarkEndOfCommandWithFreshLine { .. } => {
self.grid.cursor.template.set_cell_type(cell::Osc133CellType::Prompt)
},
ansi::Osc133Command::StartPrompt(_) => {
self.grid.cursor.template.set_cell_type(cell::Osc133CellType::Prompt)
},
ansi::Osc133Command::MarkEndOfPromptAndStartOfInputUntilNextMarker => {
self.grid.cursor.template.set_cell_type(cell::Osc133CellType::Input)
},
ansi::Osc133Command::MarkEndOfPromptAndStartOfInputUntilEndOfLine => {
self.grid.cursor.template.set_cell_type(cell::Osc133CellType::Input)
},
ansi::Osc133Command::MarkEndOfInputAndStartOfOutput { .. } => {
self.grid.cursor.template.set_cell_type(cell::Osc133CellType::Output)
},
ansi::Osc133Command::CommandStatus { .. } => {},
}

self.event_proxy.send_event(Event::Osc133(command));
}
}
Expand Down

0 comments on commit 9038975

Please sign in to comment.