Skip to content

Commit 08ca515

Browse files
fcouryclaude
andcommitted
fix: truncate long messages from the left to prevent overflow
- Add width calculation based on editor size - Truncate messages from the left side when they exceed available width - Add ellipsis (...) at the beginning of truncated messages - Ensures messages stay within editor bounds and remain right-aligned 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent c9ba85e commit 08ca515

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

plugins/fidget.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ function updateOverlay(red, info, messages, spinnerIcon) {
7171
log("[FIDGET] Updating overlay with", messages.size, "messages");
7272

7373
const lines = [];
74+
const maxWidth = info.size[0] - 4; // Leave some padding from the right edge
7475

7576
// Convert messages to overlay lines (stack from bottom up)
7677
const messageArray = Array.from(messages.entries()).slice(0, config.maxMessages);
@@ -119,6 +120,12 @@ function updateOverlay(red, info, messages, spinnerIcon) {
119120
displayText = `${msg.text} ${spinnerIcon}`;
120121
}
121122

123+
// Truncate from the left if the message is too long
124+
if (displayText.length > maxWidth) {
125+
// Keep the right side of the message, add ellipsis on the left
126+
displayText = "..." + displayText.substring(displayText.length - maxWidth + 3);
127+
}
128+
122129
lines.push({
123130
text: displayText,
124131
style: info.theme.style

0 commit comments

Comments
 (0)