Compare commits
2 commits
ce240c534c
...
c4f6b6c945
| Author | SHA1 | Date | |
|---|---|---|---|
| c4f6b6c945 | |||
| 581bbdb210 |
3 changed files with 19 additions and 4 deletions
|
|
@ -30,8 +30,8 @@
|
|||
.hash = "fuzzig-0.1.1-Ji0xivxIAQBD0g8O_NV_0foqoPf3elsg9Sc3pNfdVH4D",
|
||||
},
|
||||
.vaxis = .{
|
||||
.url = "git+https://github.com/neurocyte/libvaxis?ref=main#e6801b9c81fab5313bc35b349b294ba4b0a060ad",
|
||||
.hash = "vaxis-0.5.1-BWNV_L0eCgA4TNGahogJfmfebvJ-0sQXhOJAKn5WZmc6",
|
||||
.url = "git+https://github.com/neurocyte/libvaxis?ref=main#cecc97d9ff8da9df13499da0d0b19c5cd18742c3",
|
||||
.hash = "vaxis-0.5.1-BWNV_BcgCgDG3wpSPxCHxaRAZukEfnnKrBa-52zjnjex",
|
||||
},
|
||||
.zeit = .{
|
||||
.url = "git+https://github.com/rockorager/zeit?ref=zig-0.15#ed2ca60db118414bda2b12df2039e33bad3b0b88",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
const build_options = @import("build_options");
|
||||
const Allocator = std.mem.Allocator;
|
||||
|
||||
const tp = @import("thespian");
|
||||
|
|
@ -18,6 +19,7 @@ const tui = @import("tui.zig");
|
|||
const input = @import("input");
|
||||
const keybind = @import("keybind");
|
||||
pub const Mode = keybind.Mode;
|
||||
const RGB = @import("color").RGB;
|
||||
|
||||
pub const name = @typeName(Self);
|
||||
|
||||
|
|
@ -347,7 +349,10 @@ pub fn render(self: *Self, theme: *const Widget.Theme) bool {
|
|||
}
|
||||
|
||||
// Blit the terminal's front screen into our vaxis.Window.
|
||||
self.vt.vt.draw(self.allocator, self.plane.window, self.focused) catch |e| {
|
||||
const software_cursor = build_options.gui or !tui.config().enable_terminal_cursor;
|
||||
const focused_cursor_color: ?[3]u8 = if (theme.editor_cursor.bg) |bg| RGB.to_u8s(RGB.from_u24(bg.color)) else null;
|
||||
const unfocused_cursor_color: ?[3]u8 = if (theme.editor_cursor_secondary.bg) |bg| RGB.to_u8s(RGB.from_u24(bg.color)) else focused_cursor_color;
|
||||
self.vt.vt.draw(self.allocator, self.plane.window, self.focused and tui.terminal_has_focus(), software_cursor, focused_cursor_color, unfocused_cursor_color) catch |e| {
|
||||
std.log.err("terminal_view: draw failed: {}", .{e});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ keyboard_focus: ?Widget = null,
|
|||
keyboard_focus_outer: ?Widget = null,
|
||||
mini_mode_: ?MiniMode = null,
|
||||
hover_focus: ?Widget = null,
|
||||
terminal_focus: bool = true,
|
||||
last_hover_x: c_int = -1,
|
||||
last_hover_y: c_int = -1,
|
||||
commands: Commands = undefined,
|
||||
|
|
@ -519,15 +520,19 @@ fn receive_safe(self: *Self, from: tp.pid_ref, m: tp.message) !void {
|
|||
return;
|
||||
|
||||
if (try m.match(.{"focus_in"})) {
|
||||
self.terminal_focus = true;
|
||||
std.log.debug("focus_in", .{});
|
||||
need_render(@src());
|
||||
return;
|
||||
}
|
||||
|
||||
if (try m.match(.{"focus_out"})) {
|
||||
self.terminal_focus = false;
|
||||
std.log.debug("focus_out", .{});
|
||||
self.clear_hover_focus(@src()) catch {};
|
||||
self.last_hover_x = -1;
|
||||
self.last_hover_y = -1;
|
||||
need_render(@src());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -949,7 +954,7 @@ pub fn save_config() (root.ConfigDirError || root.ConfigWriteError)!void {
|
|||
|
||||
pub fn is_mainview_focused() bool {
|
||||
const self = current();
|
||||
return self.mini_mode_ == null and self.input_mode_outer_ == null and !is_keyboard_focused();
|
||||
return self.mini_mode_ == null and self.input_mode_outer_ == null and !is_keyboard_focused() and self.terminal_focus;
|
||||
}
|
||||
|
||||
fn enter_overlay_mode(self: *Self, mode: type) command.Result {
|
||||
|
|
@ -2705,3 +2710,8 @@ pub fn jump_mode() bool {
|
|||
const self = current();
|
||||
return self.jump_mode_;
|
||||
}
|
||||
|
||||
pub fn terminal_has_focus() bool {
|
||||
const self = current();
|
||||
return self.terminal_focus;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue