mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-27 09:31:39 +00:00
vt: use struct literal for handler effects assignment
Assign handler.effects as a struct literal instead of setting fields individually. This lets the compiler catch missing fields if new effects are added to the Effects struct. Also sort the callback function typedefs in vt/terminal.h alphabetically (Bell, ColorScheme, DeviceAttributes, Enquiry, Size, TitleChanged, WritePty, Xtversion).
This commit is contained in:
@@ -253,14 +253,16 @@ fn new_(
|
||||
// Setup our stream with trampolines always installed so that
|
||||
// setting C callbacks at any time takes effect immediately.
|
||||
var handler: Stream.Handler = t.vtHandler();
|
||||
handler.effects.write_pty = &Effects.writePtyTrampoline;
|
||||
handler.effects.bell = &Effects.bellTrampoline;
|
||||
handler.effects.color_scheme = &Effects.colorSchemeTrampoline;
|
||||
handler.effects.device_attributes = &Effects.deviceAttributesTrampoline;
|
||||
handler.effects.enquiry = &Effects.enquiryTrampoline;
|
||||
handler.effects.xtversion = &Effects.xtversionTrampoline;
|
||||
handler.effects.title_changed = &Effects.titleChangedTrampoline;
|
||||
handler.effects.size = &Effects.sizeTrampoline;
|
||||
handler.effects = .{
|
||||
.write_pty = &Effects.writePtyTrampoline,
|
||||
.bell = &Effects.bellTrampoline,
|
||||
.color_scheme = &Effects.colorSchemeTrampoline,
|
||||
.device_attributes = &Effects.deviceAttributesTrampoline,
|
||||
.enquiry = &Effects.enquiryTrampoline,
|
||||
.xtversion = &Effects.xtversionTrampoline,
|
||||
.title_changed = &Effects.titleChangedTrampoline,
|
||||
.size = &Effects.sizeTrampoline,
|
||||
};
|
||||
|
||||
wrapper.* = .{
|
||||
.terminal = t,
|
||||
|
||||
Reference in New Issue
Block a user