mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
1
TODO.md
1
TODO.md
@ -13,7 +13,6 @@ Performance:
|
|||||||
Correctness:
|
Correctness:
|
||||||
|
|
||||||
* `exit` in the shell should close the window
|
* `exit` in the shell should close the window
|
||||||
* scrollback: reflow on resize
|
|
||||||
* test wrap against wraptest: https://github.com/mattiase/wraptest
|
* test wrap against wraptest: https://github.com/mattiase/wraptest
|
||||||
- automate this in some way
|
- automate this in some way
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -214,8 +214,6 @@ pub fn resize(self: *Terminal, alloc: Allocator, cols_req: usize, rows: usize) !
|
|||||||
const tracy = trace(@src());
|
const tracy = trace(@src());
|
||||||
defer tracy.end();
|
defer tracy.end();
|
||||||
|
|
||||||
// TODO: test, wrapping, etc.
|
|
||||||
|
|
||||||
// If we have deccolm supported then we are fixed at either 80 or 132
|
// If we have deccolm supported then we are fixed at either 80 or 132
|
||||||
// columns depending on if mode 3 is set or not.
|
// columns depending on if mode 3 is set or not.
|
||||||
// TODO: test
|
// TODO: test
|
||||||
@ -232,9 +230,13 @@ pub fn resize(self: *Terminal, alloc: Allocator, cols_req: usize, rows: usize) !
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we're making the screen smaller, dealloc the unused items.
|
// If we're making the screen smaller, dealloc the unused items.
|
||||||
// TODO: reflow
|
if (self.active_screen == .primary) {
|
||||||
try self.screen.resize(alloc, rows, cols);
|
try self.screen.resize(alloc, rows, cols);
|
||||||
try self.secondary_screen.resize(alloc, rows, cols);
|
try self.secondary_screen.resizeWithoutReflow(alloc, rows, cols);
|
||||||
|
} else {
|
||||||
|
try self.screen.resizeWithoutReflow(alloc, rows, cols);
|
||||||
|
try self.secondary_screen.resize(alloc, rows, cols);
|
||||||
|
}
|
||||||
|
|
||||||
// Set our size
|
// Set our size
|
||||||
self.cols = cols;
|
self.cols = cols;
|
||||||
@ -252,7 +254,7 @@ pub fn resize(self: *Terminal, alloc: Allocator, cols_req: usize, rows: usize) !
|
|||||||
///
|
///
|
||||||
/// The caller must free the string.
|
/// The caller must free the string.
|
||||||
pub fn plainString(self: Terminal, alloc: Allocator) ![]const u8 {
|
pub fn plainString(self: Terminal, alloc: Allocator) ![]const u8 {
|
||||||
return try self.screen.testString(alloc);
|
return try self.screen.testString(alloc, .viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Save cursor position and further state.
|
/// Save cursor position and further state.
|
||||||
|
@ -76,6 +76,24 @@ pub const ScreenPoint = struct {
|
|||||||
(self.y == other.y and self.x < other.x);
|
(self.y == other.y and self.x < other.x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Converts this to a viewport point. If the point is above the
|
||||||
|
/// viewport this will move the point to (0, 0) and if it is below
|
||||||
|
/// the viewport it'll move it to (cols - 1, rows - 1).
|
||||||
|
pub fn toViewport(self: ScreenPoint, screen: *const Screen) Viewport {
|
||||||
|
// TODO: test
|
||||||
|
|
||||||
|
// Before viewport
|
||||||
|
if (self.y < screen.visible_offset) return .{ .x = 0, .y = 0 };
|
||||||
|
|
||||||
|
// After viewport
|
||||||
|
if (self.y > screen.visible_offset + screen.rows) return .{
|
||||||
|
.x = screen.cols - 1,
|
||||||
|
.y = screen.rows - 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
return .{ .x = self.x, .y = self.y - screen.visible_offset };
|
||||||
|
}
|
||||||
|
|
||||||
test "before" {
|
test "before" {
|
||||||
const testing = std.testing;
|
const testing = std.testing;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user