mirror of https://github.com/lapce/lapce.git
only update terminal update area
This commit is contained in:
parent
0ff6b4534f
commit
155ba654c0
|
@ -282,8 +282,22 @@ pub fn run(&mut self, receiver: Receiver<TerminalEvent>) -> Result<()> {
|
||||||
}
|
}
|
||||||
alacritty_terminal::event::Event::CursorBlinkingChange(_) => {}
|
alacritty_terminal::event::Event::CursorBlinkingChange(_) => {}
|
||||||
alacritty_terminal::event::Event::Wakeup => {
|
alacritty_terminal::event::Event::Wakeup => {
|
||||||
|
let mut cells = Vec::new();
|
||||||
|
for cell in self.term.grid().display_iter() {
|
||||||
|
let c = cell.cell.c;
|
||||||
|
if c != ' '
|
||||||
|
&& c != '\t'
|
||||||
|
&& cell.bg
|
||||||
|
== ansi::Color::Named(
|
||||||
|
ansi::NamedColor::Background,
|
||||||
|
)
|
||||||
|
{
|
||||||
|
cells.push((cell.point.clone(), cell.cell.clone()));
|
||||||
|
}
|
||||||
|
}
|
||||||
let content = Arc::new(TerminalContent {
|
let content = Arc::new(TerminalContent {
|
||||||
grid: self.term.grid().clone(),
|
cells,
|
||||||
|
cursor_point: self.term.grid().cursor.point,
|
||||||
});
|
});
|
||||||
self.event_sink.submit_command(
|
self.event_sink.submit_command(
|
||||||
LAPCE_UI_COMMAND,
|
LAPCE_UI_COMMAND,
|
||||||
|
@ -573,7 +587,7 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, env: &Env) {
|
||||||
|
|
||||||
let terminal = data.terminal.terminals.get(&self.term_id).unwrap();
|
let terminal = data.terminal.terminals.get(&self.term_id).unwrap();
|
||||||
|
|
||||||
let cursor_point = &terminal.content.grid.cursor.point;
|
let cursor_point = &terminal.content.cursor_point;
|
||||||
let rect =
|
let rect =
|
||||||
Size::new(char_width, line_height)
|
Size::new(char_width, line_height)
|
||||||
.to_rect()
|
.to_rect()
|
||||||
|
@ -594,9 +608,9 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, env: &Env) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for cell in terminal.content.grid.display_iter() {
|
for (point, cell) in &terminal.content.cells {
|
||||||
let x = cell.point.column.0 as f64 * char_width;
|
let x = point.column.0 as f64 * char_width;
|
||||||
let y = cell.point.line.0 as f64 * line_height + y_shift;
|
let y = point.line.0 as f64 * line_height + y_shift;
|
||||||
let text_layout = ctx
|
let text_layout = ctx
|
||||||
.text()
|
.text()
|
||||||
.new_text_layout(cell.c.to_string())
|
.new_text_layout(cell.c.to_string())
|
||||||
|
@ -709,13 +723,15 @@ pub enum TerminalHostEvent {
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct TerminalContent {
|
pub struct TerminalContent {
|
||||||
grid: Grid<Cell>,
|
cells: Vec<(alacritty_terminal::index::Point, Cell)>,
|
||||||
|
cursor_point: alacritty_terminal::index::Point,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TerminalContent {
|
impl TerminalContent {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
grid: Grid::new(1, 1, 0),
|
cells: Vec::new(),
|
||||||
|
cursor_point: alacritty_terminal::index::Point::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue