enable/disable autowrap

This commit is contained in:
Mitchell Hashimoto
2022-07-08 17:43:52 -07:00
parent 79f684ab0f
commit 4b6968e0d1
3 changed files with 9 additions and 1 deletions

View File

@ -748,6 +748,10 @@ pub fn setMode(self: *Window, mode: terminal.Mode, enabled: bool) !void {
self.terminal.setCursorPos(1, 1);
},
.autowrap => {
self.terminal.mode_autowrap = enabled;
},
.bracketed_paste => self.bracketed_paste = true,
else => if (enabled) log.warn("unimplemented mode: {}", .{mode}),

View File

@ -44,6 +44,7 @@ scrolling_region: ScrollingRegion,
/// Modes
// TODO: turn into a bitset probably
mode_origin: bool = false,
mode_autowrap: bool = true,
mode_reverse_colors: bool = false,
/// Scrolling region is the area of the screen designated where scrolling
@ -202,7 +203,7 @@ pub fn print(self: *Terminal, c: u21) !void {
defer tracy.end();
// If we're soft-wrapping, then handle that first.
if (self.cursor.pending_wrap) {
if (self.cursor.pending_wrap and self.mode_autowrap) {
// Mark that the cell is wrapped, which guarantees that there is
// at least one cell after it in the next row.
const cell = self.screen.getCell(self.cursor.y, self.cursor.x);

View File

@ -50,6 +50,9 @@ pub const Mode = enum(u16) {
/// the current scroll region.
origin = 6,
/// Enable or disable automatic line wrapping.
autowrap = 7,
/// Bracket clipboard paste contents in delimiter sequences.
///
/// When pasting from the (e.g. system) clipboard add "ESC [ 2 0 0 ~"