mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
terminal/new: screen resize no reflow less rows
This commit is contained in:
@ -363,6 +363,7 @@ pub const Resize = struct {
|
|||||||
/// TODO: docs
|
/// TODO: docs
|
||||||
pub fn resize(self: *PageList, opts: Resize) !void {
|
pub fn resize(self: *PageList, opts: Resize) !void {
|
||||||
if (!opts.reflow) return try self.resizeWithoutReflow(opts);
|
if (!opts.reflow) return try self.resizeWithoutReflow(opts);
|
||||||
|
@panic("TODO: resize with text reflow");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resizeWithoutReflow(self: *PageList, opts: Resize) !void {
|
fn resizeWithoutReflow(self: *PageList, opts: Resize) !void {
|
||||||
|
@ -584,7 +584,7 @@ pub fn resize(
|
|||||||
// If we have the same number of columns, text can't possibly
|
// If we have the same number of columns, text can't possibly
|
||||||
// reflow in any way, so we do the quicker thing and do a resize
|
// reflow in any way, so we do the quicker thing and do a resize
|
||||||
// without reflow checks.
|
// without reflow checks.
|
||||||
try self.resizeWithoutReflow(rows, cols);
|
try self.resizeWithoutReflow(cols, rows);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,11 +596,10 @@ pub fn resize(
|
|||||||
/// with zeros.
|
/// with zeros.
|
||||||
pub fn resizeWithoutReflow(
|
pub fn resizeWithoutReflow(
|
||||||
self: *Screen,
|
self: *Screen,
|
||||||
rows: size.CellCountInt,
|
|
||||||
cols: size.CellCountInt,
|
cols: size.CellCountInt,
|
||||||
|
rows: size.CellCountInt,
|
||||||
) !void {
|
) !void {
|
||||||
// If we're resizing to the same size, do nothing.
|
try self.pages.resize(.{ .rows = rows, .cols = cols, .reflow = false });
|
||||||
if (self.pages.cols == cols and self.pages.rows == rows) return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set a style attribute for the current cursor.
|
/// Set a style attribute for the current cursor.
|
||||||
@ -1822,19 +1821,19 @@ test "Screen: resize (no reflow) more rows" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// test "Screen: resize (no reflow) less rows" {
|
test "Screen: resize (no reflow) less rows" {
|
||||||
// const testing = std.testing;
|
const testing = std.testing;
|
||||||
// const alloc = testing.allocator;
|
const alloc = testing.allocator;
|
||||||
//
|
|
||||||
// var s = try init(alloc, 10, 3, 0);
|
var s = try init(alloc, 10, 3, 0);
|
||||||
// defer s.deinit();
|
defer s.deinit();
|
||||||
// const str = "1ABCD\n2EFGH\n3IJKL";
|
const str = "1ABCD\n2EFGH\n3IJKL";
|
||||||
// try s.testWriteString(str);
|
try s.testWriteString(str);
|
||||||
// try s.resizeWithoutReflow(10, 2);
|
try s.resizeWithoutReflow(10, 2);
|
||||||
//
|
|
||||||
// {
|
{
|
||||||
// const contents = try s.dumpStringAlloc(alloc, .{ .viewport = .{} });
|
const contents = try s.dumpStringAlloc(alloc, .{ .viewport = .{} });
|
||||||
// defer alloc.free(contents);
|
defer alloc.free(contents);
|
||||||
// try testing.expectEqualStrings("2EFGH\n3IJKL", contents);
|
try testing.expectEqualStrings("2EFGH\n3IJKL", contents);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
Reference in New Issue
Block a user