Skip to content

Commit

Permalink
left/right arrow key readline bindings in chat, closes #376
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jan 26, 2024
1 parent 029d8e9 commit 1a4853d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion llm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,9 @@ def chat(
"""
Hold an ongoing chat with a model.
"""
readline.parse_and_bind("")
# Left and right arrow keys to move cursor:
readline.parse_and_bind("\\e[D: backward-char")
readline.parse_and_bind("\\e[C: forward-char")
log_path = logs_db_path()
(log_path.parent).mkdir(parents=True, exist_ok=True)
db = sqlite_utils.Database(log_path)
Expand Down

1 comment on commit 1a4853d

@rsbohn
Copy link

@rsbohn rsbohn commented on 1a4853d May 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just upgraded to 0.14 on Windows 11. These key bindings fail on Windows.

Please sign in to comment.