Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve reflow performance and general memory usage by reducing size of TerminalCharacter #3043

Merged
merged 30 commits into from
Jan 22, 2024
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2ed84e3
refactor: Simplify transfer_rows_from_viewport_to_lines_above
aidanhs Dec 17, 2023
c1d8b5d
perf: Batch remove rows from the viewport for performance
aidanhs Dec 17, 2023
78fafb1
perf: Optimize Row::drain_until by splitting chars in one step
aidanhs Dec 18, 2023
cca9656
refactor: Simplify `if let` into a `.map`
aidanhs Dec 20, 2023
8ce6ce1
refactor: There are only new saved coordinates when there were old ones
aidanhs Dec 24, 2023
110bf46
refactor: Unify viewport transfer: use common variable names
aidanhs Dec 24, 2023
75143e6
fix: Use same saved cursor logic in height resize as width
aidanhs Dec 25, 2023
37d0dab
fix: Correct saved+real cursor calculations when reflowing long lines
aidanhs Dec 25, 2023
918b642
fix: Don't create canonical lines if cursor ends on EOL after resize
aidanhs Dec 25, 2023
e2c9d6f
fix: for cursor index calculation in lines that are already wrapped
aidanhs Dec 25, 2023
fba2574
chore: test for real/saved cursor position being handled separately
aidanhs Dec 26, 2023
528ccbf
chore: Apply cargo format
aidanhs Dec 27, 2023
c80072d
refactor: Unify viewport transfer: transfer + cursor update together
aidanhs Dec 28, 2023
3ef9638
perf: Reduce size of TerminalCharacter from 72 to 60 bytes
aidanhs Dec 29, 2023
b9d957e
fix(build): Don't unconditionally rebuild zellij-utils
aidanhs Dec 29, 2023
846fda7
refactor: Remove Copy impl on TerminalCharacter
aidanhs Dec 29, 2023
afd2f65
perf: Rc styles to reduce TerminalCharacter from 60 to 24 bytes
aidanhs Dec 29, 2023
7ed840b
perf: Remove RcCharacterStyles::Default, allow enum niche optimisation
aidanhs Dec 29, 2023
d53b0e8
docs: link anchor omission from reset_all is deliberate
aidanhs Dec 29, 2023
a9a5a69
fix: Remove no-op on variable that gets immediately dropped
aidanhs Dec 29, 2023
3b55f63
refactor: Simplify replace_character_at logic
aidanhs Dec 29, 2023
a0731c2
chore: Run xtask format
aidanhs Dec 29, 2023
85195c5
chore(repo): update issue templates
imsnif Dec 28, 2023
28f69af
Bump rust version to 1.75.0 (#3039)
har7an Jan 8, 2024
1621a60
feat(plugins): introduce 'pipes', allowing users to pipe data to and …
imsnif Jan 17, 2024
52d638a
docs(changelog): introduce pipes
imsnif Jan 17, 2024
2bd0bb3
xtask: Disable pusing during publish (#3040)
har7an Jan 20, 2024
58748c1
fix(terminal): some real/saved cursor bugs during resize (#3032)
aidanhs Jan 22, 2024
c8f8673
Merge branch 'main' into aidanhs-aphs-improve-reflow-perf-2
imsnif Jan 22, 2024
0295000
fix integer overflow again (oops)
imsnif Jan 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: Simplify if let into a .map
  • Loading branch information
aidanhs committed Dec 30, 2023
commit cca9656df14ae40d41c76011a13fd53c598ec063
24 changes: 8 additions & 16 deletions zellij-server/src/panes/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,25 +850,17 @@ impl Grid {
self.viewport = new_viewport_rows;

let mut new_cursor_y = self.canonical_line_y_coordinates(cursor_canonical_line_index);
let mut saved_cursor_y_coordinates =
if let Some(saved_cursor) = self.saved_cursor_position.as_ref() {
Some(self.canonical_line_y_coordinates(saved_cursor.y))
} else {
None
};
let mut saved_cursor_y_coordinates = self.saved_cursor_position.as_ref()
.map(|saved_cursor| self.canonical_line_y_coordinates(saved_cursor.y));

let new_cursor_x = (cursor_index_in_canonical_line / new_columns)
+ (cursor_index_in_canonical_line % new_columns);
let saved_cursor_x_coordinates = if let Some(saved_cursor_index_in_canonical_line) =
saved_cursor_index_in_canonical_line.as_ref()
{
Some(
(*saved_cursor_index_in_canonical_line / new_columns)
+ (*saved_cursor_index_in_canonical_line % new_columns),
)
} else {
None
};
let saved_cursor_x_coordinates = saved_cursor_index_in_canonical_line.as_ref()
.map(|saved_cursor_index_in_canonical_line|
(*saved_cursor_index_in_canonical_line / new_columns)
+ (*saved_cursor_index_in_canonical_line % new_columns)
);

let current_viewport_row_count = self.viewport.len();
match current_viewport_row_count.cmp(&self.height) {
Ordering::Less => {
Expand Down