Zig 0.14: Rename imports to remove new namespace collisions

This now fails with errors like "error: duplicate struct member name 'layout'"
This commit is contained in:
LN Liberda
2025-03-10 00:42:41 +01:00
parent 881a03cb66
commit a58537d6d3
11 changed files with 84 additions and 84 deletions

View File

@ -24,7 +24,7 @@ const global_state = &@import("global.zig").state;
const oni = @import("oniguruma");
const crash = @import("crash/main.zig");
const unicode = @import("unicode/main.zig");
const renderer = @import("renderer.zig");
const renderer_mod = @import("renderer.zig");
const termio = @import("termio.zig");
const objc = @import("objc");
const imgui = @import("imgui");
@ -36,13 +36,13 @@ const configpkg = @import("config.zig");
const input = @import("input.zig");
const App = @import("App.zig");
const internal_os = @import("os/main.zig");
const inspector = @import("inspector/main.zig");
const inspector_mod = @import("inspector/main.zig");
const SurfaceMouse = @import("surface_mouse.zig");
const log = std.log.scoped(.surface);
// The renderer implementation to use.
const Renderer = renderer.Renderer;
const Renderer = renderer_mod.Renderer;
/// Minimum window size in cells. This is used to prevent the window from
/// being resized to a size that is too small to be useful. These defaults
@ -70,10 +70,10 @@ font_metrics: font.Metrics,
renderer: Renderer,
/// The render state
renderer_state: renderer.State,
renderer_state: renderer_mod.State,
/// The renderer thread manager
renderer_thread: renderer.Thread,
renderer_thread: renderer_mod.Thread,
/// The actual thread
renderer_thr: std.Thread,
@ -113,10 +113,10 @@ io_thread: termio.Thread,
io_thr: std.Thread,
/// Terminal inspector
inspector: ?*inspector.Inspector = null,
inspector: ?*inspector_mod.Inspector = null,
/// All our sizing information.
size: renderer.Size,
size: renderer_mod.Size,
/// The configuration derived from the main config. We "derive" it so that
/// we don't have a shared pointer hanging around that we need to worry about
@ -339,7 +339,7 @@ const DerivedConfig = struct {
self.arena.deinit();
}
fn scaledPadding(self: *const DerivedConfig, x_dpi: f32, y_dpi: f32) renderer.Padding {
fn scaledPadding(self: *const DerivedConfig, x_dpi: f32, y_dpi: f32) renderer_mod.Padding {
const padding_top: u32 = padding_top: {
const padding_top: f32 = @floatFromInt(self.window_padding_top);
break :padding_top @intFromFloat(@floor(padding_top * y_dpi / 72));
@ -431,8 +431,8 @@ pub fn init(
);
// Build our size struct which has all the sizes we need.
const size: renderer.Size = size: {
var size: renderer.Size = .{
const size: renderer_mod.Size = size: {
var size: renderer_mod.Size = .{
.screen = screen: {
const surface_size = try rt_surface.getSize();
break :screen .{
@ -445,7 +445,7 @@ pub fn init(
.padding = .{},
};
const explicit: renderer.Padding = derived_config.scaledPadding(
const explicit: renderer_mod.Padding = derived_config.scaledPadding(
x_dpi,
y_dpi,
);
@ -475,7 +475,7 @@ pub fn init(
errdefer alloc.destroy(mutex);
// Create the renderer thread
var render_thread = try renderer.Thread.init(
var render_thread = try renderer_mod.Thread.init(
alloc,
config,
rt_surface,
@ -611,7 +611,7 @@ pub fn init(
// Start our renderer thread
self.renderer_thr = try std.Thread.spawn(
.{},
renderer.Thread.threadMain,
renderer_mod.Thread.threadMain,
.{&self.renderer_thread},
);
self.renderer_thr.setName("renderer") catch {};
@ -736,9 +736,9 @@ pub fn activateInspector(self: *Surface) !void {
if (self.inspector != null) return;
// Setup the inspector
const ptr = try self.alloc.create(inspector.Inspector);
const ptr = try self.alloc.create(inspector_mod.Inspector);
errdefer self.alloc.destroy(ptr);
ptr.* = try inspector.Inspector.init(self);
ptr.* = try inspector_mod.Inspector.init(self);
self.inspector = ptr;
// Put the inspector onto the render state
@ -1091,7 +1091,7 @@ fn mouseRefreshLinks(
}
/// Called when our renderer health state changes.
fn updateRendererHealth(self: *Surface, health: renderer.Health) void {
fn updateRendererHealth(self: *Surface, health: renderer_mod.Health) void {
log.warn("renderer health status change status={}", .{health});
_ = self.rt_app.performAction(
.{ .surface = self },
@ -1163,7 +1163,7 @@ pub fn updateConfig(
// We need to store our configs in a heap-allocated pointer so that
// our messages aren't huge.
var renderer_message = try renderer.Message.initChangeConfig(self.alloc, config);
var renderer_message = try renderer_mod.Message.initChangeConfig(self.alloc, config);
errdefer renderer_message.deinit();
var termio_config_ptr = try self.alloc.create(termio.Termio.DerivedConfig);
errdefer self.alloc.destroy(termio_config_ptr);
@ -1497,7 +1497,7 @@ fn setSelection(self: *Surface, sel_: ?terminal.Selection) !void {
/// Change the cell size for the terminal grid. This can happen as
/// a result of changing the font size at runtime.
fn setCellSize(self: *Surface, size: renderer.CellSize) !void {
fn setCellSize(self: *Surface, size: renderer_mod.CellSize) !void {
// Update our cell size within our size struct
self.size.cell = size;
self.balancePaddingIfNeeded();
@ -1573,7 +1573,7 @@ pub fn sizeCallback(self: *Surface, size: apprt.SurfaceSize) !void {
crash.sentry.thread_state = self.crashThreadState();
defer crash.sentry.thread_state = null;
const new_screen_size: renderer.ScreenSize = .{
const new_screen_size: renderer_mod.ScreenSize = .{
.width = size.width,
.height = size.height,
};
@ -1586,7 +1586,7 @@ pub fn sizeCallback(self: *Surface, size: apprt.SurfaceSize) !void {
try self.resize(new_screen_size);
}
fn resize(self: *Surface, size: renderer.ScreenSize) !void {
fn resize(self: *Surface, size: renderer_mod.ScreenSize) !void {
// Save our screen size
self.size.screen = size;
self.balancePaddingIfNeeded();
@ -1667,7 +1667,7 @@ pub fn preeditCallback(self: *Surface, preedit_: ?[]const u8) !void {
var it = view.iterator();
// Allocate the codepoints slice
const Codepoint = renderer.State.Preedit.Codepoint;
const Codepoint = renderer_mod.State.Preedit.Codepoint;
var codepoints: std.ArrayListUnmanaged(Codepoint) = .{};
defer codepoints.deinit(self.alloc);
while (it.nextCodepoint()) |cp| {
@ -1734,7 +1734,7 @@ pub fn keyCallback(
defer crash.sentry.thread_state = null;
// Setup our inspector event if we have an inspector.
var insp_ev: ?inspector.key.Event = if (self.inspector != null) ev: {
var insp_ev: ?inspector_mod.key.Event = if (self.inspector != null) ev: {
var copy = event;
copy.utf8 = "";
if (event.utf8.len > 0) copy.utf8 = try self.alloc.dupe(u8, event.utf8);
@ -1898,7 +1898,7 @@ pub fn keyCallback(
fn maybeHandleBinding(
self: *Surface,
event: input.KeyEvent,
insp_ev: ?*inspector.key.Event,
insp_ev: ?*inspector_mod.key.Event,
) !?InputEffect {
switch (event.action) {
// Release events never trigger a binding but we need to check if
@ -2106,7 +2106,7 @@ fn endKeySequence(
fn encodeKey(
self: *Surface,
event: input.KeyEvent,
insp_ev: ?*inspector.key.Event,
insp_ev: ?*inspector_mod.key.Event,
) !?termio.Message.WriteReq {
// Build up our encoder. Under different modes and
// inputs there are many keybindings that result in no encoding
@ -2570,8 +2570,8 @@ fn mouseReport(
.x10 => if (action != .press or
button == null or
!(button.? == .left or
button.? == .right or
button.? == .middle)) return,
button.? == .right or
button.? == .middle)) return,
// Doesn't report motion
.normal => if (action == .motion) return,
@ -2749,7 +2749,7 @@ fn mouseReport(
const final: u8 = if (action == .release) 'm' else 'M';
// The position has to be adjusted to the terminal space.
const coord: renderer.Coordinate.Terminal = (renderer.Coordinate{
const coord: renderer_mod.Coordinate.Terminal = (renderer_mod.Coordinate{
.surface = .{
.x = pos.x,
.y = pos.y,
@ -3479,7 +3479,7 @@ pub fn cursorPosCallback(
self.mouse.link_point == null or
(self.mouse.link_point != null and !self.mouse.link_point.?.eql(pos_vp))) and
(self.io.terminal.flags.mouse_event == .none or
(self.mouse.mods.shift and !self.mouseShiftCapture(false))))
(self.mouse.mods.shift and !self.mouseShiftCapture(false))))
{
// If we were previously over a link, we always update. We do this so that if the text
// changed underneath us, even if the mouse didn't move, we update the URL hints and state
@ -3819,7 +3819,7 @@ pub fn colorSchemeCallback(self: *Surface, scheme: apprt.ColorScheme) !void {
pub fn posToViewport(self: Surface, xpos: f64, ypos: f64) terminal.point.Coordinate {
// Get our grid cell
const coord: renderer.Coordinate = .{ .surface = .{ .x = xpos, .y = ypos } };
const coord: renderer_mod.Coordinate = .{ .surface = .{ .x = xpos, .y = ypos } };
const grid = coord.convert(.grid, self.size).grid;
return .{ .x = grid.x, .y = grid.y };
}

View File

@ -43,7 +43,7 @@ const c = @import("c.zig").c;
const version = @import("version.zig");
const inspector = @import("inspector.zig");
const key = @import("key.zig");
const winproto = @import("winproto.zig");
const winproto_mod = @import("winproto.zig");
const testing = std.testing;
const adwaita = @import("adwaita.zig");
@ -58,7 +58,7 @@ app: *c.GtkApplication,
ctx: *c.GMainContext,
/// State and logic for the underlying windowing protocol.
winproto: winproto.App,
winproto: winproto_mod.App,
/// True if the app was launched with single instance mode.
single_instance: bool,
@ -401,7 +401,7 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
}
// Setup our windowing protocol logic
var winproto_app = try winproto.App.init(
var winproto_app = try winproto_mod.App.init(
core_app.alloc,
display,
app_id,

View File

@ -32,7 +32,7 @@ const ClipboardConfirmationWindow = @import("ClipboardConfirmationWindow.zig");
const ResizeOverlay = @import("ResizeOverlay.zig");
const URLWidget = @import("URLWidget.zig");
const CloseDialog = @import("CloseDialog.zig");
const inspector = @import("inspector.zig");
const inspector_mod = @import("inspector.zig");
const gtk_key = @import("key.zig");
const c = @import("c.zig").c;
const Builder = @import("Builder.zig");
@ -290,7 +290,7 @@ size: apprt.SurfaceSize,
cursor_pos: apprt.CursorPos,
/// Inspector state.
inspector: ?*inspector.Inspector = null,
inspector: ?*inspector_mod.Inspector = null,
/// Key input states. See gtkKeyPressed for detailed descriptions.
in_keyevent: IMKeyEvent = .false,
@ -703,7 +703,7 @@ pub fn controlInspector(
// If we already have an inspector, we don't need to show anything.
if (self.inspector != null) return;
self.inspector = inspector.Inspector.create(
self.inspector = inspector_mod.Inspector.create(
self,
.{ .window = {} },
) catch |err| {

View File

@ -34,7 +34,7 @@ const TabView = @import("TabView.zig");
const HeaderBar = @import("headerbar.zig");
const CloseDialog = @import("CloseDialog.zig");
const version = @import("version.zig");
const winproto = @import("winproto.zig");
const winproto_mod = @import("winproto.zig");
const log = std.log.scoped(.gtk);
@ -69,7 +69,7 @@ toast_overlay: *c.GtkWidget,
adw_tab_overview_focus_timer: ?c.guint = null,
/// State and logic for windowing protocol for a window.
winproto: winproto.Window,
winproto: winproto_mod.Window,
pub const DerivedConfig = struct {
background_opacity: f64,
@ -693,7 +693,7 @@ fn gtkRealize(_: *c.GtkWindow, ud: ?*anyopaque) callconv(.C) bool {
const self = userdataSelf(ud.?);
// Initialize our window protocol logic
if (winproto.Window.init(
if (winproto_mod.Window.init(
self.app.core_app.alloc,
&self.app.winproto,
self,

View File

@ -7,7 +7,7 @@ const builtin = @import("builtin");
const apprt = @import("../apprt.zig");
const font = @import("../font/main.zig");
const renderer = @import("../renderer.zig");
const renderer_mod = @import("../renderer.zig");
const Command = @import("../Command.zig");
const WasmTarget = @import("../os/wasm/target.zig").Target;
@ -28,7 +28,7 @@ wasm_target: WasmTarget,
/// Comptime interfaces
app_runtime: apprt.Runtime = .none,
renderer: renderer.Impl = .opengl,
renderer: renderer_mod.Impl = .opengl,
font_backend: font.Backend = .freetype,
/// Feature flags
@ -122,10 +122,10 @@ pub fn init(b: *std.Build) !Config {
) orelse apprt.Runtime.default(target.result);
config.renderer = b.option(
renderer.Impl,
renderer_mod.Impl,
"renderer",
"The app runtime to use. Not all values supported on all platforms.",
) orelse renderer.Impl.default(target.result, wasm_target);
) orelse renderer_mod.Impl.default(target.result, wasm_target);
//---------------------------------------------------------------
// Feature Flags
@ -335,8 +335,8 @@ pub fn init(b: *std.Build) !Config {
target.result.os.tag == .macos and
config.app_runtime == .none and
(!config.emit_bench and
!config.emit_test_exe and
!config.emit_helpgen);
!config.emit_test_exe and
!config.emit_helpgen);
//---------------------------------------------------------------
// System Packages
@ -395,7 +395,7 @@ pub fn addOptions(self: *const Config, step: *std.Build.Step.Options) !void {
step.addOption(bool, "sentry", self.sentry);
step.addOption(apprt.Runtime, "app_runtime", self.app_runtime);
step.addOption(font.Backend, "font_backend", self.font_backend);
step.addOption(renderer.Impl, "renderer", self.renderer);
step.addOption(renderer_mod.Impl, "renderer", self.renderer);
step.addOption(ExeEntrypoint, "exe_entrypoint", self.exe_entrypoint);
step.addOption(WasmTarget, "wasm_target", self.wasm_target);
step.addOption(bool, "wasm_shared", self.wasm_shared);
@ -436,7 +436,7 @@ pub fn fromOptions() Config {
.flatpak = options.flatpak,
.app_runtime = std.meta.stringToEnum(apprt.Runtime, @tagName(options.app_runtime)).?,
.font_backend = std.meta.stringToEnum(font.Backend, @tagName(options.font_backend)).?,
.renderer = std.meta.stringToEnum(renderer.Impl, @tagName(options.renderer)).?,
.renderer = std.meta.stringToEnum(renderer_mod.Impl, @tagName(options.renderer)).?,
.exe_entrypoint = std.meta.stringToEnum(ExeEntrypoint, @tagName(options.exe_entrypoint)).?,
.wasm_target = std.meta.stringToEnum(WasmTarget, @tagName(options.wasm_target)).?,
.wasm_shared = options.wasm_shared,

View File

@ -3,7 +3,7 @@
const std = @import("std");
const Allocator = std.mem.Allocator;
const Inspector = @import("../inspector/main.zig").Inspector;
const terminal = @import("../terminal/main.zig");
const terminal_mod = @import("../terminal/main.zig");
const inputpkg = @import("../input.zig");
const renderer = @import("../renderer.zig");
@ -14,7 +14,7 @@ const renderer = @import("../renderer.zig");
mutex: *std.Thread.Mutex,
/// The terminal data.
terminal: *terminal.Terminal,
terminal: *terminal_mod.Terminal,
/// The terminal inspector, if any. This will be null while the inspector
/// is not active and will be set when it is active.
@ -34,7 +34,7 @@ pub const Mouse = struct {
/// The point on the viewport where the mouse currently is. We use
/// viewport points to avoid the complexity of mapping the mouse to
/// the renderer state.
point: ?terminal.point.Coordinate = null,
point: ?terminal_mod.point.Coordinate = null,
/// The mods that are currently active for the last mouse event.
/// This could really just be mods in general and we probably will
@ -80,11 +80,11 @@ pub const Preedit = struct {
/// into the available space.
pub fn range(
self: *const Preedit,
start: terminal.size.CellCountInt,
max: terminal.size.CellCountInt,
start: terminal_mod.size.CellCountInt,
max: terminal_mod.size.CellCountInt,
) struct {
start: terminal.size.CellCountInt,
end: terminal.size.CellCountInt,
start: terminal_mod.size.CellCountInt,
end: terminal_mod.size.CellCountInt,
cp_offset: usize,
} {
// If our width is greater than the number of cells we have
@ -96,7 +96,7 @@ pub const Preedit = struct {
// Rebuild our width in reverse order. This is because we want
// to offset by the end cells, not the start cells (if we have to).
var w: terminal.size.CellCountInt = 0;
var w: terminal_mod.size.CellCountInt = 0;
for (0..self.codepoints.len) |i| {
const reverse_i = self.codepoints.len - i - 1;
const cp = self.codepoints[reverse_i];

View File

@ -8,7 +8,7 @@ const assert = std.debug.assert;
const xev = @import("../global.zig").xev;
const crash = @import("../crash/main.zig");
const internal_os = @import("../os/main.zig");
const renderer = @import("../renderer.zig");
const renderer_mod = @import("../renderer.zig");
const apprt = @import("../apprt.zig");
const configpkg = @import("../config.zig");
const BlockingQueue = @import("../datastruct/main.zig").BlockingQueue;
@ -23,7 +23,7 @@ const CURSOR_BLINK_INTERVAL = 600;
/// The type used for sending messages to the IO thread. For now this is
/// hardcoded with a capacity. We can make this a comptime parameter in
/// the future if we want it configurable.
pub const Mailbox = BlockingQueue(renderer.Message, 64);
pub const Mailbox = BlockingQueue(renderer_mod.Message, 64);
/// Allocator used for some state
alloc: std.mem.Allocator,
@ -67,10 +67,10 @@ cursor_c_cancel: xev.Completion = .{},
surface: *apprt.Surface,
/// The underlying renderer implementation.
renderer: *renderer.Renderer,
renderer: *renderer_mod.Renderer,
/// Pointer to the shared state that is used to generate the final render.
state: *renderer.State,
state: *renderer_mod.State,
/// The mailbox that can be used to send this thread messages. Note
/// this is a blocking queue so if it is full you will get errors (or block).
@ -117,8 +117,8 @@ pub fn init(
alloc: Allocator,
config: *const configpkg.Config,
surface: *apprt.Surface,
renderer_impl: *renderer.Renderer,
state: *renderer.State,
renderer_impl: *renderer_mod.Renderer,
state: *renderer_mod.State,
app_mailbox: App.Mailbox,
) !Thread {
// Create our event loop.
@ -209,7 +209,7 @@ fn threadMain_(self: *Thread) !void {
self.setQosClass();
// Run our loop start/end callbacks if the renderer cares.
const has_loop = @hasDecl(renderer.Renderer, "loopEnter");
const has_loop = @hasDecl(renderer_mod.Renderer, "loopEnter");
if (has_loop) try self.renderer.loopEnter(self);
defer if (has_loop) self.renderer.loopExit();
@ -278,7 +278,7 @@ fn setQosClass(self: *const Thread) void {
fn startDrawTimer(self: *Thread) void {
// If our renderer doesn't support animations then we never run this.
if (!@hasDecl(renderer.Renderer, "hasAnimations")) return;
if (!@hasDecl(renderer_mod.Renderer, "hasAnimations")) return;
if (!self.renderer.hasAnimations()) return;
if (self.config.custom_shader_animation == .false) return;
@ -442,7 +442,7 @@ fn drainMailbox(self: *Thread) !void {
.inspector => |v| self.flags.has_inspector = v,
.macos_display_id => |v| {
if (@hasDecl(renderer.Renderer, "setMacOSDisplayID")) {
if (@hasDecl(renderer_mod.Renderer, "setMacOSDisplayID")) {
try self.renderer.setMacOSDisplayID(v);
}
},
@ -466,8 +466,8 @@ fn drawFrame(self: *Thread, now: bool) void {
// If we're doing single-threaded GPU calls then we just wake up the
// app thread to redraw at this point.
if (renderer.Renderer == renderer.OpenGL and
renderer.OpenGL.single_threaded_draw)
if (renderer_mod.Renderer == renderer_mod.OpenGL and
renderer_mod.OpenGL.single_threaded_draw)
{
_ = self.app_mailbox.push(
.{ .redraw_surface = self.surface },

View File

@ -11,7 +11,7 @@ const Allocator = std.mem.Allocator;
const unicode = @import("../unicode/main.zig");
const ansi = @import("ansi.zig");
const modes = @import("modes.zig");
const modes_mod = @import("modes.zig");
const charsets = @import("charsets.zig");
const csi = @import("csi.zig");
const hyperlink = @import("hyperlink.zig");
@ -20,7 +20,7 @@ const point = @import("point.zig");
const sgr = @import("sgr.zig");
const Tabstops = @import("Tabstops.zig");
const color = @import("color.zig");
const mouse_shape = @import("mouse_shape.zig");
const mouse_shape_mod = @import("mouse_shape.zig");
const size = @import("size.zig");
const pagepkg = @import("page.zig");
@ -87,10 +87,10 @@ color_palette: struct {
previous_char: ?u21 = null,
/// The modes that this terminal currently has active.
modes: modes.ModeState = .{},
modes: modes_mod.ModeState = .{},
/// The most recently set mouse shape for the terminal.
mouse_shape: mouse_shape.MouseShape = .text,
mouse_shape: mouse_shape_mod.MouseShape = .text,
/// These are just a packed set of flags we may set on the terminal.
flags: packed struct {
@ -196,7 +196,7 @@ pub const Options = struct {
/// The default mode state. When the terminal gets a reset, it
/// will revert back to this state.
default_modes: modes.ModePacked = .{},
default_modes: modes_mod.ModePacked = .{},
};
/// Initialize a new terminal.

View File

@ -1721,7 +1721,7 @@ pub const Page = struct {
const dirty_start = alignForward(usize, cells_end, @alignOf(usize));
const dirty_end: usize = dirty_start + (dirty_usize_length * @sizeOf(usize));
const styles_layout = style.Set.layout(cap.styles);
const styles_layout = style.Set.layout_sim(cap.styles);
const styles_start = alignForward(usize, dirty_end, style.Set.base_align);
const styles_end = styles_start + styles_layout.total_size;
@ -1739,7 +1739,7 @@ pub const Page = struct {
const string_end = string_start + string_layout.total_size;
const hyperlink_count = @divFloor(cap.hyperlink_bytes, @sizeOf(hyperlink.Set.Item));
const hyperlink_set_layout = hyperlink.Set.layout(@intCast(hyperlink_count));
const hyperlink_set_layout = hyperlink.Set.layout_sim(@intCast(hyperlink_count));
const hyperlink_set_start = alignForward(usize, string_end, hyperlink.Set.base_align);
const hyperlink_set_end = hyperlink_set_start + hyperlink_set_layout.total_size;

View File

@ -10,7 +10,7 @@ const fastmem = @import("../fastmem.zig");
/// A reference counted set.
///
/// This set is created with some capacity in mind. You can determine
/// the exact memory requirement of a given capacity by calling `layout`
/// the exact memory requirement of a given capacity by calling `layout_sim`
/// and checking the total size.
///
/// When the set exceeds capacity, an `OutOfMemory` or `NeedsRehash` error
@ -147,7 +147,7 @@ pub fn RefCountedSet(
///
/// The returned layout `cap` property will be 1 more than the number
/// of items that the set can actually store, since ID 0 is reserved.
pub fn layout(cap: usize) Layout {
pub fn layout_sim(cap: usize) Layout {
// Experimentally, this load factor works quite well.
const load_factor = 0.8125;
@ -621,7 +621,7 @@ pub fn RefCountedSet(
// to minimize the time it takes to find it.
if (item.meta.psl < held_item.meta.psl or
item.meta.psl == held_item.meta.psl and
item.meta.ref < held_item.meta.ref)
item.meta.ref < held_item.meta.ref)
{
// Put our held item in the bucket.
table[p] = held_id;

View File

@ -16,7 +16,7 @@ const termio = @import("../termio.zig");
const Command = @import("../Command.zig");
const Pty = @import("../pty.zig").Pty;
const StreamHandler = @import("stream_handler.zig").StreamHandler;
const terminal = @import("../terminal/main.zig");
const terminal_mod = @import("../terminal/main.zig");
const terminfo = @import("../terminfo/main.zig");
const xev = @import("../global.zig").xev;
const renderer = @import("../renderer.zig");
@ -41,7 +41,7 @@ config: DerivedConfig,
/// The terminal emulator internal state. This is the abstract "terminal"
/// that manages input, grid updating, etc. and is renderer-agnostic. It
/// just stores internal state about a grid.
terminal: terminal.Terminal,
terminal: terminal_mod.Terminal,
/// The shared render state
renderer_state: *renderer.State,
@ -64,7 +64,7 @@ mailbox: termio.Mailbox,
/// The stream parser. This parses the stream of escape codes and so on
/// from the child process and calls callbacks in the stream handler.
terminal_stream: terminal.Stream(StreamHandler),
terminal_stream: terminal_mod.Stream(StreamHandler),
/// Last time the cursor was reset. This is used to prevent message
/// flooding with cursor resets.
@ -76,9 +76,9 @@ last_cursor_reset: ?std.time.Instant = null,
pub const DerivedConfig = struct {
arena: ArenaAllocator,
palette: terminal.color.Palette,
palette: terminal_mod.color.Palette,
image_storage_limit: usize,
cursor_style: terminal.CursorStyle,
cursor_style: terminal_mod.CursorStyle,
cursor_blink: ?bool,
cursor_color: ?configpkg.Config.Color,
cursor_invert: bool,
@ -128,8 +128,8 @@ pub const DerivedConfig = struct {
/// to run a child process.
pub fn init(self: *Termio, alloc: Allocator, opts: termio.Options) !void {
// The default terminal modes based on our config.
const default_modes: terminal.ModePacked = modes: {
var modes: terminal.ModePacked = .{};
const default_modes: terminal_mod.ModePacked = modes: {
var modes: terminal_mod.ModePacked = .{};
// Setup our initial grapheme cluster support if enabled. We use a
// switch to ensure we get a compiler error if more cases are added.
@ -145,7 +145,7 @@ pub fn init(self: *Termio, alloc: Allocator, opts: termio.Options) !void {
};
// Create our terminal
var term = try terminal.Terminal.init(alloc, opts: {
var term = try terminal_mod.Terminal.init(alloc, opts: {
const grid_size = opts.size.grid();
break :opts .{
.cols = grid_size.columns,
@ -510,7 +510,7 @@ pub fn clearScreen(self: *Termio, td: *ThreadData, history: bool) !void {
}
/// Scroll the viewport
pub fn scrollViewport(self: *Termio, scroll: terminal.Terminal.ScrollViewport) !void {
pub fn scrollViewport(self: *Termio, scroll: terminal_mod.Terminal.ScrollViewport) !void {
self.renderer_state.mutex.lock();
defer self.renderer_state.mutex.unlock();
try self.terminal.scrollViewport(scroll);