diff --git a/TODO.md b/TODO.md index 6ba65c1a2..aef8aa94d 100644 --- a/TODO.md +++ b/TODO.md @@ -25,5 +25,3 @@ paged-terminal branch: - tests and logic for overflowing page capacities: * graphemes - * styles -- configurable scrollback size diff --git a/src/config/Config.zig b/src/config/Config.zig index eedd6932a..568d43b2d 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -427,6 +427,27 @@ command: ?[]const u8 = null, /// command. @"abnormal-command-exit-runtime": u32 = 250, +/// The size of the scrollback buffer in bytes. This also includes the active +/// screen. No matter what this is set to, enough memory will always be +/// allocated for the visible screen and anything leftover is the limit for +/// the scrollback. +/// +/// When this limit is reached, the oldest lines are removed from the +/// scrollback. +/// +/// Scrollback currently exists completely in memory. This means that the +/// larger this value, the larger potential memory usage. Scrollback is +/// allocated lazily up to this limit, so if you set this to a very large +/// value, it will not immediately consume a lot of memory. +/// +/// This size is per terminal surface, not for the entire application. +/// +/// It is not currently possible to set an unlimited scrollback buffer. +/// This is a future planned feature. +/// +/// This can be changed at runtime but will only affect new terminal surfaces. +@"scrollback-limit": u32 = 10_000, + /// Match a regular expression against the terminal text and associate clicking /// it with an action. This can be used to match URLs, file paths, etc. Actions /// can be opening using the system opener (i.e. `open` or `xdg-open`) or diff --git a/src/renderer/cursor.zig b/src/renderer/cursor.zig index fd58257be..d7cb7c5bb 100644 --- a/src/renderer/cursor.zig +++ b/src/renderer/cursor.zig @@ -63,7 +63,7 @@ pub fn cursorStyle( test "cursor: default uses configured style" { const testing = std.testing; const alloc = testing.allocator; - var term = try terminal.Terminal.init(alloc, 10, 10); + var term = try terminal.Terminal.init(alloc, .{ .cols = 10, .rows = 10 }); defer term.deinit(alloc); term.screen.cursor.cursor_style = .bar; @@ -84,7 +84,7 @@ test "cursor: default uses configured style" { test "cursor: blinking disabled" { const testing = std.testing; const alloc = testing.allocator; - var term = try terminal.Terminal.init(alloc, 10, 10); + var term = try terminal.Terminal.init(alloc, .{ .cols = 10, .rows = 10 }); defer term.deinit(alloc); term.screen.cursor.cursor_style = .bar; @@ -105,7 +105,7 @@ test "cursor: blinking disabled" { test "cursor: explictly not visible" { const testing = std.testing; const alloc = testing.allocator; - var term = try terminal.Terminal.init(alloc, 10, 10); + var term = try terminal.Terminal.init(alloc, .{ .cols = 10, .rows = 10 }); defer term.deinit(alloc); term.screen.cursor.cursor_style = .bar; @@ -127,7 +127,7 @@ test "cursor: explictly not visible" { test "cursor: always block with preedit" { const testing = std.testing; const alloc = testing.allocator; - var term = try terminal.Terminal.init(alloc, 10, 10); + var term = try terminal.Terminal.init(alloc, .{ .cols = 10, .rows = 10 }); defer term.deinit(alloc); var state: State = .{ diff --git a/src/terminal/Terminal.zig b/src/terminal/Terminal.zig index 84f024799..f78d5ca97 100644 --- a/src/terminal/Terminal.zig +++ b/src/terminal/Terminal.zig @@ -159,15 +159,24 @@ pub const ScrollingRegion = struct { right: size.CellCountInt, }; +pub const Options = struct { + cols: size.CellCountInt, + rows: size.CellCountInt, + max_scrollback: usize = 10_000, +}; + /// Initialize a new terminal. -pub fn init(alloc: Allocator, cols: size.CellCountInt, rows: size.CellCountInt) !Terminal { +pub fn init( + alloc: Allocator, + opts: Options, +) !Terminal { + const cols = opts.cols; + const rows = opts.rows; return Terminal{ .cols = cols, .rows = rows, .active_screen = .primary, - // TODO: configurable scrollback - .screen = try Screen.init(alloc, cols, rows, 10000), - // No scrollback for the alternate screen + .screen = try Screen.init(alloc, cols, rows, opts.max_scrollback), .secondary_screen = try Screen.init(alloc, cols, rows, 0), .tabstops = try Tabstops.init(alloc, cols, TABSTOP_INTERVAL), .scrolling_region = .{ @@ -2217,7 +2226,7 @@ pub fn fullReset(self: *Terminal) void { test "Terminal: input with no control characters" { const alloc = testing.allocator; - var t = try init(alloc, 40, 40); + var t = try init(alloc, .{ .cols = 40, .rows = 40 }); defer t.deinit(alloc); // Basic grid writing @@ -2233,7 +2242,7 @@ test "Terminal: input with no control characters" { test "Terminal: input with basic wraparound" { const alloc = testing.allocator; - var t = try init(alloc, 5, 40); + var t = try init(alloc, .{ .cols = 5, .rows = 40 }); defer t.deinit(alloc); // Basic grid writing @@ -2250,7 +2259,7 @@ test "Terminal: input with basic wraparound" { test "Terminal: input that forces scroll" { const alloc = testing.allocator; - var t = try init(alloc, 1, 5); + var t = try init(alloc, .{ .cols = 1, .rows = 5 }); defer t.deinit(alloc); // Basic grid writing @@ -2266,7 +2275,7 @@ test "Terminal: input that forces scroll" { test "Terminal: input unique style per cell" { const alloc = testing.allocator; - var t = try init(alloc, 30, 30); + var t = try init(alloc, .{ .cols = 30, .rows = 30 }); defer t.deinit(alloc); for (0..t.rows) |y| { @@ -2283,7 +2292,7 @@ test "Terminal: input unique style per cell" { } test "Terminal: zero-width character at start" { - var t = try init(testing.allocator, 80, 80); + var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 }); defer t.deinit(testing.allocator); // This used to crash the terminal. This is not allowed so we should @@ -2296,7 +2305,7 @@ test "Terminal: zero-width character at start" { // https://github.com/mitchellh/ghostty/issues/1400 test "Terminal: print single very long line" { - var t = try init(testing.allocator, 5, 5); + var t = try init(testing.allocator, .{ .rows = 5, .cols = 5 }); defer t.deinit(testing.allocator); // This would crash for issue 1400. So the assertion here is @@ -2305,7 +2314,7 @@ test "Terminal: print single very long line" { } test "Terminal: print wide char" { - var t = try init(testing.allocator, 80, 80); + var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 }); defer t.deinit(testing.allocator); try t.print(0x1F600); // Smiley face @@ -2327,14 +2336,14 @@ test "Terminal: print wide char" { test "Terminal: print wide char with 1-column width" { const alloc = testing.allocator; - var t = try init(alloc, 1, 2); + var t = try init(alloc, .{ .cols = 1, .rows = 2 }); defer t.deinit(alloc); try t.print('😀'); // 0x1F600 } test "Terminal: print wide char in single-width terminal" { - var t = try init(testing.allocator, 1, 80); + var t = try init(testing.allocator, .{ .cols = 1, .rows = 80 }); defer t.deinit(testing.allocator); try t.print(0x1F600); // Smiley face @@ -2351,7 +2360,7 @@ test "Terminal: print wide char in single-width terminal" { } test "Terminal: print over wide char at 0,0" { - var t = try init(testing.allocator, 80, 80); + var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 }); defer t.deinit(testing.allocator); try t.print(0x1F600); // Smiley face @@ -2376,7 +2385,7 @@ test "Terminal: print over wide char at 0,0" { } test "Terminal: print over wide spacer tail" { - var t = try init(testing.allocator, 5, 5); + var t = try init(testing.allocator, .{ .rows = 5, .cols = 5 }); defer t.deinit(testing.allocator); try t.print('橋'); @@ -2404,7 +2413,7 @@ test "Terminal: print over wide spacer tail" { } test "Terminal: print multicodepoint grapheme, disabled mode 2027" { - var t = try init(testing.allocator, 80, 80); + var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 }); defer t.deinit(testing.allocator); // https://github.com/mitchellh/ghostty/issues/289 @@ -2474,7 +2483,7 @@ test "Terminal: print multicodepoint grapheme, disabled mode 2027" { } test "Terminal: VS16 doesn't make character with 2027 disabled" { - var t = try init(testing.allocator, 5, 5); + var t = try init(testing.allocator, .{ .rows = 5, .cols = 5 }); defer t.deinit(testing.allocator); // Disable grapheme clustering @@ -2501,7 +2510,7 @@ test "Terminal: VS16 doesn't make character with 2027 disabled" { } test "Terminal: print invalid VS16 non-grapheme" { - var t = try init(testing.allocator, 80, 80); + var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 }); defer t.deinit(testing.allocator); // https://github.com/mitchellh/ghostty/issues/1482 @@ -2529,7 +2538,7 @@ test "Terminal: print invalid VS16 non-grapheme" { } test "Terminal: print multicodepoint grapheme, mode 2027" { - var t = try init(testing.allocator, 80, 80); + var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 }); defer t.deinit(testing.allocator); // Enable grapheme clustering @@ -2568,7 +2577,7 @@ test "Terminal: print multicodepoint grapheme, mode 2027" { } test "Terminal: VS15 to make narrow character" { - var t = try init(testing.allocator, 5, 5); + var t = try init(testing.allocator, .{ .rows = 5, .cols = 5 }); defer t.deinit(testing.allocator); // Enable grapheme clustering @@ -2595,7 +2604,7 @@ test "Terminal: VS15 to make narrow character" { } test "Terminal: VS16 to make wide character with mode 2027" { - var t = try init(testing.allocator, 5, 5); + var t = try init(testing.allocator, .{ .rows = 5, .cols = 5 }); defer t.deinit(testing.allocator); // Enable grapheme clustering @@ -2622,7 +2631,7 @@ test "Terminal: VS16 to make wide character with mode 2027" { } test "Terminal: VS16 repeated with mode 2027" { - var t = try init(testing.allocator, 5, 5); + var t = try init(testing.allocator, .{ .rows = 5, .cols = 5 }); defer t.deinit(testing.allocator); // Enable grapheme clustering @@ -2660,7 +2669,7 @@ test "Terminal: VS16 repeated with mode 2027" { } test "Terminal: print invalid VS16 grapheme" { - var t = try init(testing.allocator, 80, 80); + var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 }); defer t.deinit(testing.allocator); // Enable grapheme clustering @@ -2692,7 +2701,7 @@ test "Terminal: print invalid VS16 grapheme" { } test "Terminal: print invalid VS16 with second char" { - var t = try init(testing.allocator, 80, 80); + var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 }); defer t.deinit(testing.allocator); // Enable grapheme clustering @@ -2727,7 +2736,7 @@ test "Terminal: print invalid VS16 with second char" { } test "Terminal: overwrite grapheme should clear grapheme data" { - var t = try init(testing.allocator, 5, 5); + var t = try init(testing.allocator, .{ .rows = 5, .cols = 5 }); defer t.deinit(testing.allocator); // Enable grapheme clustering @@ -2754,7 +2763,7 @@ test "Terminal: overwrite grapheme should clear grapheme data" { } test "Terminal: print writes to bottom if scrolled" { - var t = try init(testing.allocator, 5, 2); + var t = try init(testing.allocator, .{ .cols = 5, .rows = 2 }); defer t.deinit(testing.allocator); // Basic grid writing @@ -2791,7 +2800,7 @@ test "Terminal: print writes to bottom if scrolled" { } test "Terminal: print charset" { - var t = try init(testing.allocator, 80, 80); + var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 }); defer t.deinit(testing.allocator); // G1 should have no effect @@ -2815,7 +2824,7 @@ test "Terminal: print charset" { } test "Terminal: print charset outside of ASCII" { - var t = try init(testing.allocator, 80, 80); + var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 }); defer t.deinit(testing.allocator); // G1 should have no effect @@ -2835,7 +2844,7 @@ test "Terminal: print charset outside of ASCII" { } test "Terminal: print invoke charset" { - var t = try init(testing.allocator, 80, 80); + var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 }); defer t.deinit(testing.allocator); t.configureCharset(.G1, .dec_special); @@ -2855,7 +2864,7 @@ test "Terminal: print invoke charset" { } test "Terminal: print invoke charset single" { - var t = try init(testing.allocator, 80, 80); + var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 }); defer t.deinit(testing.allocator); t.configureCharset(.G1, .dec_special); @@ -2873,7 +2882,7 @@ test "Terminal: print invoke charset single" { } test "Terminal: soft wrap" { - var t = try init(testing.allocator, 3, 80); + var t = try init(testing.allocator, .{ .cols = 3, .rows = 80 }); defer t.deinit(testing.allocator); // Basic grid writing @@ -2888,7 +2897,7 @@ test "Terminal: soft wrap" { } test "Terminal: soft wrap with semantic prompt" { - var t = try init(testing.allocator, 3, 80); + var t = try init(testing.allocator, .{ .cols = 3, .rows = 80 }); defer t.deinit(testing.allocator); t.markSemanticPrompt(.prompt); @@ -2905,7 +2914,7 @@ test "Terminal: soft wrap with semantic prompt" { } test "Terminal: disabled wraparound with wide char and one space" { - var t = try init(testing.allocator, 5, 5); + var t = try init(testing.allocator, .{ .rows = 5, .cols = 5 }); defer t.deinit(testing.allocator); t.modes.set(.wraparound, false); @@ -2933,7 +2942,7 @@ test "Terminal: disabled wraparound with wide char and one space" { } test "Terminal: disabled wraparound with wide char and no space" { - var t = try init(testing.allocator, 5, 5); + var t = try init(testing.allocator, .{ .rows = 5, .cols = 5 }); defer t.deinit(testing.allocator); t.modes.set(.wraparound, false); @@ -2960,7 +2969,7 @@ test "Terminal: disabled wraparound with wide char and no space" { } test "Terminal: disabled wraparound with wide grapheme and half space" { - var t = try init(testing.allocator, 5, 5); + var t = try init(testing.allocator, .{ .rows = 5, .cols = 5 }); defer t.deinit(testing.allocator); t.modes.set(.grapheme_cluster, true); @@ -2989,7 +2998,7 @@ test "Terminal: disabled wraparound with wide grapheme and half space" { } test "Terminal: print right margin wrap" { - var t = try init(testing.allocator, 10, 5); + var t = try init(testing.allocator, .{ .cols = 10, .rows = 5 }); defer t.deinit(testing.allocator); try t.printString("123456789"); @@ -3006,7 +3015,7 @@ test "Terminal: print right margin wrap" { } test "Terminal: print right margin outside" { - var t = try init(testing.allocator, 10, 5); + var t = try init(testing.allocator, .{ .cols = 10, .rows = 5 }); defer t.deinit(testing.allocator); try t.printString("123456789"); @@ -3023,7 +3032,7 @@ test "Terminal: print right margin outside" { } test "Terminal: print right margin outside wrap" { - var t = try init(testing.allocator, 10, 5); + var t = try init(testing.allocator, .{ .cols = 10, .rows = 5 }); defer t.deinit(testing.allocator); try t.printString("123456789"); @@ -3040,7 +3049,7 @@ test "Terminal: print right margin outside wrap" { } test "Terminal: linefeed and carriage return" { - var t = try init(testing.allocator, 80, 80); + var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 }); defer t.deinit(testing.allocator); // Basic grid writing @@ -3058,7 +3067,7 @@ test "Terminal: linefeed and carriage return" { } test "Terminal: linefeed unsets pending wrap" { - var t = try init(testing.allocator, 5, 80); + var t = try init(testing.allocator, .{ .cols = 5, .rows = 80 }); defer t.deinit(testing.allocator); // Basic grid writing @@ -3069,7 +3078,7 @@ test "Terminal: linefeed unsets pending wrap" { } test "Terminal: linefeed mode automatic carriage return" { - var t = try init(testing.allocator, 10, 10); + var t = try init(testing.allocator, .{ .cols = 10, .rows = 10 }); defer t.deinit(testing.allocator); // Basic grid writing @@ -3085,7 +3094,7 @@ test "Terminal: linefeed mode automatic carriage return" { } test "Terminal: carriage return unsets pending wrap" { - var t = try init(testing.allocator, 5, 80); + var t = try init(testing.allocator, .{ .cols = 5, .rows = 80 }); defer t.deinit(testing.allocator); // Basic grid writing @@ -3096,7 +3105,7 @@ test "Terminal: carriage return unsets pending wrap" { } test "Terminal: carriage return origin mode moves to left margin" { - var t = try init(testing.allocator, 5, 80); + var t = try init(testing.allocator, .{ .cols = 5, .rows = 80 }); defer t.deinit(testing.allocator); t.modes.set(.origin, true); @@ -3107,7 +3116,7 @@ test "Terminal: carriage return origin mode moves to left margin" { } test "Terminal: carriage return left of left margin moves to zero" { - var t = try init(testing.allocator, 5, 80); + var t = try init(testing.allocator, .{ .cols = 5, .rows = 80 }); defer t.deinit(testing.allocator); t.screen.cursor.x = 1; @@ -3117,7 +3126,7 @@ test "Terminal: carriage return left of left margin moves to zero" { } test "Terminal: carriage return right of left margin moves to left margin" { - var t = try init(testing.allocator, 5, 80); + var t = try init(testing.allocator, .{ .cols = 5, .rows = 80 }); defer t.deinit(testing.allocator); t.screen.cursor.x = 3; @@ -3127,7 +3136,7 @@ test "Terminal: carriage return right of left margin moves to left margin" { } test "Terminal: backspace" { - var t = try init(testing.allocator, 80, 80); + var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 }); defer t.deinit(testing.allocator); // BS @@ -3145,7 +3154,7 @@ test "Terminal: backspace" { test "Terminal: horizontal tabs" { const alloc = testing.allocator; - var t = try init(alloc, 20, 5); + var t = try init(alloc, .{ .cols = 20, .rows = 5 }); defer t.deinit(alloc); // HT @@ -3166,7 +3175,7 @@ test "Terminal: horizontal tabs" { test "Terminal: horizontal tabs starting on tabstop" { const alloc = testing.allocator; - var t = try init(alloc, 20, 5); + var t = try init(alloc, .{ .cols = 20, .rows = 5 }); defer t.deinit(alloc); t.setCursorPos(t.screen.cursor.y, 9); @@ -3184,7 +3193,7 @@ test "Terminal: horizontal tabs starting on tabstop" { test "Terminal: horizontal tabs with right margin" { const alloc = testing.allocator; - var t = try init(alloc, 20, 5); + var t = try init(alloc, .{ .cols = 20, .rows = 5 }); defer t.deinit(alloc); t.scrolling_region.left = 2; @@ -3203,7 +3212,7 @@ test "Terminal: horizontal tabs with right margin" { test "Terminal: horizontal tabs back" { const alloc = testing.allocator; - var t = try init(alloc, 20, 5); + var t = try init(alloc, .{ .cols = 20, .rows = 5 }); defer t.deinit(alloc); // Edge of screen @@ -3226,7 +3235,7 @@ test "Terminal: horizontal tabs back" { test "Terminal: horizontal tabs back starting on tabstop" { const alloc = testing.allocator; - var t = try init(alloc, 20, 5); + var t = try init(alloc, .{ .cols = 20, .rows = 5 }); defer t.deinit(alloc); t.setCursorPos(t.screen.cursor.y, 9); @@ -3244,7 +3253,7 @@ test "Terminal: horizontal tabs back starting on tabstop" { test "Terminal: horizontal tabs with left margin in origin mode" { const alloc = testing.allocator; - var t = try init(alloc, 20, 5); + var t = try init(alloc, .{ .cols = 20, .rows = 5 }); defer t.deinit(alloc); t.modes.set(.origin, true); @@ -3264,7 +3273,7 @@ test "Terminal: horizontal tabs with left margin in origin mode" { test "Terminal: horizontal tab back with cursor before left margin" { const alloc = testing.allocator; - var t = try init(alloc, 20, 5); + var t = try init(alloc, .{ .cols = 20, .rows = 5 }); defer t.deinit(alloc); t.modes.set(.origin, true); @@ -3284,7 +3293,7 @@ test "Terminal: horizontal tab back with cursor before left margin" { test "Terminal: cursorPos resets wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -3302,7 +3311,7 @@ test "Terminal: cursorPos resets wrap" { test "Terminal: cursorPos off the screen" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setCursorPos(500, 500); @@ -3317,7 +3326,7 @@ test "Terminal: cursorPos off the screen" { test "Terminal: cursorPos relative to origin" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.scrolling_region.top = 2; @@ -3335,7 +3344,7 @@ test "Terminal: cursorPos relative to origin" { test "Terminal: cursorPos relative to origin with left/right" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.scrolling_region.top = 2; @@ -3355,7 +3364,7 @@ test "Terminal: cursorPos relative to origin with left/right" { test "Terminal: cursorPos limits with full scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.scrolling_region.top = 2; @@ -3375,7 +3384,7 @@ test "Terminal: cursorPos limits with full scroll region" { // Probably outdated, but dates back to the original terminal implementation. test "Terminal: setCursorPos (original test)" { - var t = try init(testing.allocator, 80, 80); + var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 }); defer t.deinit(testing.allocator); try testing.expectEqual(@as(usize, 0), t.screen.cursor.x); @@ -3428,7 +3437,7 @@ test "Terminal: setCursorPos (original test)" { test "Terminal: setTopAndBottomMargin simple" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -3450,7 +3459,7 @@ test "Terminal: setTopAndBottomMargin simple" { test "Terminal: setTopAndBottomMargin top only" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -3472,7 +3481,7 @@ test "Terminal: setTopAndBottomMargin top only" { test "Terminal: setTopAndBottomMargin top and bottom" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -3494,7 +3503,7 @@ test "Terminal: setTopAndBottomMargin top and bottom" { test "Terminal: setTopAndBottomMargin top equal to bottom" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -3516,7 +3525,7 @@ test "Terminal: setTopAndBottomMargin top equal to bottom" { test "Terminal: setLeftAndRightMargin simple" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -3539,7 +3548,7 @@ test "Terminal: setLeftAndRightMargin simple" { test "Terminal: setLeftAndRightMargin left only" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -3565,7 +3574,7 @@ test "Terminal: setLeftAndRightMargin left only" { test "Terminal: setLeftAndRightMargin left and right" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -3589,7 +3598,7 @@ test "Terminal: setLeftAndRightMargin left and right" { test "Terminal: setLeftAndRightMargin left equal right" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -3613,7 +3622,7 @@ test "Terminal: setLeftAndRightMargin left equal right" { test "Terminal: setLeftAndRightMargin mode 69 unset" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -3637,7 +3646,7 @@ test "Terminal: setLeftAndRightMargin mode 69 unset" { test "Terminal: insertLines simple" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -3659,7 +3668,7 @@ test "Terminal: insertLines simple" { test "Terminal: insertLines colors with bg color" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -3697,7 +3706,7 @@ test "Terminal: insertLines colors with bg color" { test "Terminal: insertLines handles style refs" { const alloc = testing.allocator; - var t = try init(alloc, 5, 3); + var t = try init(alloc, .{ .cols = 5, .rows = 3 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -3731,7 +3740,7 @@ test "Terminal: insertLines handles style refs" { test "Terminal: insertLines outside of scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -3754,7 +3763,7 @@ test "Terminal: insertLines outside of scroll region" { test "Terminal: insertLines top/bottom scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -3780,7 +3789,7 @@ test "Terminal: insertLines top/bottom scroll region" { test "Terminal: insertLines (legacy test)" { const alloc = testing.allocator; - var t = try init(alloc, 2, 5); + var t = try init(alloc, .{ .cols = 2, .rows = 5 }); defer t.deinit(alloc); // Initial value @@ -3813,7 +3822,7 @@ test "Terminal: insertLines (legacy test)" { test "Terminal: insertLines zero" { const alloc = testing.allocator; - var t = try init(alloc, 2, 5); + var t = try init(alloc, .{ .cols = 2, .rows = 5 }); defer t.deinit(alloc); // This should do nothing @@ -3823,7 +3832,7 @@ test "Terminal: insertLines zero" { test "Terminal: insertLines with scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 2, 6); + var t = try init(alloc, .{ .cols = 2, .rows = 6 }); defer t.deinit(alloc); // Initial value @@ -3856,7 +3865,7 @@ test "Terminal: insertLines with scroll region" { test "Terminal: insertLines more than remaining" { const alloc = testing.allocator; - var t = try init(alloc, 2, 5); + var t = try init(alloc, .{ .cols = 2, .rows = 5 }); defer t.deinit(alloc); // Initial value @@ -3889,7 +3898,7 @@ test "Terminal: insertLines more than remaining" { test "Terminal: insertLines resets wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -3907,7 +3916,7 @@ test "Terminal: insertLines resets wrap" { test "Terminal: insertLines multi-codepoint graphemes" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); // Disable grapheme clustering @@ -3939,7 +3948,7 @@ test "Terminal: insertLines multi-codepoint graphemes" { test "Terminal: insertLines left/right scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 10, 10); + var t = try init(alloc, .{ .cols = 10, .rows = 10 }); defer t.deinit(alloc); try t.printString("ABC123"); @@ -3963,7 +3972,7 @@ test "Terminal: insertLines left/right scroll region" { test "Terminal: scrollUp simple" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -3988,7 +3997,7 @@ test "Terminal: scrollUp simple" { test "Terminal: scrollUp top/bottom scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -4011,7 +4020,7 @@ test "Terminal: scrollUp top/bottom scroll region" { test "Terminal: scrollUp left/right scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 10, 10); + var t = try init(alloc, .{ .cols = 10, .rows = 10 }); defer t.deinit(alloc); try t.printString("ABC123"); @@ -4038,7 +4047,7 @@ test "Terminal: scrollUp left/right scroll region" { test "Terminal: scrollUp preserves pending wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setCursorPos(1, 5); @@ -4059,7 +4068,7 @@ test "Terminal: scrollUp preserves pending wrap" { test "Terminal: scrollUp full top/bottom region" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("top"); @@ -4077,7 +4086,7 @@ test "Terminal: scrollUp full top/bottom region" { test "Terminal: scrollUp full top/bottomleft/right scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("top"); @@ -4097,7 +4106,7 @@ test "Terminal: scrollUp full top/bottomleft/right scroll region" { test "Terminal: scrollDown simple" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -4122,7 +4131,7 @@ test "Terminal: scrollDown simple" { test "Terminal: scrollDown outside of scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -4148,7 +4157,7 @@ test "Terminal: scrollDown outside of scroll region" { test "Terminal: scrollDown left/right scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 10, 10); + var t = try init(alloc, .{ .cols = 10, .rows = 10 }); defer t.deinit(alloc); try t.printString("ABC123"); @@ -4175,7 +4184,7 @@ test "Terminal: scrollDown left/right scroll region" { test "Terminal: scrollDown outside of left/right scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 10, 10); + var t = try init(alloc, .{ .cols = 10, .rows = 10 }); defer t.deinit(alloc); try t.printString("ABC123"); @@ -4202,7 +4211,7 @@ test "Terminal: scrollDown outside of left/right scroll region" { test "Terminal: scrollDown preserves pending wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 10); + var t = try init(alloc, .{ .cols = 5, .rows = 10 }); defer t.deinit(alloc); t.setCursorPos(1, 5); @@ -4223,7 +4232,7 @@ test "Terminal: scrollDown preserves pending wrap" { test "Terminal: eraseChars simple operation" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABC") |c| try t.print(c); @@ -4240,7 +4249,7 @@ test "Terminal: eraseChars simple operation" { test "Terminal: eraseChars minimum one" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABC") |c| try t.print(c); @@ -4257,7 +4266,7 @@ test "Terminal: eraseChars minimum one" { test "Terminal: eraseChars beyond screen edge" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for (" ABC") |c| try t.print(c); @@ -4273,7 +4282,7 @@ test "Terminal: eraseChars beyond screen edge" { test "Terminal: eraseChars wide character" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.print('橋'); @@ -4291,7 +4300,7 @@ test "Terminal: eraseChars wide character" { test "Terminal: eraseChars resets pending wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -4309,7 +4318,7 @@ test "Terminal: eraseChars resets pending wrap" { test "Terminal: eraseChars resets wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE123") |c| try t.print(c); @@ -4339,7 +4348,7 @@ test "Terminal: eraseChars resets wrap" { test "Terminal: eraseChars preserves background sgr" { const alloc = testing.allocator; - var t = try init(alloc, 10, 10); + var t = try init(alloc, .{ .cols = 10, .rows = 10 }); defer t.deinit(alloc); for ("ABC") |c| try t.print(c); @@ -4378,7 +4387,7 @@ test "Terminal: eraseChars preserves background sgr" { test "Terminal: eraseChars handles refcounted styles" { const alloc = testing.allocator; - var t = try init(alloc, 10, 10); + var t = try init(alloc, .{ .cols = 10, .rows = 10 }); defer t.deinit(alloc); try t.setAttribute(.{ .bold = {} }); @@ -4400,7 +4409,7 @@ test "Terminal: eraseChars handles refcounted styles" { test "Terminal: eraseChars protected attributes respected with iso" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.iso); @@ -4417,7 +4426,7 @@ test "Terminal: eraseChars protected attributes respected with iso" { test "Terminal: eraseChars protected attributes ignored with dec most recent" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.iso); @@ -4436,7 +4445,7 @@ test "Terminal: eraseChars protected attributes ignored with dec most recent" { test "Terminal: eraseChars protected attributes ignored with dec set" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.dec); @@ -4453,7 +4462,7 @@ test "Terminal: eraseChars protected attributes ignored with dec set" { test "Terminal: reverseIndex" { const alloc = testing.allocator; - var t = try init(alloc, 2, 5); + var t = try init(alloc, .{ .cols = 2, .rows = 5 }); defer t.deinit(alloc); // Initial value @@ -4480,7 +4489,7 @@ test "Terminal: reverseIndex" { test "Terminal: reverseIndex from the top" { const alloc = testing.allocator; - var t = try init(alloc, 2, 5); + var t = try init(alloc, .{ .cols = 2, .rows = 5 }); defer t.deinit(alloc); try t.print('A'); @@ -4513,7 +4522,7 @@ test "Terminal: reverseIndex from the top" { test "Terminal: reverseIndex top of scrolling region" { const alloc = testing.allocator; - var t = try init(alloc, 2, 10); + var t = try init(alloc, .{ .cols = 2, .rows = 10 }); defer t.deinit(alloc); // Initial value @@ -4546,7 +4555,7 @@ test "Terminal: reverseIndex top of scrolling region" { test "Terminal: reverseIndex top of screen" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.print('A'); @@ -4567,7 +4576,7 @@ test "Terminal: reverseIndex top of screen" { test "Terminal: reverseIndex not top of screen" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.print('A'); @@ -4588,7 +4597,7 @@ test "Terminal: reverseIndex not top of screen" { test "Terminal: reverseIndex top/bottom margins" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.print('A'); @@ -4609,7 +4618,7 @@ test "Terminal: reverseIndex top/bottom margins" { test "Terminal: reverseIndex outside top/bottom margins" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.print('A'); @@ -4630,7 +4639,7 @@ test "Terminal: reverseIndex outside top/bottom margins" { test "Terminal: reverseIndex left/right margins" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -4652,7 +4661,7 @@ test "Terminal: reverseIndex left/right margins" { test "Terminal: reverseIndex outside left/right margins" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -4674,7 +4683,7 @@ test "Terminal: reverseIndex outside left/right margins" { test "Terminal: index" { const alloc = testing.allocator; - var t = try init(alloc, 2, 5); + var t = try init(alloc, .{ .cols = 2, .rows = 5 }); defer t.deinit(alloc); try t.index(); @@ -4689,7 +4698,7 @@ test "Terminal: index" { test "Terminal: index from the bottom" { const alloc = testing.allocator; - var t = try init(alloc, 2, 5); + var t = try init(alloc, .{ .cols = 2, .rows = 5 }); defer t.deinit(alloc); t.setCursorPos(5, 1); @@ -4708,7 +4717,7 @@ test "Terminal: index from the bottom" { test "Terminal: index outside of scrolling region" { const alloc = testing.allocator; - var t = try init(alloc, 2, 5); + var t = try init(alloc, .{ .cols = 2, .rows = 5 }); defer t.deinit(alloc); try testing.expectEqual(@as(usize, 0), t.screen.cursor.y); @@ -4719,7 +4728,7 @@ test "Terminal: index outside of scrolling region" { test "Terminal: index from the bottom outside of scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 2, 5); + var t = try init(alloc, .{ .cols = 2, .rows = 5 }); defer t.deinit(alloc); t.setTopAndBottomMargin(1, 2); @@ -4737,7 +4746,7 @@ test "Terminal: index from the bottom outside of scroll region" { test "Terminal: index no scroll region, top of screen" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.print('A'); @@ -4753,7 +4762,7 @@ test "Terminal: index no scroll region, top of screen" { test "Terminal: index bottom of primary screen" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setCursorPos(5, 1); @@ -4770,7 +4779,7 @@ test "Terminal: index bottom of primary screen" { test "Terminal: index bottom of primary screen background sgr" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setCursorPos(5, 1); @@ -4800,7 +4809,7 @@ test "Terminal: index bottom of primary screen background sgr" { test "Terminal: index inside scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setTopAndBottomMargin(1, 3); @@ -4817,7 +4826,7 @@ test "Terminal: index inside scroll region" { test "Terminal: index bottom of primary screen with scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setTopAndBottomMargin(1, 3); @@ -4838,7 +4847,7 @@ test "Terminal: index bottom of primary screen with scroll region" { test "Terminal: index outside left/right margin" { const alloc = testing.allocator; - var t = try init(alloc, 10, 5); + var t = try init(alloc, .{ .cols = 10, .rows = 5 }); defer t.deinit(alloc); t.setTopAndBottomMargin(1, 3); @@ -4859,7 +4868,7 @@ test "Terminal: index outside left/right margin" { test "Terminal: index inside left/right margin" { const alloc = testing.allocator; - var t = try init(alloc, 10, 5); + var t = try init(alloc, .{ .cols = 10, .rows = 5 }); defer t.deinit(alloc); try t.printString("AAAAAA"); @@ -4887,7 +4896,7 @@ test "Terminal: index inside left/right margin" { test "Terminal: index bottom of scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setTopAndBottomMargin(1, 3); @@ -4907,7 +4916,7 @@ test "Terminal: index bottom of scroll region" { test "Terminal: cursorUp basic" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setCursorPos(3, 1); @@ -4924,7 +4933,7 @@ test "Terminal: cursorUp basic" { test "Terminal: cursorUp below top scroll margin" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setTopAndBottomMargin(2, 4); @@ -4942,7 +4951,7 @@ test "Terminal: cursorUp below top scroll margin" { test "Terminal: cursorUp above top scroll margin" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setTopAndBottomMargin(3, 5); @@ -4961,7 +4970,7 @@ test "Terminal: cursorUp above top scroll margin" { test "Terminal: cursorUp resets wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -4979,7 +4988,7 @@ test "Terminal: cursorUp resets wrap" { test "Terminal: cursorLeft no wrap" { const alloc = testing.allocator; - var t = try init(alloc, 10, 5); + var t = try init(alloc, .{ .cols = 10, .rows = 5 }); defer t.deinit(alloc); try t.print('A'); @@ -4997,7 +5006,7 @@ test "Terminal: cursorLeft no wrap" { test "Terminal: cursorLeft unsets pending wrap state" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -5015,7 +5024,7 @@ test "Terminal: cursorLeft unsets pending wrap state" { test "Terminal: cursorLeft unsets pending wrap state with longer jump" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -5033,7 +5042,7 @@ test "Terminal: cursorLeft unsets pending wrap state with longer jump" { test "Terminal: cursorLeft reverse wrap with pending wrap state" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.modes.set(.wraparound, true); @@ -5054,7 +5063,7 @@ test "Terminal: cursorLeft reverse wrap with pending wrap state" { test "Terminal: cursorLeft reverse wrap extended with pending wrap state" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.modes.set(.wraparound, true); @@ -5075,7 +5084,7 @@ test "Terminal: cursorLeft reverse wrap extended with pending wrap state" { test "Terminal: cursorLeft reverse wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.modes.set(.wraparound, true); @@ -5095,7 +5104,7 @@ test "Terminal: cursorLeft reverse wrap" { test "Terminal: cursorLeft reverse wrap with no soft wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.modes.set(.wraparound, true); @@ -5117,7 +5126,7 @@ test "Terminal: cursorLeft reverse wrap with no soft wrap" { test "Terminal: cursorLeft reverse wrap before left margin" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.modes.set(.wraparound, true); @@ -5135,7 +5144,7 @@ test "Terminal: cursorLeft reverse wrap before left margin" { test "Terminal: cursorLeft extended reverse wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.modes.set(.wraparound, true); @@ -5157,7 +5166,7 @@ test "Terminal: cursorLeft extended reverse wrap" { test "Terminal: cursorLeft extended reverse wrap bottom wraparound" { const alloc = testing.allocator; - var t = try init(alloc, 5, 3); + var t = try init(alloc, .{ .cols = 5, .rows = 3 }); defer t.deinit(alloc); t.modes.set(.wraparound, true); @@ -5179,7 +5188,7 @@ test "Terminal: cursorLeft extended reverse wrap bottom wraparound" { test "Terminal: cursorLeft extended reverse wrap is priority if both set" { const alloc = testing.allocator; - var t = try init(alloc, 5, 3); + var t = try init(alloc, .{ .cols = 5, .rows = 3 }); defer t.deinit(alloc); t.modes.set(.wraparound, true); @@ -5202,7 +5211,7 @@ test "Terminal: cursorLeft extended reverse wrap is priority if both set" { test "Terminal: cursorLeft extended reverse wrap above top scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.modes.set(.wraparound, true); @@ -5218,7 +5227,7 @@ test "Terminal: cursorLeft extended reverse wrap above top scroll region" { test "Terminal: cursorLeft reverse wrap on first row" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.modes.set(.wraparound, true); @@ -5234,7 +5243,7 @@ test "Terminal: cursorLeft reverse wrap on first row" { test "Terminal: cursorDown basic" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.print('A'); @@ -5250,7 +5259,7 @@ test "Terminal: cursorDown basic" { test "Terminal: cursorDown above bottom scroll margin" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setTopAndBottomMargin(1, 3); @@ -5267,7 +5276,7 @@ test "Terminal: cursorDown above bottom scroll margin" { test "Terminal: cursorDown below bottom scroll margin" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setTopAndBottomMargin(1, 3); @@ -5285,7 +5294,7 @@ test "Terminal: cursorDown below bottom scroll margin" { test "Terminal: cursorDown resets wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -5303,7 +5312,7 @@ test "Terminal: cursorDown resets wrap" { test "Terminal: cursorRight resets wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -5321,7 +5330,7 @@ test "Terminal: cursorRight resets wrap" { test "Terminal: cursorRight to the edge of screen" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.cursorRight(100); @@ -5336,7 +5345,7 @@ test "Terminal: cursorRight to the edge of screen" { test "Terminal: cursorRight left of right margin" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.scrolling_region.right = 2; @@ -5352,7 +5361,7 @@ test "Terminal: cursorRight left of right margin" { test "Terminal: cursorRight right of right margin" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.scrolling_region.right = 2; @@ -5369,7 +5378,7 @@ test "Terminal: cursorRight right of right margin" { test "Terminal: deleteLines simple" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -5391,7 +5400,7 @@ test "Terminal: deleteLines simple" { test "Terminal: deleteLines colors with bg color" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("ABC"); @@ -5429,7 +5438,7 @@ test "Terminal: deleteLines colors with bg color" { test "Terminal: deleteLines (legacy)" { const alloc = testing.allocator; - var t = try init(alloc, 80, 80); + var t = try init(alloc, .{ .cols = 80, .rows = 80 }); defer t.deinit(alloc); // Initial value @@ -5464,7 +5473,7 @@ test "Terminal: deleteLines (legacy)" { test "Terminal: deleteLines with scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 80, 80); + var t = try init(alloc, .{ .cols = 80, .rows = 80 }); defer t.deinit(alloc); // Initial value @@ -5501,7 +5510,7 @@ test "Terminal: deleteLines with scroll region" { // X test "Terminal: deleteLines with scroll region, large count" { const alloc = testing.allocator; - var t = try init(alloc, 80, 80); + var t = try init(alloc, .{ .cols = 80, .rows = 80 }); defer t.deinit(alloc); // Initial value @@ -5538,7 +5547,7 @@ test "Terminal: deleteLines with scroll region, large count" { // X test "Terminal: deleteLines with scroll region, cursor outside of region" { const alloc = testing.allocator; - var t = try init(alloc, 80, 80); + var t = try init(alloc, .{ .cols = 80, .rows = 80 }); defer t.deinit(alloc); // Initial value @@ -5566,7 +5575,7 @@ test "Terminal: deleteLines with scroll region, cursor outside of region" { test "Terminal: deleteLines resets wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -5584,7 +5593,7 @@ test "Terminal: deleteLines resets wrap" { test "Terminal: deleteLines left/right scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 10, 10); + var t = try init(alloc, .{ .cols = 10, .rows = 10 }); defer t.deinit(alloc); try t.printString("ABC123"); @@ -5608,7 +5617,7 @@ test "Terminal: deleteLines left/right scroll region" { test "Terminal: deleteLines left/right scroll region from top" { const alloc = testing.allocator; - var t = try init(alloc, 10, 10); + var t = try init(alloc, .{ .cols = 10, .rows = 10 }); defer t.deinit(alloc); try t.printString("ABC123"); @@ -5632,7 +5641,7 @@ test "Terminal: deleteLines left/right scroll region from top" { test "Terminal: deleteLines left/right scroll region high count" { const alloc = testing.allocator; - var t = try init(alloc, 10, 10); + var t = try init(alloc, .{ .cols = 10, .rows = 10 }); defer t.deinit(alloc); try t.printString("ABC123"); @@ -5656,7 +5665,7 @@ test "Terminal: deleteLines left/right scroll region high count" { test "Terminal: default style is empty" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.print('A'); @@ -5671,7 +5680,7 @@ test "Terminal: default style is empty" { test "Terminal: bold style" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.setAttribute(.{ .bold = {} }); @@ -5688,7 +5697,7 @@ test "Terminal: bold style" { test "Terminal: garbage collect overwritten" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.setAttribute(.{ .bold = {} }); @@ -5711,7 +5720,7 @@ test "Terminal: garbage collect overwritten" { test "Terminal: do not garbage collect old styles in use" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.setAttribute(.{ .bold = {} }); @@ -5733,7 +5742,7 @@ test "Terminal: do not garbage collect old styles in use" { test "Terminal: print with style marks the row as styled" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.setAttribute(.{ .bold = {} }); @@ -5749,7 +5758,7 @@ test "Terminal: print with style marks the row as styled" { test "Terminal: DECALN" { const alloc = testing.allocator; - var t = try init(alloc, 2, 2); + var t = try init(alloc, .{ .cols = 2, .rows = 2 }); defer t.deinit(alloc); // Initial value @@ -5771,7 +5780,7 @@ test "Terminal: DECALN" { test "Terminal: decaln reset margins" { const alloc = testing.allocator; - var t = try init(alloc, 3, 3); + var t = try init(alloc, .{ .cols = 3, .rows = 3 }); defer t.deinit(alloc); // Initial value @@ -5789,7 +5798,7 @@ test "Terminal: decaln reset margins" { test "Terminal: decaln preserves color" { const alloc = testing.allocator; - var t = try init(alloc, 3, 3); + var t = try init(alloc, .{ .cols = 3, .rows = 3 }); defer t.deinit(alloc); // Initial value @@ -5820,7 +5829,7 @@ test "Terminal: insertBlanks" { // NOTE: this is not verified with conformance tests, so these // tests might actually be verifying wrong behavior. const alloc = testing.allocator; - var t = try init(alloc, 5, 2); + var t = try init(alloc, .{ .cols = 5, .rows = 2 }); defer t.deinit(alloc); try t.print('A'); @@ -5840,7 +5849,7 @@ test "Terminal: insertBlanks pushes off end" { // NOTE: this is not verified with conformance tests, so these // tests might actually be verifying wrong behavior. const alloc = testing.allocator; - var t = try init(alloc, 3, 2); + var t = try init(alloc, .{ .cols = 3, .rows = 2 }); defer t.deinit(alloc); try t.print('A'); @@ -5860,7 +5869,7 @@ test "Terminal: insertBlanks more than size" { // NOTE: this is not verified with conformance tests, so these // tests might actually be verifying wrong behavior. const alloc = testing.allocator; - var t = try init(alloc, 3, 2); + var t = try init(alloc, .{ .cols = 3, .rows = 2 }); defer t.deinit(alloc); try t.print('A'); @@ -5878,7 +5887,7 @@ test "Terminal: insertBlanks more than size" { test "Terminal: insertBlanks no scroll region, fits" { const alloc = testing.allocator; - var t = try init(alloc, 10, 10); + var t = try init(alloc, .{ .cols = 10, .rows = 10 }); defer t.deinit(alloc); for ("ABC") |c| try t.print(c); @@ -5894,7 +5903,7 @@ test "Terminal: insertBlanks no scroll region, fits" { test "Terminal: insertBlanks preserves background sgr" { const alloc = testing.allocator; - var t = try init(alloc, 10, 10); + var t = try init(alloc, .{ .cols = 10, .rows = 10 }); defer t.deinit(alloc); for ("ABC") |c| try t.print(c); @@ -5924,7 +5933,7 @@ test "Terminal: insertBlanks preserves background sgr" { test "Terminal: insertBlanks shift off screen" { const alloc = testing.allocator; - var t = try init(alloc, 5, 10); + var t = try init(alloc, .{ .cols = 5, .rows = 10 }); defer t.deinit(alloc); for (" ABC") |c| try t.print(c); @@ -5941,7 +5950,7 @@ test "Terminal: insertBlanks shift off screen" { test "Terminal: insertBlanks split multi-cell character" { const alloc = testing.allocator; - var t = try init(alloc, 5, 10); + var t = try init(alloc, .{ .cols = 5, .rows = 10 }); defer t.deinit(alloc); for ("123") |c| try t.print(c); @@ -5958,7 +5967,7 @@ test "Terminal: insertBlanks split multi-cell character" { test "Terminal: insertBlanks inside left/right scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 10, 10); + var t = try init(alloc, .{ .cols = 10, .rows = 10 }); defer t.deinit(alloc); t.scrolling_region.left = 2; @@ -5978,7 +5987,7 @@ test "Terminal: insertBlanks inside left/right scroll region" { test "Terminal: insertBlanks outside left/right scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 6, 10); + var t = try init(alloc, .{ .cols = 6, .rows = 10 }); defer t.deinit(alloc); t.setCursorPos(1, 4); @@ -5999,7 +6008,7 @@ test "Terminal: insertBlanks outside left/right scroll region" { test "Terminal: insertBlanks left/right scroll region large count" { const alloc = testing.allocator; - var t = try init(alloc, 10, 10); + var t = try init(alloc, .{ .cols = 10, .rows = 10 }); defer t.deinit(alloc); t.modes.set(.origin, true); @@ -6018,7 +6027,7 @@ test "Terminal: insertBlanks left/right scroll region large count" { test "Terminal: insertBlanks deleting graphemes" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); // Disable grapheme clustering @@ -6052,7 +6061,7 @@ test "Terminal: insertBlanks deleting graphemes" { test "Terminal: insertBlanks shift graphemes" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); // Disable grapheme clustering @@ -6086,7 +6095,7 @@ test "Terminal: insertBlanks shift graphemes" { test "Terminal: insert mode with space" { const alloc = testing.allocator; - var t = try init(alloc, 10, 2); + var t = try init(alloc, .{ .cols = 10, .rows = 2 }); defer t.deinit(alloc); for ("hello") |c| try t.print(c); @@ -6103,7 +6112,7 @@ test "Terminal: insert mode with space" { test "Terminal: insert mode doesn't wrap pushed characters" { const alloc = testing.allocator; - var t = try init(alloc, 5, 2); + var t = try init(alloc, .{ .cols = 5, .rows = 2 }); defer t.deinit(alloc); for ("hello") |c| try t.print(c); @@ -6120,7 +6129,7 @@ test "Terminal: insert mode doesn't wrap pushed characters" { test "Terminal: insert mode does nothing at the end of the line" { const alloc = testing.allocator; - var t = try init(alloc, 5, 2); + var t = try init(alloc, .{ .cols = 5, .rows = 2 }); defer t.deinit(alloc); for ("hello") |c| try t.print(c); @@ -6136,7 +6145,7 @@ test "Terminal: insert mode does nothing at the end of the line" { test "Terminal: insert mode with wide characters" { const alloc = testing.allocator; - var t = try init(alloc, 5, 2); + var t = try init(alloc, .{ .cols = 5, .rows = 2 }); defer t.deinit(alloc); for ("hello") |c| try t.print(c); @@ -6153,7 +6162,7 @@ test "Terminal: insert mode with wide characters" { test "Terminal: insert mode with wide characters at end" { const alloc = testing.allocator; - var t = try init(alloc, 5, 2); + var t = try init(alloc, .{ .cols = 5, .rows = 2 }); defer t.deinit(alloc); for ("well") |c| try t.print(c); @@ -6169,7 +6178,7 @@ test "Terminal: insert mode with wide characters at end" { test "Terminal: insert mode pushing off wide character" { const alloc = testing.allocator; - var t = try init(alloc, 5, 2); + var t = try init(alloc, .{ .cols = 5, .rows = 2 }); defer t.deinit(alloc); for ("123") |c| try t.print(c); @@ -6187,7 +6196,7 @@ test "Terminal: insert mode pushing off wide character" { test "Terminal: deleteChars" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -6203,7 +6212,7 @@ test "Terminal: deleteChars" { test "Terminal: deleteChars zero count" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -6219,7 +6228,7 @@ test "Terminal: deleteChars zero count" { test "Terminal: deleteChars more than half" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -6235,7 +6244,7 @@ test "Terminal: deleteChars more than half" { test "Terminal: deleteChars more than line width" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -6251,7 +6260,7 @@ test "Terminal: deleteChars more than line width" { test "Terminal: deleteChars should shift left" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -6267,7 +6276,7 @@ test "Terminal: deleteChars should shift left" { test "Terminal: deleteChars resets wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -6285,7 +6294,7 @@ test "Terminal: deleteChars resets wrap" { test "Terminal: deleteChars simple operation" { const alloc = testing.allocator; - var t = try init(alloc, 10, 10); + var t = try init(alloc, .{ .cols = 10, .rows = 10 }); defer t.deinit(alloc); try t.printString("ABC123"); @@ -6301,7 +6310,7 @@ test "Terminal: deleteChars simple operation" { test "Terminal: deleteChars preserves background sgr" { const alloc = testing.allocator; - var t = try init(alloc, 10, 10); + var t = try init(alloc, .{ .cols = 10, .rows = 10 }); defer t.deinit(alloc); for ("ABC123") |c| try t.print(c); @@ -6331,7 +6340,7 @@ test "Terminal: deleteChars preserves background sgr" { test "Terminal: deleteChars outside scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 6, 10); + var t = try init(alloc, .{ .cols = 6, .rows = 10 }); defer t.deinit(alloc); try t.printString("ABC123"); @@ -6350,7 +6359,7 @@ test "Terminal: deleteChars outside scroll region" { test "Terminal: deleteChars inside scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 6, 10); + var t = try init(alloc, .{ .cols = 6, .rows = 10 }); defer t.deinit(alloc); try t.printString("ABC123"); @@ -6368,7 +6377,7 @@ test "Terminal: deleteChars inside scroll region" { test "Terminal: deleteChars split wide character" { const alloc = testing.allocator; - var t = try init(alloc, 6, 10); + var t = try init(alloc, .{ .cols = 6, .rows = 10 }); defer t.deinit(alloc); try t.printString("A橋123"); @@ -6384,7 +6393,7 @@ test "Terminal: deleteChars split wide character" { test "Terminal: deleteChars split wide character tail" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setCursorPos(1, t.cols - 1); @@ -6402,7 +6411,7 @@ test "Terminal: deleteChars split wide character tail" { test "Terminal: saveCursor" { const alloc = testing.allocator; - var t = try init(alloc, 3, 3); + var t = try init(alloc, .{ .cols = 3, .rows = 3 }); defer t.deinit(alloc); try t.setAttribute(.{ .bold = {} }); @@ -6420,7 +6429,7 @@ test "Terminal: saveCursor" { test "Terminal: saveCursor with screen change" { const alloc = testing.allocator; - var t = try init(alloc, 3, 3); + var t = try init(alloc, .{ .cols = 3, .rows = 3 }); defer t.deinit(alloc); try t.setAttribute(.{ .bold = {} }); @@ -6451,7 +6460,7 @@ test "Terminal: saveCursor with screen change" { test "Terminal: saveCursor position" { const alloc = testing.allocator; - var t = try init(alloc, 10, 5); + var t = try init(alloc, .{ .cols = 10, .rows = 5 }); defer t.deinit(alloc); t.setCursorPos(1, 5); @@ -6471,7 +6480,7 @@ test "Terminal: saveCursor position" { test "Terminal: saveCursor pending wrap state" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setCursorPos(1, 5); @@ -6491,7 +6500,7 @@ test "Terminal: saveCursor pending wrap state" { test "Terminal: saveCursor origin mode" { const alloc = testing.allocator; - var t = try init(alloc, 10, 5); + var t = try init(alloc, .{ .cols = 10, .rows = 5 }); defer t.deinit(alloc); t.modes.set(.origin, true); @@ -6511,7 +6520,7 @@ test "Terminal: saveCursor origin mode" { test "Terminal: saveCursor resize" { const alloc = testing.allocator; - var t = try init(alloc, 10, 5); + var t = try init(alloc, .{ .cols = 10, .rows = 5 }); defer t.deinit(alloc); t.setCursorPos(1, 10); @@ -6529,7 +6538,7 @@ test "Terminal: saveCursor resize" { test "Terminal: saveCursor protected pen" { const alloc = testing.allocator; - var t = try init(alloc, 10, 5); + var t = try init(alloc, .{ .cols = 10, .rows = 5 }); defer t.deinit(alloc); t.setProtectedMode(.iso); @@ -6544,7 +6553,7 @@ test "Terminal: saveCursor protected pen" { test "Terminal: setProtectedMode" { const alloc = testing.allocator; - var t = try init(alloc, 3, 3); + var t = try init(alloc, .{ .cols = 3, .rows = 3 }); defer t.deinit(alloc); try testing.expect(!t.screen.cursor.protected); @@ -6560,7 +6569,7 @@ test "Terminal: setProtectedMode" { test "Terminal: eraseLine simple erase right" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -6576,7 +6585,7 @@ test "Terminal: eraseLine simple erase right" { test "Terminal: eraseLine resets pending wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -6594,7 +6603,7 @@ test "Terminal: eraseLine resets pending wrap" { test "Terminal: eraseLine resets wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE123") |c| try t.print(c); @@ -6621,7 +6630,7 @@ test "Terminal: eraseLine resets wrap" { test "Terminal: eraseLine right preserves background sgr" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -6651,7 +6660,7 @@ test "Terminal: eraseLine right preserves background sgr" { test "Terminal: eraseLine right wide character" { const alloc = testing.allocator; - var t = try init(alloc, 10, 5); + var t = try init(alloc, .{ .cols = 10, .rows = 5 }); defer t.deinit(alloc); for ("AB") |c| try t.print(c); @@ -6669,7 +6678,7 @@ test "Terminal: eraseLine right wide character" { test "Terminal: eraseLine right protected attributes respected with iso" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.iso); @@ -6686,7 +6695,7 @@ test "Terminal: eraseLine right protected attributes respected with iso" { test "Terminal: eraseLine right protected attributes ignored with dec most recent" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.iso); @@ -6705,7 +6714,7 @@ test "Terminal: eraseLine right protected attributes ignored with dec most recen test "Terminal: eraseLine right protected attributes ignored with dec set" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.dec); @@ -6722,7 +6731,7 @@ test "Terminal: eraseLine right protected attributes ignored with dec set" { test "Terminal: eraseLine right protected requested" { const alloc = testing.allocator; - var t = try init(alloc, 10, 5); + var t = try init(alloc, .{ .cols = 10, .rows = 5 }); defer t.deinit(alloc); for ("12345678") |c| try t.print(c); @@ -6741,7 +6750,7 @@ test "Terminal: eraseLine right protected requested" { test "Terminal: eraseLine simple erase left" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -6757,7 +6766,7 @@ test "Terminal: eraseLine simple erase left" { test "Terminal: eraseLine left resets wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -6775,7 +6784,7 @@ test "Terminal: eraseLine left resets wrap" { test "Terminal: eraseLine left preserves background sgr" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -6805,7 +6814,7 @@ test "Terminal: eraseLine left preserves background sgr" { test "Terminal: eraseLine left wide character" { const alloc = testing.allocator; - var t = try init(alloc, 10, 5); + var t = try init(alloc, .{ .cols = 10, .rows = 5 }); defer t.deinit(alloc); for ("AB") |c| try t.print(c); @@ -6823,7 +6832,7 @@ test "Terminal: eraseLine left wide character" { test "Terminal: eraseLine left protected attributes respected with iso" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.iso); @@ -6840,7 +6849,7 @@ test "Terminal: eraseLine left protected attributes respected with iso" { test "Terminal: eraseLine left protected attributes ignored with dec most recent" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.iso); @@ -6859,7 +6868,7 @@ test "Terminal: eraseLine left protected attributes ignored with dec most recent test "Terminal: eraseLine left protected attributes ignored with dec set" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.dec); @@ -6876,7 +6885,7 @@ test "Terminal: eraseLine left protected attributes ignored with dec set" { test "Terminal: eraseLine left protected requested" { const alloc = testing.allocator; - var t = try init(alloc, 10, 5); + var t = try init(alloc, .{ .cols = 10, .rows = 5 }); defer t.deinit(alloc); for ("123456789") |c| try t.print(c); @@ -6895,7 +6904,7 @@ test "Terminal: eraseLine left protected requested" { test "Terminal: eraseLine complete preserves background sgr" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -6925,7 +6934,7 @@ test "Terminal: eraseLine complete preserves background sgr" { test "Terminal: eraseLine complete protected attributes respected with iso" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.iso); @@ -6942,7 +6951,7 @@ test "Terminal: eraseLine complete protected attributes respected with iso" { test "Terminal: eraseLine complete protected attributes ignored with dec most recent" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.iso); @@ -6961,7 +6970,7 @@ test "Terminal: eraseLine complete protected attributes ignored with dec most re test "Terminal: eraseLine complete protected attributes ignored with dec set" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.dec); @@ -6978,7 +6987,7 @@ test "Terminal: eraseLine complete protected attributes ignored with dec set" { test "Terminal: eraseLine complete protected requested" { const alloc = testing.allocator; - var t = try init(alloc, 10, 5); + var t = try init(alloc, .{ .cols = 10, .rows = 5 }); defer t.deinit(alloc); for ("123456789") |c| try t.print(c); @@ -6997,7 +7006,7 @@ test "Terminal: eraseLine complete protected requested" { test "Terminal: tabClear single" { const alloc = testing.allocator; - var t = try init(alloc, 30, 5); + var t = try init(alloc, .{ .cols = 30, .rows = 5 }); defer t.deinit(alloc); try t.horizontalTab(); @@ -7009,7 +7018,7 @@ test "Terminal: tabClear single" { test "Terminal: tabClear all" { const alloc = testing.allocator; - var t = try init(alloc, 30, 5); + var t = try init(alloc, .{ .cols = 30, .rows = 5 }); defer t.deinit(alloc); t.tabClear(.all); @@ -7020,7 +7029,7 @@ test "Terminal: tabClear all" { test "Terminal: printRepeat simple" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("A"); @@ -7035,7 +7044,7 @@ test "Terminal: printRepeat simple" { test "Terminal: printRepeat wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString(" A"); @@ -7050,7 +7059,7 @@ test "Terminal: printRepeat wrap" { test "Terminal: printRepeat no previous character" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printRepeat(1); @@ -7064,7 +7073,7 @@ test "Terminal: printRepeat no previous character" { test "Terminal: printAttributes" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); var storage: [64]u8 = undefined; @@ -7115,7 +7124,7 @@ test "Terminal: printAttributes" { test "Terminal: eraseDisplay simple erase below" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABC") |c| try t.print(c); @@ -7137,7 +7146,7 @@ test "Terminal: eraseDisplay simple erase below" { test "Terminal: eraseDisplay erase below preserves SGR bg" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABC") |c| try t.print(c); @@ -7174,7 +7183,7 @@ test "Terminal: eraseDisplay erase below preserves SGR bg" { test "Terminal: eraseDisplay below split multi-cell" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("AB橋C"); @@ -7196,7 +7205,7 @@ test "Terminal: eraseDisplay below split multi-cell" { test "Terminal: eraseDisplay below protected attributes respected with iso" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.iso); @@ -7219,7 +7228,7 @@ test "Terminal: eraseDisplay below protected attributes respected with iso" { test "Terminal: eraseDisplay below protected attributes ignored with dec most recent" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.iso); @@ -7244,7 +7253,7 @@ test "Terminal: eraseDisplay below protected attributes ignored with dec most re test "Terminal: eraseDisplay below protected attributes ignored with dec set" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.dec); @@ -7267,7 +7276,7 @@ test "Terminal: eraseDisplay below protected attributes ignored with dec set" { test "Terminal: eraseDisplay below protected attributes respected with force" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.dec); @@ -7290,7 +7299,7 @@ test "Terminal: eraseDisplay below protected attributes respected with force" { test "Terminal: eraseDisplay simple erase above" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABC") |c| try t.print(c); @@ -7312,7 +7321,7 @@ test "Terminal: eraseDisplay simple erase above" { test "Terminal: eraseDisplay erase above preserves SGR bg" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABC") |c| try t.print(c); @@ -7349,7 +7358,7 @@ test "Terminal: eraseDisplay erase above preserves SGR bg" { test "Terminal: eraseDisplay above split multi-cell" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.printString("AB橋C"); @@ -7371,7 +7380,7 @@ test "Terminal: eraseDisplay above split multi-cell" { test "Terminal: eraseDisplay above protected attributes respected with iso" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.iso); @@ -7394,7 +7403,7 @@ test "Terminal: eraseDisplay above protected attributes respected with iso" { test "Terminal: eraseDisplay above protected attributes ignored with dec most recent" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.iso); @@ -7419,7 +7428,7 @@ test "Terminal: eraseDisplay above protected attributes ignored with dec most re test "Terminal: eraseDisplay above protected attributes ignored with dec set" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.dec); @@ -7442,7 +7451,7 @@ test "Terminal: eraseDisplay above protected attributes ignored with dec set" { test "Terminal: eraseDisplay above protected attributes respected with force" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.setProtectedMode(.dec); @@ -7465,7 +7474,7 @@ test "Terminal: eraseDisplay above protected attributes respected with force" { test "Terminal: eraseDisplay protected complete" { const alloc = testing.allocator; - var t = try init(alloc, 10, 5); + var t = try init(alloc, .{ .cols = 10, .rows = 5 }); defer t.deinit(alloc); try t.print('A'); @@ -7487,7 +7496,7 @@ test "Terminal: eraseDisplay protected complete" { test "Terminal: eraseDisplay protected below" { const alloc = testing.allocator; - var t = try init(alloc, 10, 5); + var t = try init(alloc, .{ .cols = 10, .rows = 5 }); defer t.deinit(alloc); try t.print('A'); @@ -7509,7 +7518,7 @@ test "Terminal: eraseDisplay protected below" { test "Terminal: eraseDisplay scroll complete" { const alloc = testing.allocator; - var t = try init(alloc, 10, 5); + var t = try init(alloc, .{ .cols = 10, .rows = 5 }); defer t.deinit(alloc); try t.print('A'); @@ -7526,7 +7535,7 @@ test "Terminal: eraseDisplay scroll complete" { test "Terminal: eraseDisplay protected above" { const alloc = testing.allocator; - var t = try init(alloc, 10, 3); + var t = try init(alloc, .{ .cols = 10, .rows = 3 }); defer t.deinit(alloc); try t.print('A'); @@ -7548,7 +7557,7 @@ test "Terminal: eraseDisplay protected above" { test "Terminal: cursorIsAtPrompt" { const alloc = testing.allocator; - var t = try init(alloc, 3, 2); + var t = try init(alloc, .{ .cols = 3, .rows = 2 }); defer t.deinit(alloc); try testing.expect(!t.cursorIsAtPrompt()); @@ -7578,7 +7587,7 @@ test "Terminal: cursorIsAtPrompt" { test "Terminal: cursorIsAtPrompt alternate screen" { const alloc = testing.allocator; - var t = try init(alloc, 3, 2); + var t = try init(alloc, .{ .cols = 3, .rows = 2 }); defer t.deinit(alloc); try testing.expect(!t.cursorIsAtPrompt()); @@ -7593,7 +7602,7 @@ test "Terminal: cursorIsAtPrompt alternate screen" { } test "Terminal: fullReset with a non-empty pen" { - var t = try init(testing.allocator, 80, 80); + var t = try init(testing.allocator, .{ .cols = 80, .rows = 80 }); defer t.deinit(testing.allocator); try t.setAttribute(.{ .direct_color_fg = .{ .r = 0xFF, .g = 0, .b = 0x7F } }); @@ -7611,7 +7620,7 @@ test "Terminal: fullReset with a non-empty pen" { } test "Terminal: fullReset origin mode" { - var t = try init(testing.allocator, 10, 10); + var t = try init(testing.allocator, .{ .cols = 10, .rows = 10 }); defer t.deinit(testing.allocator); t.setCursorPos(3, 5); @@ -7625,7 +7634,7 @@ test "Terminal: fullReset origin mode" { } test "Terminal: fullReset status display" { - var t = try init(testing.allocator, 10, 10); + var t = try init(testing.allocator, .{ .cols = 10, .rows = 10 }); defer t.deinit(testing.allocator); t.status_display = .status_line; @@ -7638,7 +7647,7 @@ test "Terminal: fullReset status display" { // this test around to ensure we don't regress at multiple layers. test "Terminal: resize less cols with wide char then print" { const alloc = testing.allocator; - var t = try init(alloc, 3, 3); + var t = try init(alloc, .{ .cols = 3, .rows = 3 }); defer t.deinit(alloc); try t.print('x'); @@ -7654,7 +7663,7 @@ test "Terminal: resize with left and right margin set" { const alloc = testing.allocator; const cols = 70; const rows = 23; - var t = try init(alloc, cols, rows); + var t = try init(alloc, .{ .cols = cols, .rows = rows }); defer t.deinit(alloc); t.modes.set(.enable_left_and_right_margin, true); @@ -7672,7 +7681,7 @@ test "Terminal: resize with wraparound off" { const alloc = testing.allocator; const cols = 4; const rows = 2; - var t = try init(alloc, cols, rows); + var t = try init(alloc, .{ .cols = cols, .rows = rows }); defer t.deinit(alloc); t.modes.set(.wraparound, false); @@ -7692,7 +7701,7 @@ test "Terminal: resize with wraparound on" { const alloc = testing.allocator; const cols = 4; const rows = 2; - var t = try init(alloc, cols, rows); + var t = try init(alloc, .{ .cols = cols, .rows = rows }); defer t.deinit(alloc); t.modes.set(.wraparound, true); @@ -7710,7 +7719,7 @@ test "Terminal: resize with wraparound on" { test "Terminal: resize with high unique style per cell" { const alloc = testing.allocator; - var t = try init(alloc, 30, 30); + var t = try init(alloc, .{ .cols = 30, .rows = 30 }); defer t.deinit(alloc); for (0..t.rows) |y| { @@ -7730,7 +7739,7 @@ test "Terminal: resize with high unique style per cell" { test "Terminal: resize with high unique style per cell with wrapping" { const alloc = testing.allocator; - var t = try init(alloc, 30, 30); + var t = try init(alloc, .{ .cols = 30, .rows = 30 }); defer t.deinit(alloc); const cell_count: u16 = @intCast(t.rows * t.cols); @@ -7751,7 +7760,7 @@ test "Terminal: resize with high unique style per cell with wrapping" { test "Terminal: DECCOLM without DEC mode 40" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.modes.set(.@"132_column", true); @@ -7763,7 +7772,7 @@ test "Terminal: DECCOLM without DEC mode 40" { test "Terminal: DECCOLM unset" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.modes.set(.enable_mode_3, true); @@ -7774,7 +7783,7 @@ test "Terminal: DECCOLM unset" { test "Terminal: DECCOLM resets pending wrap" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); for ("ABCDE") |c| try t.print(c); @@ -7789,7 +7798,7 @@ test "Terminal: DECCOLM resets pending wrap" { test "Terminal: DECCOLM preserves SGR bg" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); try t.setAttribute(.{ .direct_color_bg = .{ @@ -7813,7 +7822,7 @@ test "Terminal: DECCOLM preserves SGR bg" { test "Terminal: DECCOLM resets scroll region" { const alloc = testing.allocator; - var t = try init(alloc, 5, 5); + var t = try init(alloc, .{ .rows = 5, .cols = 5 }); defer t.deinit(alloc); t.modes.set(.enable_left_and_right_margin, true); diff --git a/src/terminal/kitty/graphics_storage.zig b/src/terminal/kitty/graphics_storage.zig index 534d1b33f..231c8fddd 100644 --- a/src/terminal/kitty/graphics_storage.zig +++ b/src/terminal/kitty/graphics_storage.zig @@ -645,7 +645,7 @@ fn trackPin( test "storage: add placement with zero placement id" { const testing = std.testing; const alloc = testing.allocator; - var t = try terminal.Terminal.init(alloc, 100, 100); + var t = try terminal.Terminal.init(alloc, .{ .cols = 100, .rows = 100 }); defer t.deinit(alloc); t.width_px = 100; t.height_px = 100; @@ -674,7 +674,7 @@ test "storage: add placement with zero placement id" { test "storage: delete all placements and images" { const testing = std.testing; const alloc = testing.allocator; - var t = try terminal.Terminal.init(alloc, 3, 3); + var t = try terminal.Terminal.init(alloc, .{ .rows = 3, .cols = 3 }); defer t.deinit(alloc); const tracked = t.screen.pages.countTrackedPins(); @@ -697,7 +697,7 @@ test "storage: delete all placements and images" { test "storage: delete all placements and images preserves limit" { const testing = std.testing; const alloc = testing.allocator; - var t = try terminal.Terminal.init(alloc, 3, 3); + var t = try terminal.Terminal.init(alloc, .{ .rows = 3, .cols = 3 }); defer t.deinit(alloc); const tracked = t.screen.pages.countTrackedPins(); @@ -722,7 +722,7 @@ test "storage: delete all placements and images preserves limit" { test "storage: delete all placements" { const testing = std.testing; const alloc = testing.allocator; - var t = try terminal.Terminal.init(alloc, 3, 3); + var t = try terminal.Terminal.init(alloc, .{ .rows = 3, .cols = 3 }); defer t.deinit(alloc); const tracked = t.screen.pages.countTrackedPins(); @@ -745,7 +745,7 @@ test "storage: delete all placements" { test "storage: delete all placements by image id" { const testing = std.testing; const alloc = testing.allocator; - var t = try terminal.Terminal.init(alloc, 3, 3); + var t = try terminal.Terminal.init(alloc, .{ .rows = 3, .cols = 3 }); defer t.deinit(alloc); const tracked = t.screen.pages.countTrackedPins(); @@ -768,7 +768,7 @@ test "storage: delete all placements by image id" { test "storage: delete all placements by image id and unused images" { const testing = std.testing; const alloc = testing.allocator; - var t = try terminal.Terminal.init(alloc, 3, 3); + var t = try terminal.Terminal.init(alloc, .{ .rows = 3, .cols = 3 }); defer t.deinit(alloc); const tracked = t.screen.pages.countTrackedPins(); @@ -791,7 +791,7 @@ test "storage: delete all placements by image id and unused images" { test "storage: delete placement by specific id" { const testing = std.testing; const alloc = testing.allocator; - var t = try terminal.Terminal.init(alloc, 3, 3); + var t = try terminal.Terminal.init(alloc, .{ .rows = 3, .cols = 3 }); defer t.deinit(alloc); const tracked = t.screen.pages.countTrackedPins(); @@ -819,7 +819,7 @@ test "storage: delete placement by specific id" { test "storage: delete intersecting cursor" { const testing = std.testing; const alloc = testing.allocator; - var t = try terminal.Terminal.init(alloc, 100, 100); + var t = try terminal.Terminal.init(alloc, .{ .rows = 100, .cols = 100 }); defer t.deinit(alloc); t.width_px = 100; t.height_px = 100; @@ -851,7 +851,7 @@ test "storage: delete intersecting cursor" { test "storage: delete intersecting cursor plus unused" { const testing = std.testing; const alloc = testing.allocator; - var t = try terminal.Terminal.init(alloc, 100, 100); + var t = try terminal.Terminal.init(alloc, .{ .rows = 100, .cols = 100 }); defer t.deinit(alloc); t.width_px = 100; t.height_px = 100; @@ -883,7 +883,7 @@ test "storage: delete intersecting cursor plus unused" { test "storage: delete intersecting cursor hits multiple" { const testing = std.testing; const alloc = testing.allocator; - var t = try terminal.Terminal.init(alloc, 100, 100); + var t = try terminal.Terminal.init(alloc, .{ .rows = 100, .cols = 100 }); defer t.deinit(alloc); t.width_px = 100; t.height_px = 100; @@ -909,7 +909,7 @@ test "storage: delete intersecting cursor hits multiple" { test "storage: delete by column" { const testing = std.testing; const alloc = testing.allocator; - var t = try terminal.Terminal.init(alloc, 100, 100); + var t = try terminal.Terminal.init(alloc, .{ .rows = 100, .cols = 100 }); defer t.deinit(alloc); t.width_px = 100; t.height_px = 100; @@ -942,7 +942,7 @@ test "storage: delete by column" { test "storage: delete by row" { const testing = std.testing; const alloc = testing.allocator; - var t = try terminal.Terminal.init(alloc, 100, 100); + var t = try terminal.Terminal.init(alloc, .{ .rows = 100, .cols = 100 }); defer t.deinit(alloc); t.width_px = 100; t.height_px = 100; diff --git a/src/termio/Exec.zig b/src/termio/Exec.zig index 3e0ff071b..0acfe59a0 100644 --- a/src/termio/Exec.zig +++ b/src/termio/Exec.zig @@ -128,11 +128,11 @@ pub const DerivedConfig = struct { /// process. pub fn init(alloc: Allocator, opts: termio.Options) !Exec { // Create our terminal - var term = try terminal.Terminal.init( - alloc, - opts.grid_size.columns, - opts.grid_size.rows, - ); + var term = try terminal.Terminal.init(alloc, .{ + .cols = opts.grid_size.columns, + .rows = opts.grid_size.rows, + .max_scrollback = opts.full_config.@"scrollback-limit", + }); errdefer term.deinit(alloc); term.default_palette = opts.config.palette; term.color_palette.colors = opts.config.palette;