Merge branch 'main' into server-client

This commit is contained in:
denis 2021-01-24 10:51:52 +02:00
commit a6ccb753c2
3 changed files with 38 additions and 2 deletions

View file

@ -41,3 +41,19 @@ structopt = "0.3"
[profile.release]
lto = true
[package.metadata.deb]
depends = "$auto"
license-file = ["LICENSE.md", "4"]
assets = [
# TODO?
# ["assets/man/mosaic.1", "usr/share/man/man1/mosaic.1", "644"],
["target/release/mosaic", "usr/bin/mosaic", "755"],
["GOVERNANCE.md", "usr/share/doc/mosaic/GOVERNANCE.md", "644"],
["README.md", "usr/share/doc/mosaic/README", "644"],
["assets/layouts/*", "/usr/share/mosaic/layouts/", "644"],
["assets/plugins/*", "/usr/share/mosaic/plugins/", "644"],
["assets/completions/mosaic.bash", "usr/share/bash-completion/completions/mosaic.bash", "644"],
["assets/completions/mosaic.fish", "usr/share/fish/vendor_completions.d/mosaic.fish", "644"],
["assets/completions/_mosaic", "usr/share/zsh/vendor-completions/_mosaic", "644"],
]

View file

@ -143,8 +143,8 @@ pub struct Grid {
lines_below: Vec<Row>,
cursor: Cursor,
scroll_region: Option<(usize, usize)>,
width: usize,
height: usize,
pub width: usize,
pub height: usize,
}
impl Debug for Grid {

View file

@ -47,6 +47,7 @@ pub struct TerminalPane {
pub position_and_size_override: Option<PositionAndSize>,
pub cursor_key_mode: bool, // DECCKM - when set, cursor keys should send ANSI direction codes (eg. "OD") instead of the arrow keys (eg. "")
pending_styles: CharacterStyles,
clear_viewport_before_rendering: bool,
}
impl Pane for TerminalPane {
@ -187,6 +188,22 @@ impl Pane for TerminalPane {
let buffer_lines = &self.read_buffer_as_lines();
let display_cols = self.get_columns();
let mut character_styles = CharacterStyles::new();
if self.clear_viewport_before_rendering {
for line_index in 0..self.grid.height {
let x = self.get_x();
let y = self.get_y();
vte_output = format!(
"{}\u{1b}[{};{}H\u{1b}[m",
vte_output,
y + line_index + 1,
x + 1
); // goto row/col and reset styles
for _col_index in 0..self.grid.width {
vte_output.push(EMPTY_TERMINAL_CHARACTER.character);
}
}
self.clear_viewport_before_rendering = false;
}
for (row, line) in buffer_lines.iter().enumerate() {
let x = self.get_x();
let y = self.get_y();
@ -291,6 +308,7 @@ impl TerminalPane {
position_and_size,
position_and_size_override: None,
cursor_key_mode: false,
clear_viewport_before_rendering: false,
}
}
pub fn mark_for_rerender(&mut self) {
@ -496,6 +514,7 @@ impl vte::Perform for TerminalPane {
std::mem::swap(&mut self.grid, alternative_grid);
}
self.alternative_grid = None;
self.clear_viewport_before_rendering = true;
self.mark_for_rerender();
}
Some(&25) => {
@ -532,6 +551,7 @@ impl vte::Perform for TerminalPane {
let current_grid =
std::mem::replace(&mut self.grid, Grid::new(rows, columns));
self.alternative_grid = Some(current_grid);
self.clear_viewport_before_rendering = true;
}
Some(&1) => {
self.cursor_key_mode = true;