fix(gsd): improve notification overlay backdrop and content-fit sizing
Use dark gray background + dim foreground for visible backdrop effect instead of barely-perceptible SGR dim. Size overlay box to content instead of padding to fill the entire viewport.
This commit is contained in:
parent
9d1e343e41
commit
c35385fe53
2 changed files with 6 additions and 10 deletions
|
|
@ -324,10 +324,12 @@ export function compositeOverlays(
|
|||
|
||||
const viewportStart = Math.max(0, workingHeight - termHeight);
|
||||
|
||||
// Apply backdrop dimming if any visible overlay requests it
|
||||
// Apply backdrop dimming if any visible overlay requests it.
|
||||
// Uses dim + dark gray background (256-color 233) so the overlay pops visually.
|
||||
const hasBackdrop = visibleEntries.some((e) => e.options?.backdrop);
|
||||
if (hasBackdrop) {
|
||||
const dimFn = (text: string) => `\x1b[2m${text}\x1b[22m`;
|
||||
const dimFn = (text: string) =>
|
||||
`\x1b[2m\x1b[38;5;242m\x1b[48;5;233m${text}\x1b[49m\x1b[39m\x1b[22m`;
|
||||
for (let i = viewportStart; i < result.length; i++) {
|
||||
if (!isImageLine(result[i]) && result[i].length > 0) {
|
||||
result[i] = applyBackgroundToLine(result[i], termWidth, dimFn);
|
||||
|
|
|
|||
|
|
@ -157,18 +157,12 @@ export class GSDNotificationOverlay {
|
|||
}
|
||||
|
||||
const content = this.buildContentLines(width);
|
||||
const viewportHeight = Math.max(5, process.stdout.rows ? process.stdout.rows - 8 : 24);
|
||||
const chromeHeight = 2; // top + bottom border
|
||||
const visibleContentRows = Math.max(1, viewportHeight - chromeHeight);
|
||||
const maxVisibleRows = Math.max(5, process.stdout.rows ? process.stdout.rows - 8 : 24) - 2;
|
||||
const visibleContentRows = Math.min(content.length, maxVisibleRows);
|
||||
const maxScroll = Math.max(0, content.length - visibleContentRows);
|
||||
this.scrollOffset = Math.min(this.scrollOffset, maxScroll);
|
||||
const visibleContent = content.slice(this.scrollOffset, this.scrollOffset + visibleContentRows);
|
||||
|
||||
// Pad to fill viewport so the overlay covers underlying content
|
||||
while (visibleContent.length < visibleContentRows) {
|
||||
visibleContent.push("");
|
||||
}
|
||||
|
||||
const lines = this.wrapInBox(visibleContent, width);
|
||||
|
||||
this.cachedWidth = width;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue