Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readline bindings only on mac and windows. fixes simonw/llm#516 simonw/llm#582 #560

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

grota
Copy link

@grota grota commented Aug 27, 2024

fixes #516

@grota grota changed the title Enable backslash in chat, fixes #516 Enable backslash in chat, fixes simonw/llm#516 Aug 27, 2024
@grota grota changed the title Enable backslash in chat, fixes simonw/llm#516 Import readline only on Darwin, fixes simonw/llm#516 simonw/llm#582 simonw/llm#585 Oct 25, 2024
@grota
Copy link
Author

grota commented Oct 25, 2024

@simonw I modified the PR to import readline and bind only on Darwin, this fixes the following 4 open issues: #516 #582 #585 #495

As commented elsewhere, digging through the history it seems like readline is used to fix this issue #376 which is the proper fix for #355 (so basically, the standard terminal on osx).

It's a simple PR, can you please give it a look?

@grota grota changed the title Import readline only on Darwin, fixes simonw/llm#516 simonw/llm#582 simonw/llm#585 Import readline only on Darwin, fixes simonw/llm#516 simonw/llm#582 simonw/llm#585 simonw/llm#495 Oct 25, 2024
@knorthover
Copy link

I just hit this issue with readline on Windows 10. Claude Sonnet suggested this patch to use the codes readline recognizes for Windows. It works.

    import platform
    if platform.system() == 'Windows':
        readline.parse_and_bind("Left: backward-char")
        readline.parse_and_bind("Right: forward-char")
    else:
        readline.parse_and_bind("\\e[D: backward-char")
        readline.parse_and_bind("\\e[C: forward-char") ```

@grota
Copy link
Author

grota commented Nov 2, 2024

Based on the analysis above, the two bindings were introduced to address an issue on macOS (darwin), specifically with the default iTerm app.

Considering the existing issues, I believe it’s fair to say that on Linux and Windows, these bindings have caused more problems than they've solved. So I stand by my original PR which removes the import and bindings on those platforms.

In fact, I don't think hardcoding these bindings is a good approach even on darwin. It wouldn’t surprise me if similar issues arose on macOS with other terminal emulators.

@simonw I'm asking you once again if can you please have a look at this simple PR of mine

@grota grota changed the title Import readline only on Darwin, fixes simonw/llm#516 simonw/llm#582 simonw/llm#585 simonw/llm#495 Import readline only on Darwin, fixes simonw/llm#516 simonw/llm#582 simonw/llm#585 Dec 2, 2024
@grota grota changed the title Import readline only on Darwin, fixes simonw/llm#516 simonw/llm#582 simonw/llm#585 readline bindings only on mac and windows. fixes simonw/llm#516 simonw/llm#582 simonw/llm#585 Dec 2, 2024
@grota grota changed the title readline bindings only on mac and windows. fixes simonw/llm#516 simonw/llm#582 simonw/llm#585 readline bindings only on mac and windows. fixes simonw/llm#516 simonw/llm#582 Dec 2, 2024
@grota
Copy link
Author

grota commented Dec 2, 2024

@simonw just FYI, I rebased and rewritten the PR to perform readline bindings only on darwin and windows, as per the new code by @sukhbinder in #646.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

backslash cannot be used in llm chat
2 participants