Skip to content

Commit

Permalink
fix(compatibility): docker-compose progress bar (#656)
Browse files Browse the repository at this point in the history
* fix(compatibility): docker-compose progress bar

* docs(changelog): progress bar fix

* style(fmt): make rustfmt happy
  • Loading branch information
imsnif authored Aug 23, 2021
1 parent 01c5378 commit d969bbf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
* Fix various shells (eg. nushell) unexpectedly exiting when the user presses ctrl-c (https://github.com/zellij-org/zellij/pull/648)
* Fix line wrapping while scrolling (https://github.com/zellij-org/zellij/pull/650)
* Indicate to the user when text is copied to the clipboard with the mouse (https://github.com/zellij-org/zellij/pull/642)
* Terminal compatibility: fix progress bar line overflow (http://github.com/zellij-org/zellij/pull/656)

## [0.15.0] - 2021-07-19
* Kill children properly (https://github.com/zellij-org/zellij/pull/601)
Expand Down
24 changes: 8 additions & 16 deletions zellij-server/src/panes/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1068,26 +1068,18 @@ impl Grid {
}
self.output_buffer.update_all_lines();
}
pub fn move_cursor_down(&mut self, count: usize, pad_character: TerminalCharacter) {
pub fn move_cursor_down_until_edge_of_screen(
&mut self,
count: usize,
pad_character: TerminalCharacter,
) {
if let Some((scroll_region_top, scroll_region_bottom)) = self.scroll_region {
if self.cursor.y >= scroll_region_top && self.cursor.y <= scroll_region_bottom {
self.cursor.y = std::cmp::min(self.cursor.y + count, scroll_region_bottom);
return;
}
}
let lines_to_add = if self.cursor.y + count > self.height - 1 {
(self.cursor.y + count) - (self.height - 1)
} else {
0
};
self.cursor.y = if self.cursor.y + count > self.height - 1 {
self.height - 1
} else {
self.cursor.y + count
};
for _ in 0..lines_to_add {
self.add_canonical_line();
}
self.cursor.y = std::cmp::min(self.cursor.y + count, self.height - 1);
self.pad_lines_until(self.cursor.y, pad_character);
}
pub fn move_cursor_back(&mut self, count: usize) {
Expand Down Expand Up @@ -1626,7 +1618,7 @@ impl Perform for Grid {
// move cursor down until edge of screen
let move_down_count = next_param_or(1);
let pad_character = EMPTY_TERMINAL_CHARACTER;
self.move_cursor_down(move_down_count as usize, pad_character);
self.move_cursor_down_until_edge_of_screen(move_down_count as usize, pad_character);
} else if c == 'D' {
let move_back_count = next_param_or(1);
self.move_cursor_back(move_back_count);
Expand Down Expand Up @@ -1806,7 +1798,7 @@ impl Perform for Grid {
} else if c == 'E' {
let count = next_param_or(1);
let pad_character = EMPTY_TERMINAL_CHARACTER;
self.move_cursor_down(count, pad_character);
self.move_cursor_down_until_edge_of_screen(count, pad_character);
} else if c == 'F' {
let count = next_param_or(1);
self.move_cursor_up(count);
Expand Down

0 comments on commit d969bbf

Please sign in to comment.