mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-21 03:06:15 +03:00
move bracketed paste to terminal state
This commit is contained in:
@ -80,9 +80,6 @@ grid_size: renderer.GridSize,
|
||||
/// The app configuration
|
||||
config: *const Config,
|
||||
|
||||
/// Bracketed paste mode
|
||||
bracketed_paste: bool = false,
|
||||
|
||||
/// Set to true for a single GLFW key/char callback cycle to cause the
|
||||
/// char callback to ignore. GLFW seems to always do key followed by char
|
||||
/// callbacks so we abuse that here. This is to solve an issue where commands
|
||||
@ -807,7 +804,13 @@ fn keyCallback(
|
||||
};
|
||||
|
||||
if (data.len > 0) {
|
||||
if (win.bracketed_paste) {
|
||||
const bracketed = bracketed: {
|
||||
win.renderer_state.mutex.lock();
|
||||
defer win.renderer_state.mutex.unlock();
|
||||
break :bracketed win.renderer_state.terminal.modes.bracketed_paste;
|
||||
};
|
||||
|
||||
if (bracketed) {
|
||||
_ = win.io_thread.mailbox.push(.{
|
||||
.write_stable = "\x1B[200~",
|
||||
}, .{ .forever = {} });
|
||||
@ -818,7 +821,7 @@ fn keyCallback(
|
||||
.write_stable = data,
|
||||
}, .{ .forever = {} });
|
||||
|
||||
if (win.bracketed_paste) {
|
||||
if (bracketed) {
|
||||
_ = win.io_thread.mailbox.push(.{
|
||||
.write_stable = "\x1B[201~",
|
||||
}, .{ .forever = {} });
|
||||
|
@ -75,6 +75,8 @@ modes: packed struct {
|
||||
mouse_event: MouseEvents = .none,
|
||||
mouse_format: MouseFormat = .x10,
|
||||
|
||||
bracketed_paste: bool = false, // 2004
|
||||
|
||||
test {
|
||||
// We have this here so that we explicitly fail when we change the
|
||||
// size of modes. The size of modes is NOT particularly important,
|
||||
|
@ -399,9 +399,6 @@ const StreamHandler = struct {
|
||||
grid_size: *renderer.GridSize,
|
||||
terminal: *terminal.Terminal,
|
||||
|
||||
/// Bracketed paste mode
|
||||
bracketed_paste: bool = false,
|
||||
|
||||
inline fn queueRender(self: *StreamHandler) !void {
|
||||
try self.ev.queueRender();
|
||||
}
|
||||
@ -559,7 +556,7 @@ const StreamHandler = struct {
|
||||
try self.queueRender();
|
||||
},
|
||||
|
||||
.bracketed_paste => self.bracketed_paste = true,
|
||||
.bracketed_paste => self.terminal.modes.bracketed_paste = enabled,
|
||||
|
||||
.enable_mode_3 => {
|
||||
// Disable deccolm
|
||||
|
Reference in New Issue
Block a user