From 60a3925fbf477c52a96774e12b0dc5c546927394 Mon Sep 17 00:00:00 2001 From: "m@yim.jp" Date: Sun, 11 Jan 2026 12:04:12 +0000 Subject: [PATCH] fix: maintain input width when showing suggestion Restore padding after suffix to keep original width. --- internal/view/command_input.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/view/command_input.go b/internal/view/command_input.go index 60bf8b5..87af7a0 100644 --- a/internal/view/command_input.go +++ b/internal/view/command_input.go @@ -254,8 +254,15 @@ func (c *CommandInput) renderInputWithSuggestion(s commandInputStyles, input str // Remove trailing padding from textinput so suggestion appears right after cursor trimmedView := strings.TrimRight(baseView, " ") - // Render: trimmed input + dim suffix (within same input box style) - return s.input.Render(trimmedView + s.suggestion.Render(suffix)) + // Restore padding after suffix to maintain original width + removedPadding := len(baseView) - len(trimmedView) + paddingNeeded := removedPadding - len(suffix) + if paddingNeeded < 0 { + paddingNeeded = 0 + } + + // Render: trimmed input + dim suffix + padding (within same input box style) + return s.input.Render(trimmedView + s.suggestion.Render(suffix) + strings.Repeat(" ", paddingNeeded)) } // View renders the command input