karthink / gptel

A simple LLM client for Emacs
GNU General Public License v3.0
1.03k stars 111 forks source link

(gptel-menu) Truncated width of system message is wrong #317

Open karthink opened 1 month ago

karthink commented 1 month ago

The system message string in gptel's transient menu is truncated to the width of the selected window when the transient is called. This means the width is wrong if the window is part of a split and the transient menu is displayed in a full-frame side-window at the bottom. The opposite situation can also occur depending on the value of transient-display-buffer-action.

The string needs to be prepared before the transient window is created, so we need a way to predict the system message width that will be required.


Actually neither window-width nor frame-width are correct here, since the width of the transient window depends on the value of transient-display-buffer-action. For example, transient menus appear below the active window for me, which means they are only as wide as the window, not the frame:

2024-05-02-113244_1427x744_scrot

So a better fix is needed.

Originally posted by @karthink in https://github.com/karthink/gptel/issues/301#issuecomment-2091238801