emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/subed 87b3823 353/389: subed-split-subtitle works at the b


From: ELPA Syncer
Subject: [nongnu] elpa/subed 87b3823 353/389: subed-split-subtitle works at the beginning or end of subtitle text
Date: Fri, 3 Dec 2021 11:00:56 -0500 (EST)

branch: elpa/subed
commit 87b382358eb59abb2aadb35c94804a00fc1285a8
Author: Sacha Chua <sacha@sachachua.com>
Commit: Random User <rndusr@posteo.de>

    subed-split-subtitle works at the beginning or end of subtitle text
    
    * subed/subed-common.el (subed-split-subtitle): Allow splitting at the
    beginning or end of subtitle text.
---
 subed/subed-common.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/subed/subed-common.el b/subed/subed-common.el
index e99beea..d16f5e0 100644
--- a/subed/subed-common.el
+++ b/subed/subed-common.el
@@ -637,17 +637,17 @@ Update the end timestamp accordingly."
   (let* ((end-timestamp (subed-subtitle-msecs-stop))
          (orig (point))
          (text-beg (save-excursion (subed-jump-to-subtitle-text)))
-         (text-end (save-excursion (subed-jump-to-subtitle-end)))
-         (text (buffer-substring orig (save-excursion 
(subed-jump-to-subtitle-end) (point)))))
+         (text-end (save-excursion (or (subed-jump-to-subtitle-end) (point))))
+         (text (buffer-substring orig text-end)))
     (unless subed-mpv-playback-position
       (error "Not playing back in MPV"))
-    (unless (and text-beg text-end (> orig text-beg) (< orig text-end))
+    (unless (and text-beg text-end (>= orig text-beg) (<= orig text-end))
       (error "Not in the middle of subtitle text"))
     (when (or (> subed-mpv-playback-position end-timestamp)
               (< subed-mpv-playback-position (subed-subtitle-msecs-start)))
       (error "Not in the currently playing subtitle segment"))
     (subed-set-subtitle-time-stop subed-mpv-playback-position)
-    (delete-region (point) (subed-jump-to-subtitle-end))
+    (delete-region (point) text-end)
     (subed-append-subtitle nil subed-mpv-playback-position end-timestamp 
(string-trim text))
     (subed-regenerate-ids-soon)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]