skyl / corpora

Corpora is a self-building corpus that can help build other arbitrary corpora
GNU Affero General Public License v3.0
2 stars 0 forks source link

Improve Multiline Editing in Terminal Interface #24

Open skyl opened 1 week ago

skyl commented 1 week ago

Objective

Enhance the terminal's multiline input capabilities to provide an intuitive editing experience similar to IPython, potentially using prompt_toolkit or alternative solutions.

Tasks

  1. Explore IPython REPL:

    • Investigate how IPython handles multiline editing and navigation in its REPL.
    • Determine methodologies or libraries used that can be borrowed or adapted.
  2. Evaluate prompt_toolkit or Alternatives:

    • Consider using prompt_toolkit for its multiline editing features.
    • Explore other libraries or custom solutions that might better fit the requirements.
  3. Implement Intuitive Exit Strategy:

    • Develop a user-friendly way to exit the multiline input mode, avoiding complex sequences like escape :wq enter.
    • Ensure it aligns with common user expectations or offer configuration options.
  4. Testing and Feedback:

    • Test the new implementation thoroughly.
    • Gather user feedback to refine the exit strategy and overall interface usability.
skyl commented 1 week ago
        # Display the current state of messages
        # # c.console.print("\nCurrent Messages:\n", style="dim")
        # for i, msg in enumerate(messages, start=1):
        #     c.console.print(f"[{msg.role}]\n\n{msg.text}")
        # Allow the user to edit their next input in a text editor
        # user_input = click.edit("")
        # no, just use a typer input
        # user_input = typer.prompt(
        #     "Issue summary" if not messages else "How should we change this issue?"
        # )
        user_input = session.prompt(
            (
                "Issue summary:\n"
                if not messages
                else "How should we change this issue?\n"
            ),
            multiline=True,
            # enable_history_search=True,
            # mode="vi",
            vi_mode=True,
        )
skyl commented 1 week ago

I kinda' like the vim-style exit once you're used to it. But, for normies, esc :qw enter enter is quite a lot to submit the text. But the multiline CLI input is not terrible as it is 🤔