Merge branch 'master' into zig-0.15
This commit is contained in:
commit
8903ca86b1
7 changed files with 66 additions and 5 deletions
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
.syntax = .{
|
.syntax = .{
|
||||||
.url = "git+https://github.com/neurocyte/flow-syntax?ref=master#ed50776aaeadc0ebee99ed8c5dfb79669a855e63",
|
.url = "git+https://github.com/neurocyte/flow-syntax?ref=master#6404532851f790ba05779f8b4167c99b22c76312",
|
||||||
.hash = "flow_syntax-0.1.0-X8jOobQCAQDn-J1dyBRKmsSnUt0h_x6YqHxeEq44Ib6t",
|
.hash = "flow_syntax-0.1.0-X8jOofgHAQCZa_ChUZXYfT4p3lJKZjd1aNFvd3uwh_QQ",
|
||||||
},
|
},
|
||||||
.flags = .{
|
.flags = .{
|
||||||
.url = "git+https://github.com/neurocyte/flags?ref=main#984b27948da3e4e40a253f76c85b51ec1a9ada11",
|
.url = "git+https://github.com/neurocyte/flags?ref=main#984b27948da3e4e40a253f76c85b51ec1a9ada11",
|
||||||
|
|
|
@ -28,8 +28,12 @@ pub inline fn right_of(self: Self, other: Self) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clamp_to_buffer(self: *Self, root: Buffer.Root, metrics: Metrics) void {
|
pub fn clamp_to_buffer(self: *Self, root: Buffer.Root, metrics: Metrics) void {
|
||||||
self.row = @min(self.row, root.lines() - 1);
|
if (self.row > root.lines() - 1) {
|
||||||
self.col = @min(self.col, root.line_width(self.row, metrics) catch 0);
|
self.row = root.lines() - 1;
|
||||||
|
self.col = root.line_width(self.row, metrics) catch 0;
|
||||||
|
} else {
|
||||||
|
self.col = @min(self.col, root.line_width(self.row, metrics) catch 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn follow_target(self: *Self, root: Buffer.Root, metrics: Metrics) void {
|
fn follow_target(self: *Self, root: Buffer.Root, metrics: Metrics) void {
|
||||||
|
|
|
@ -21,6 +21,15 @@ pub const DirDest = struct {
|
||||||
|
|
||||||
pub fn parse(link: []const u8) error{InvalidFileLink}!Dest {
|
pub fn parse(link: []const u8) error{InvalidFileLink}!Dest {
|
||||||
if (link.len == 0) return error.InvalidFileLink;
|
if (link.len == 0) return error.InvalidFileLink;
|
||||||
|
|
||||||
|
if (std.mem.lastIndexOfScalar(u8, link, '(')) |pos| blk: {
|
||||||
|
for (link[pos + 1 ..]) |c| switch (c) {
|
||||||
|
'0'...'9', ',', ')', ':', ' ' => continue,
|
||||||
|
else => break :blk,
|
||||||
|
};
|
||||||
|
return parse_bracket_link(link);
|
||||||
|
}
|
||||||
|
|
||||||
var it = std.mem.splitScalar(u8, link, ':');
|
var it = std.mem.splitScalar(u8, link, ':');
|
||||||
var dest: Dest = if (root.is_directory(link))
|
var dest: Dest = if (root.is_directory(link))
|
||||||
.{ .dir = .{ .path = link } }
|
.{ .dir = .{ .path = link } }
|
||||||
|
@ -46,6 +55,36 @@ pub fn parse(link: []const u8) error{InvalidFileLink}!Dest {
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn parse_bracket_link(link: []const u8) error{InvalidFileLink}!Dest {
|
||||||
|
var it_ = std.mem.splitScalar(u8, link, '(');
|
||||||
|
var dest: Dest = if (root.is_directory(link))
|
||||||
|
.{ .dir = .{ .path = link } }
|
||||||
|
else
|
||||||
|
.{ .file = .{ .path = it_.first() } };
|
||||||
|
|
||||||
|
const rest = it_.next() orelse "";
|
||||||
|
var it = std.mem.splitAny(u8, rest, ",):");
|
||||||
|
|
||||||
|
switch (dest) {
|
||||||
|
.file => |*file| {
|
||||||
|
if (it.next()) |line_|
|
||||||
|
file.line = std.fmt.parseInt(usize, line_, 10) catch blk: {
|
||||||
|
file.path = link;
|
||||||
|
break :blk null;
|
||||||
|
};
|
||||||
|
if (file.line) |_| if (it.next()) |col_| {
|
||||||
|
file.column = std.fmt.parseInt(usize, col_, 10) catch null;
|
||||||
|
};
|
||||||
|
if (file.column) |_| if (it.next()) |col_| {
|
||||||
|
file.end_column = std.fmt.parseInt(usize, col_, 10) catch null;
|
||||||
|
};
|
||||||
|
file.exists = root.is_file(file.path);
|
||||||
|
},
|
||||||
|
.dir => {},
|
||||||
|
}
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
pub fn navigate(to: tp.pid_ref, link: *const Dest) anyerror!void {
|
pub fn navigate(to: tp.pid_ref, link: *const Dest) anyerror!void {
|
||||||
switch (link.*) {
|
switch (link.*) {
|
||||||
.file => |file| {
|
.file => |file| {
|
||||||
|
|
|
@ -48,6 +48,10 @@ pub const elixir = .{
|
||||||
|
|
||||||
pub const fish = .{};
|
pub const fish = .{};
|
||||||
|
|
||||||
|
pub const fsharp = .{
|
||||||
|
.language_server = .{"fsautocomplete"},
|
||||||
|
};
|
||||||
|
|
||||||
pub const @"git-rebase" = .{};
|
pub const @"git-rebase" = .{};
|
||||||
|
|
||||||
pub const gitcommit = .{};
|
pub const gitcommit = .{};
|
||||||
|
|
|
@ -6,6 +6,7 @@ const Color = @import("theme").Color;
|
||||||
const vaxis = @import("vaxis");
|
const vaxis = @import("vaxis");
|
||||||
const input = @import("input");
|
const input = @import("input");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
|
const RGB = @import("color").RGB;
|
||||||
|
|
||||||
pub const Plane = @import("Plane.zig");
|
pub const Plane = @import("Plane.zig");
|
||||||
pub const Cell = @import("Cell.zig");
|
pub const Cell = @import("Cell.zig");
|
||||||
|
@ -459,6 +460,11 @@ pub fn set_terminal_cursor_color(self: *Self, color: Color) void {
|
||||||
self.vx.setTerminalCursorColor(self.tty.anyWriter(), vaxis.Cell.Color.rgbFromUint(@intCast(color.color)).rgb) catch {};
|
self.vx.setTerminalCursorColor(self.tty.anyWriter(), vaxis.Cell.Color.rgbFromUint(@intCast(color.color)).rgb) catch {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_terminal_secondary_cursor_color(self: *Self, color: Color) void {
|
||||||
|
const rgb = RGB.from_u24(color.color);
|
||||||
|
self.tty.anyWriter().print("\x1b[>40;2:{d}:{d}:{d} q", .{ rgb.r, rgb.g, rgb.b }) catch {};
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_terminal_working_directory(self: *Self, absolute_path: []const u8) void {
|
pub fn set_terminal_working_directory(self: *Self, absolute_path: []const u8) void {
|
||||||
self.vx.setTerminalWorkingDirectory(self.tty.anyWriter(), absolute_path) catch {};
|
self.vx.setTerminalWorkingDirectory(self.tty.anyWriter(), absolute_path) catch {};
|
||||||
}
|
}
|
||||||
|
@ -548,7 +554,7 @@ pub fn clear_all_multi_cursors(self: *Self) !void {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn show_multi_cursor_yx(self: *Self, y: c_int, x: c_int) !void {
|
pub fn show_multi_cursor_yx(self: *Self, y: c_int, x: c_int) !void {
|
||||||
try self.tty.anyWriter().print("\x1b[>-1;2:{d}:{d} q", .{ y + 1, x + 1 });
|
try self.tty.anyWriter().print("\x1b[>29;2:{d}:{d} q", .{ y + 1, x + 1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sync_mod_state(self: *Self, keypress: u32, modifiers: vaxis.Key.Modifiers) !void {
|
fn sync_mod_state(self: *Self, keypress: u32, modifiers: vaxis.Key.Modifiers) !void {
|
||||||
|
|
|
@ -440,6 +440,12 @@ pub fn set_terminal_cursor_color(self: *Self, color: Color) void {
|
||||||
//@panic("todo");
|
//@panic("todo");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_terminal_secondary_cursor_color(self: *Self, color: Color) void {
|
||||||
|
_ = self;
|
||||||
|
_ = color;
|
||||||
|
//@panic("todo");
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_terminal_working_directory(self: *Self, absolute_path: []const u8) void {
|
pub fn set_terminal_working_directory(self: *Self, absolute_path: []const u8) void {
|
||||||
_ = self;
|
_ = self;
|
||||||
_ = absolute_path;
|
_ = absolute_path;
|
||||||
|
|
|
@ -1448,6 +1448,8 @@ fn set_terminal_style(self: *Self) void {
|
||||||
if (build_options.gui or self.config_.enable_terminal_color_scheme) {
|
if (build_options.gui or self.config_.enable_terminal_color_scheme) {
|
||||||
self.rdr_.set_terminal_style(self.theme_.editor);
|
self.rdr_.set_terminal_style(self.theme_.editor);
|
||||||
self.rdr_.set_terminal_cursor_color(self.theme_.editor_cursor.bg.?);
|
self.rdr_.set_terminal_cursor_color(self.theme_.editor_cursor.bg.?);
|
||||||
|
if (self.rdr_.vx.caps.multi_cursor)
|
||||||
|
self.rdr_.set_terminal_secondary_cursor_color(self.theme_.editor_cursor_secondary.bg orelse self.theme_.editor_cursor.bg.?);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue