[memory] shorten cells too wide to fit in prompt #2287
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If I press
Alt+m
(memo-cells
) on a cell that has contents too wide to fit on the screen, the command fails due to an exception:This PR shortens the cell contents, so the prompt will fit on screen and prevent this error.
In the worst case, when the default column width is about as wide as the screen, then the right side of the
memo-cells
prompt will be overwritten byrightStatus()
. The prompt won't be very readable. But the user can widen their terminal to make the prompt readable, and continue the memo action from there.In this PR, I used a default max width of
options.default_width
. We could instead usecursorCol.width
. That would match the prompt's quoted cell width to the width in the sheet. The advantage there is if the cell is truncated with'…'
, it's truncated the same in both places, so the cell's last few characters match in both places. The drawback is that the column may be one the user made very wide, which would make the prompt unreadable from being overwritten by the right status bar.What makes more sense?