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