Skip to content

Commit

Permalink
fix: problem without readline module
Browse files Browse the repository at this point in the history
Poor handling of inputs such as cursor movements using left and right
arrow keys. See more detail at issue #12 below:
#12
  • Loading branch information
efJerryYang committed Mar 28, 2023
1 parent f2ca42c commit 19abe79
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "chatgpt-cli-md"
version = "0.1.7"
version = "0.1.8"
description = "A markdown-supported command-line interface tool that connects to ChatGPT using OpenAI's API key."
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.8"
Expand Down
2 changes: 2 additions & 0 deletions src/utils/io.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys
import tempfile
import readline
import subprocess
from typing import Dict

Expand Down Expand Up @@ -119,6 +120,7 @@ def user_input(prompt="\nUser: ") -> str:
lines.append(line)
# Update the prompt using readline
prompt = "\r" + " " * len(prompt) + "\r" + " .... "
readline.get_line_buffer()
# Print a message indicating that the input has been submitted
msg = "\n\n".join(lines).strip()
if not msg:
Expand Down

0 comments on commit 19abe79

Please sign in to comment.