Skip to content

gptel-transient: Polish gptel--read-with-prefix user experience #652

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

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

Conversation

pabl0
Copy link
Contributor

@pabl0 pabl0 commented Feb 18, 2025

  • gptel-transient.el (gptel--read-with-prefix-help): Turn into a function to show one function.
    (gptel--read-with-prefix): Enable resizing minibuffer (to make cycling the ov meaningful). Drop make-separator-line' which is buggy. Move the prompt to the last line, which looks better and avoids cursor jumping. Use window-max-chars-per-line' instead of `window-width' (which is incorrect in terminal). Replace newlines with return symbol. Calculate the multi-line layoyt correctly to use all available space on the last line. Cycle between just two modes: one line and multiple lines (hiding one line does not add much value). Don't show the TAB help if the whole prefix fits into one line. (gptel--infix-add-directive): Use simple prompt.

  • gptel-rewrite.el (gptel--infix-rewrite-extra): Use simple prompt.

Replace RETURN LEFT (U+2C90) with smaller RETURN SYMBOL (U+23CE), which looks more readable (with many typefaces) between two pieces of text.

@pabl0
Copy link
Contributor Author

pabl0 commented Feb 18, 2025

I made slight refactoring changes (use cl-flet) and fixed a bug related to calling gptel--read-with-prefix with a nil value.

* gptel-transient.el (gptel--read-with-prefix-help): Turn into
a function to show one function.
(gptel--read-with-prefix): Enable resizing minibuffer (to make cycling
the ov meaningful). Drop `make-separator-line' which is buggy. Move
the prompt to the last line, which looks better and avoids cursor
jumping. Use `window-max-chars-per-line' instead of
`window-width' (which is incorrect in terminal). Replace newlines with
return symbol. Calculate the multi-line layoyt correctly to use all
available space on the last line. Cycle between just two modes: one
line and multiple lines (hiding one line does not add much value).
Don't show the TAB help if the whole prefix fits into one line.
(gptel--infix-add-directive): Use simple prompt.

* gptel-rewrite.el (gptel--infix-rewrite-extra): Use simple prompt.

Replace RETURN LEFT (U+2C90) with smaller RETURN SYMBOL (U+23CE),
which looks more readable (with many typefaces) between two pieces of
text.
@pabl0 pabl0 force-pushed the read-with-prefix branch from 805e08f to 6d2fa99 Compare March 12, 2025 12:13
@pabl0
Copy link
Contributor Author

pabl0 commented Mar 25, 2025

Have you had the opportunity to review this? I find the current implementation a bit clumsy, and this took unexpectedly significant effort to achieve. :-)

@karthink
Copy link
Owner

karthink commented Apr 2, 2025

Not yet, as it looks pretty involved. I will get to this, I'm busy writing the gptel manual at the moment.

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.

2 participants