aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2021-03-12 14:27:13 +0100
committerGitHub <noreply@github.com>2021-03-12 14:27:13 +0100
commitac358d913c452ad66bb4fe4f76627e119604ea3e (patch)
tree1fc3a4c522d07b012f2e26937b8da4b53f697944 /src
parentfix(layout): add tab bar to strider layout (diff)
downloadsl0ppij-ac358d913c452ad66bb4fe4f76627e119604ea3e.tar.gz
sl0ppij-ac358d913c452ad66bb4fe4f76627e119604ea3e.tar.xz
sl0ppij-ac358d913c452ad66bb4fe4f76627e119604ea3e.zip
fix(performance): smaller allocations when rendering (#222)
Diffstat (limited to 'src')
-rw-r--r--src/client/panes/terminal_pane.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/client/panes/terminal_pane.rs b/src/client/panes/terminal_pane.rs
index fd83d571..4a0321af 100644
--- a/src/client/panes/terminal_pane.rs
+++ b/src/client/panes/terminal_pane.rs
@@ -205,12 +205,11 @@ impl Pane for TerminalPane {
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,
+ vte_output.push_str(&format!(
+ "\u{1b}[{};{}H\u{1b}[m",
y + line_index + 1,
x + 1
- ); // goto row/col and reset styles
+ )); // goto row/col and reset styles
for _col_index in 0..self.grid.width {
vte_output.push(EMPTY_TERMINAL_CHARACTER.character);
}
@@ -220,7 +219,7 @@ impl Pane for TerminalPane {
for (row, line) in buffer_lines.iter().enumerate() {
let x = self.get_x();
let y = self.get_y();
- vte_output = format!("{}\u{1b}[{};{}H\u{1b}[m", vte_output, y + row + 1, x + 1); // goto row/col and reset styles
+ vte_output.push_str(&format!("\u{1b}[{};{}H\u{1b}[m", y + row + 1, x + 1)); // goto row/col and reset styles
for (col, t_character) in line.iter().enumerate() {
if col < display_cols {
// in some cases (eg. while resizing) some characters will spill over
@@ -232,7 +231,7 @@ impl Pane for TerminalPane {
// the terminal keeps the previous styles as long as we're in the same
// line, so we only want to update the new styles here (this also
// includes resetting previous styles as needed)
- vte_output = format!("{}{}", vte_output, new_styles);
+ vte_output.push_str(&new_styles.to_string());
}
vte_output.push(t_character.character);
}