feat: add argument metadata to (most) commands that take parameters
This commit is contained in:
parent
ae91afe255
commit
150374afae
14 changed files with 85 additions and 78 deletions
|
@ -315,7 +315,7 @@ pub fn Create(options: type) type {
|
|||
try self.file_path.appendSlice(buf[0..bytes]);
|
||||
self.update_mini_mode_text();
|
||||
}
|
||||
pub const mini_mode_insert_code_point_meta = .{ .interactive = false };
|
||||
pub const mini_mode_insert_code_point_meta = .{ .arguments = &.{.integer} };
|
||||
|
||||
pub fn mini_mode_insert_bytes(self: *Self, ctx: Ctx) Result {
|
||||
var bytes: []const u8 = undefined;
|
||||
|
@ -325,7 +325,7 @@ pub fn Create(options: type) type {
|
|||
try self.file_path.appendSlice(bytes);
|
||||
self.update_mini_mode_text();
|
||||
}
|
||||
pub const mini_mode_insert_bytes_meta = .{ .interactive = false };
|
||||
pub const mini_mode_insert_bytes_meta = .{ .arguments = &.{.string} };
|
||||
|
||||
pub fn mini_mode_select(self: *Self, _: Ctx) Result {
|
||||
options.select(self);
|
||||
|
|
|
@ -186,7 +186,7 @@ const cmds = struct {
|
|||
self.insert_code_point(egc) catch |e| return tp.exit_error(e, @errorReturnTrace());
|
||||
self.update_mini_mode_text();
|
||||
}
|
||||
pub const mini_mode_insert_code_point_meta = .{ .interactive = false };
|
||||
pub const mini_mode_insert_code_point_meta = .{ .arguments = &.{.integer} };
|
||||
|
||||
pub fn mini_mode_insert_bytes(self: *Self, ctx: Ctx) Result {
|
||||
var bytes: []const u8 = undefined;
|
||||
|
@ -195,7 +195,7 @@ const cmds = struct {
|
|||
self.insert_bytes(bytes) catch |e| return tp.exit_error(e, @errorReturnTrace());
|
||||
self.update_mini_mode_text();
|
||||
}
|
||||
pub const mini_mode_insert_bytes_meta = .{ .interactive = false };
|
||||
pub const mini_mode_insert_bytes_meta = .{ .arguments = &.{.string} };
|
||||
|
||||
pub fn mini_mode_delete_backwards(self: *Self, _: Ctx) Result {
|
||||
_ = self.input.popOrNull();
|
||||
|
|
|
@ -135,7 +135,7 @@ const cmds = struct {
|
|||
self.insert_code_point(egc) catch |e| return tp.exit_error(e, @errorReturnTrace());
|
||||
self.update_mini_mode_text();
|
||||
}
|
||||
pub const mini_mode_insert_code_point_meta = .{ .interactive = false };
|
||||
pub const mini_mode_insert_code_point_meta = .{ .arguments = &.{.integer} };
|
||||
|
||||
pub fn mini_mode_insert_bytes(self: *Self, ctx: Ctx) Result {
|
||||
var bytes: []const u8 = undefined;
|
||||
|
@ -144,7 +144,7 @@ const cmds = struct {
|
|||
self.insert_bytes(bytes) catch |e| return tp.exit_error(e, @errorReturnTrace());
|
||||
self.update_mini_mode_text();
|
||||
}
|
||||
pub const mini_mode_insert_bytes_meta = .{ .interactive = false };
|
||||
pub const mini_mode_insert_bytes_meta = .{ .arguments = &.{.string} };
|
||||
|
||||
pub fn mini_mode_delete_backwards(self: *Self, _: Ctx) Result {
|
||||
if (self.input.len > 0) {
|
||||
|
|
|
@ -130,7 +130,7 @@ const cmds = struct {
|
|||
self.update_mini_mode_text();
|
||||
self.goto();
|
||||
}
|
||||
pub const mini_mode_insert_code_point_meta = .{ .interactive = false };
|
||||
pub const mini_mode_insert_code_point_meta = .{ .arguments = &.{.integer} };
|
||||
|
||||
pub fn mini_mode_insert_bytes(self: *Self, ctx: Ctx) Result {
|
||||
var bytes: []const u8 = undefined;
|
||||
|
@ -140,5 +140,5 @@ const cmds = struct {
|
|||
self.update_mini_mode_text();
|
||||
self.goto();
|
||||
}
|
||||
pub const mini_mode_insert_bytes_meta = .{ .interactive = false };
|
||||
pub const mini_mode_insert_bytes_meta = .{ .arguments = &.{.string} };
|
||||
};
|
||||
|
|
|
@ -106,7 +106,7 @@ const cmds = struct {
|
|||
const bytes = input.ucs32_to_utf8(&[_]u32{code_point}, &buf) catch return error.InvalidArgument;
|
||||
return self.execute_operation(command.fmt(.{buf[0..bytes]}));
|
||||
}
|
||||
pub const mini_mode_insert_code_point_meta = .{ .interactive = false };
|
||||
pub const mini_mode_insert_code_point_meta = .{ .arguments = &.{.integer} };
|
||||
|
||||
pub fn mini_mode_insert_bytes(self: *Self, ctx: Ctx) Result {
|
||||
var bytes: []const u8 = undefined;
|
||||
|
@ -114,7 +114,7 @@ const cmds = struct {
|
|||
return error.InvalidArgument;
|
||||
return self.execute_operation(ctx);
|
||||
}
|
||||
pub const mini_mode_insert_bytes_meta = .{ .interactive = false };
|
||||
pub const mini_mode_insert_bytes_meta = .{ .arguments = &.{.string} };
|
||||
|
||||
pub fn mini_mode_cancel(_: *Self, _: Ctx) Result {
|
||||
command.executeName("exit_mini_mode", .{}) catch {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue