srctree

Gregory Mullen parent ffb42d2a 2fb2c63a
esc isn't an error

src/input.zig added: 9, removed: 6, total 3
@@ -15,6 +15,7 @@ pub const Action = enum {
 
pub const Control = enum {
none,
esc,
 
up,
down,
@@ -29,17 +30,18 @@ pub const Control = enum {
 
backspace,
delete,
newline,
tab,
// Shell Control
newline,
bell,
delete_word,
end_of_text,
external_editor,
bell,
reset_term,
 
pub fn fromKey(k: Keys.Key) Control {
return switch (k) {
.esc => .esc,
.up => .up,
.down => .down,
.left => .left,
@@ -151,6 +153,7 @@ fn event(km: Keys.KeyMod) Event {
},
},
.key => |k| switch (k) {
.esc,
.up,
.down,
.left,
 
src/line.zig added: 9, removed: 6, total 3
@@ -67,14 +67,13 @@ pub fn do(line: *Line) !bool {
switch (err) {
error.io => return err,
error.signaled => {
//line.hsh.draw.cursor = line.hsh.tkn.cadj();
Draw.clearCtx(&line.hsh.draw);
try Draw.render(&line.hsh.draw);
return false;
},
error.end_of_text => return true,
}
continue;
comptime unreachable;
};
////hsh.draw.cursor = 0;
//if (tkn.raw.items.len == 0) {
@@ -108,6 +107,7 @@ pub fn do(line: *Line) !bool {
},
.control => |ctrl| {
switch (ctrl) {
.esc => continue,
.up => line.findHistory(.up),
.down => line.findHistory(.down),
.backspace => line.hsh.tkn.pop(),