Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

truncate very long filenames in build output during stream and prevent possible panic, fixes #84

Dane Schneiderc51dc635acb3
diff --git a/app/cli/stream_tui/view.go b/app/cli/stream_tui/view.go
index d7a68f0a..4bbf9768 100644
--- a/app/cli/stream_tui/view.go
+++ b/app/cli/stream_tui/view.go
@@ -117,14 +117,22 @@ func (m streamUIModel) doRenderBuild(outputStatic bool) string {
} else if tokens > 0 {
block += fmt.Sprintf(" %d 🪙", tokens)
}
+ maybeBlockWidth := lipgloss.Width(block)
+
+ if maybeBlockWidth > m.width {
+ maxWidth := m.width - lipgloss.Width("⋯")
+ runes := []rune(block)
+ firstHalf := string(runes[:maxWidth/2])
+ secondHalf := string(runes[len(runes)-maxWidth/2:])
+ block = firstHalf + "⋯" + secondHalf
+ }
maybePrefix := ""
if rowIdx > 0 {
maybePrefix = " | "
+ maybeBlockWidth += lipgloss.Width(maybePrefix)
}
- maybeBlockWidth := lipgloss.Width(maybePrefix + block)
-
if lineWidth+maybeBlockWidth > m.width {
lineWidth = 0
lineNum++
diff --git a/releases/cli/versions/0.8.3.md b/releases/cli/versions/0.8.3.md
index b045acdb..b01080dd 100644
--- a/releases/cli/versions/0.8.3.md
+++ b/releases/cli/versions/0.8.3.md
@@ -1,2 +1,3 @@
- Add support for new OpenAI models: `gpt-4-turbo` and `gpt-4-turbo-2024-04-09` -- these models haven't been set as defaults yet since they need more testing, but can be used with the `set-model` command
-- Fix for `set-model` command argument parsing (https://github.com/plandex-ai/plandex/issues/75)
\ No newline at end of file
+- Fix for `set-model` command argument parsing (https://github.com/plandex-ai/plandex/issues/75)
+- Fix for panic during plan stream when a file name's length exceeds the terminal width (https://github.com/plandex-ai/plandex/issues/84)
\ No newline at end of file