From d31cec03834e9df8929a688fea4b678d344eeefd Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Sat, 25 Oct 2025 10:49:40 +0200 Subject: [PATCH] Improves prompt notification duration calculation Enhances notification display logic to prevent flicker and ensure minimum visibility - Adds floor of 0 for delay milliseconds to prevent negative values - Ensures minimum notification duration of 300ms to improve user experience - Maintains existing logic for longer delay times --- commands/timedPrompts.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/commands/timedPrompts.ts b/commands/timedPrompts.ts index 849f1d8..c7593dc 100644 --- a/commands/timedPrompts.ts +++ b/commands/timedPrompts.ts @@ -178,9 +178,10 @@ export class TimedPromptsCommand { // Calculate notification duration: slightly less than delay to avoid overlap // For very short delays (<=1s), use 900ms or delay-100ms (whichever is smaller) - // to prevent flicker; otherwise end 500ms before next tick - const delayMs = delaySeconds * 1000; - const notificationDuration = delayMs > 1000 ? (delayMs - 500) : Math.min(900, delayMs - 100); + // Clamp to minimum 300ms to prevent flicker/invisible notices + const delayMs = Math.max(0, delaySeconds * 1000); + const notificationDuration = + delayMs > 1000 ? (delayMs - 500) : Math.max(300, Math.min(900, delayMs - 100)); const notice = new Notice( `Writing Prompt ${promptNumber}/${totalPrompts}:\n\n${prompt}`,