[gnome-subtitles] Fix #167 - Subtitle shown on the video not immediately updated while being edited



commit 8055f1f9b989081a7d9ec001e4b94278e3bada3e
Author: Pedro Castro <pedro gnomesubtitles org>
Date:   Sat Jan 30 21:49:57 2021 +0000

    Fix #167 - Subtitle shown on the video not immediately updated while
    being edited

 src/GnomeSubtitles/Ui/VideoPreview/SubtitleTracker.cs | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/GnomeSubtitles/Ui/VideoPreview/SubtitleTracker.cs 
b/src/GnomeSubtitles/Ui/VideoPreview/SubtitleTracker.cs
index c79d5ab..6766223 100755
--- a/src/GnomeSubtitles/Ui/VideoPreview/SubtitleTracker.cs
+++ b/src/GnomeSubtitles/Ui/VideoPreview/SubtitleTracker.cs
@@ -1,6 +1,6 @@
 /*
  * This file is part of Gnome Subtitles.
- * Copyright (C) 2007-2019 Pedro Castro
+ * Copyright (C) 2007-2021 Pedro Castro
  *
  * Gnome Subtitles is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -80,6 +80,11 @@ public class SubtitleTracker {
                
                EmitSubtitlePulse(this.currentSubtitleIndex);
        }
+       
+       //Used because its text may have changed
+       private void RefreshCurrentSubtitle () {
+               EmitSubtitlePulse(this.currentSubtitleIndex);
+       }
 
        private void EmitSubtitlePulse(int newIndex) {
                if (SubtitlePulse != null)
@@ -109,8 +114,10 @@ public class SubtitleTracker {
                if (!Base.IsDocumentLoaded) {
                        return;
                }
-
-               if (!IsTimeInCurrentSubtitle(newPosition)) {
+               
+               if (IsTimeInCurrentSubtitle(newPosition)) {
+                       RefreshCurrentSubtitle(); //Force a refresh because its text may have changed
+               } else {
                        int foundSubtitle = searchOp.FindWithTime(newPosition);
                        if (foundSubtitle == -1) {
                                ClearCurrentSubtitle();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]