From fc6d61e41b1b0e0686d1346694445dc119b97872 Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Sun, 28 Jun 2026 23:58:07 +0800
Subject: [PATCH] Fix hold recording head and tail clipping

---
 privatevoice.src/app.go |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/privatevoice.src/app.go b/privatevoice.src/app.go
index c73f9c8..b40cd98 100755
--- a/privatevoice.src/app.go
+++ b/privatevoice.src/app.go
@@ -28,8 +28,8 @@
 )
 
 const (
-	appVersion        = "2.1.35"
-	appBuild          = "20260623.1435"
+	appVersion        = "2.1.36"
+	appBuild          = "20260628.2354"
 	appDisplayVersion = appVersion + " (build " + appBuild + ")"
 	appName           = "PrivateVoice Dictation"
 
@@ -37,6 +37,7 @@
 	silenceTimeoutDuration   = 3 * time.Second // auto-stop after this much silence in free-talk
 	silenceGracePeriod       = 2 * time.Second // don't auto-stop within first 2s of free-talk
 	holdActivationDelay      = 180 * time.Millisecond
+	defaultReleaseTailDelay  = 300 * time.Millisecond
 	doneIndicatorHideDelayMs = 250
 	liveCaptionInterval      = 120 * time.Millisecond
 	liveCaptionMaxBytes      = 108
@@ -985,9 +986,12 @@
 }
 
 func releaseTailCaptureDelayForEngine(eng engine.Engine) time.Duration {
+	if eng == nil {
+		return 0
+	}
 	tailCaptureEng, ok := eng.(engine.ReleaseTailCaptureEngine)
 	if !ok {
-		return 0
+		return defaultReleaseTailDelay
 	}
 	delay := tailCaptureEng.ReleaseTailCaptureDelay()
 	if delay < 0 {
@@ -997,9 +1001,12 @@
 }
 
 func holdPreCaptureEnabledForEngine(eng engine.Engine) bool {
+	if eng == nil {
+		return false
+	}
 	preCaptureEng, ok := eng.(engine.HoldPreCaptureEngine)
 	if !ok {
-		return false
+		return true
 	}
 	return preCaptureEng.HoldPreCaptureEnabled()
 }

--
Gitblit v1.9.3