Skip to content

Commit 49dfc2e

Browse files
committed
Handle ^P ^N keys
1 parent 5d84efd commit 49dfc2e

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/repl/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ include ../../config.mk
33
all:
44
go build -o mai-repl .
55

6+
indent fmt:
7+
go fmt
8+
69
install:
710
mkdir -p $(DESTDIR)/$(PREFIX)/bin
811
ln -fs $(shell pwd)/mai-repl $(DESTDIR)/$(PREFIX)/bin/mai-repl

src/repl/readline.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,14 @@ func (r *ReadLine) Read() (string, error) {
341341
r.moveCursorToEnd()
342342
continue
343343

344+
case 16: // Ctrl+P (previous history)
345+
r.navigateHistory(-1)
346+
continue
347+
348+
case 14: // Ctrl+N (next history)
349+
r.navigateHistory(1)
350+
continue
351+
344352
case 9: // Tab (completion)
345353
// Return a special value to indicate tab was pressed
346354
// This will be handled by the REPL's tab completion logic

0 commit comments

Comments
 (0)