this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

textinput: add more readline bindings

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>

+15 -4
+15 -4
src/widgets/TextInput.zig
··· 38 38 if (key.matches(Key.backspace, .{})) { 39 39 if (self.cursor_idx == 0) return; 40 40 self.deleteBeforeCursor(); 41 - } else if (key.matches(Key.delete, .{})) { 41 + } else if (key.matches(Key.delete, .{}) or key.matches('d', .{ .ctrl = true })) { 42 42 if (self.cursor_idx == self.grapheme_count) return; 43 43 self.deleteAtCursor(); 44 - } else if (key.matches(Key.left, .{})) { 44 + } else if (key.matches(Key.left, .{}) or key.matches('b', .{ .ctrl = true })) { 45 45 if (self.cursor_idx > 0) self.cursor_idx -= 1; 46 - } else if (key.matches(Key.right, .{})) { 46 + } else if (key.matches(Key.right, .{}) or key.matches('f', .{ .ctrl = true })) { 47 47 if (self.cursor_idx < self.grapheme_count) self.cursor_idx += 1; 48 + } else if (key.matches('a', .{ .ctrl = true })) { 49 + self.cursor_idx = 0; 50 + } else if (key.matches('e', .{ .ctrl = true })) { 51 + self.cursor_idx = self.grapheme_count; 52 + } else if (key.matches('k', .{ .ctrl = true })) { 53 + while (self.cursor_idx < self.grapheme_count) { 54 + self.deleteAtCursor(); 55 + } 56 + } else if (key.matches('u', .{ .ctrl = true })) { 57 + while (self.cursor_idx > 0) { 58 + self.deleteBeforeCursor(); 59 + } 48 60 } else if (key.text) |text| { 49 61 try self.buf.insertSlice(self.byteOffsetToCursor(), text); 50 62 self.cursor_idx += 1; 51 63 self.grapheme_count += 1; 52 64 } 53 - // TODO: readline bindings 54 65 }, 55 66 } 56 67 }