Fix terminal input mode and cursor rendering
This commit is contained in:
+7
-2
@@ -22,6 +22,7 @@ pub const Action = union(enum) {
|
||||
none,
|
||||
save,
|
||||
quit,
|
||||
force_quit,
|
||||
open: []u8,
|
||||
symbol: symbol_mod.Symbol,
|
||||
file_picker,
|
||||
@@ -101,7 +102,7 @@ pub const Leader = struct {
|
||||
if (self.message) |message| return message;
|
||||
return switch (self.mode) {
|
||||
.idle => "",
|
||||
.rail => "leader: w save q quit o open p symbols s search r repeat (digits/%/Esc ok)",
|
||||
.rail => "leader: w save q quit Q discard o open p symbols s search r repeat",
|
||||
.symbol_rail => symbol_mod.rail_status,
|
||||
.search_rail => "search: f current file p project s symbols",
|
||||
.language_rail => "language: h hover s sig f fmt o imports a actions (Space path)",
|
||||
@@ -167,6 +168,10 @@ pub const Leader = struct {
|
||||
self.mode = .idle;
|
||||
return .quit;
|
||||
}
|
||||
if (std.mem.eql(u8, text, "Q")) {
|
||||
self.mode = .idle;
|
||||
return .force_quit;
|
||||
}
|
||||
if (std.mem.eql(u8, text, "o")) {
|
||||
self.open_prompt.clearRetainingCapacity();
|
||||
self.mode = .open_prompt;
|
||||
@@ -443,7 +448,7 @@ test "regular: space opens a visible leader rail and write dispatches" {
|
||||
defer leader.deinit();
|
||||
|
||||
try expectActionTag(.none, try leader.handleEvent(input.normalize(" ")));
|
||||
try std.testing.expectEqualStrings("leader: w save q quit o open p symbols s search r repeat (digits/%/Esc ok)", leader.status());
|
||||
try std.testing.expectEqualStrings("leader: w save q quit Q discard o open p symbols s search r repeat", leader.status());
|
||||
|
||||
try expectActionTag(.save, try leader.handleEvent(input.normalize("w")));
|
||||
try std.testing.expect(!leader.isActive());
|
||||
|
||||
Reference in New Issue
Block a user