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

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

[nongnu] elpa/subed cfe8d1c 228/389: subed-srt--backward-subtitle-id: Do


From: ELPA Syncer
Subject: [nongnu] elpa/subed cfe8d1c 228/389: subed-srt--backward-subtitle-id: Don't look for different ID
Date: Fri, 3 Dec 2021 11:00:31 -0500 (EST)

branch: elpa/subed
commit cfe8d1c1cb4d417815c393e94183d9b583c53309
Author: Random User <rndusr@posteo.de>
Commit: Random User <rndusr@posteo.de>

    subed-srt--backward-subtitle-id: Don't look for different ID
    
    The previous looked for an ID different from the current one when moving to 
the
    previous ID.  But it doesn't really matter if all the IDs are the same, and 
it's
    unintuitive if point refuses to move backwards because the previous 
subtitle has
    the same ID.
---
 subed/subed-srt.el | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/subed/subed-srt.el b/subed/subed-srt.el
index f422ab5..f6a5e0c 100644
--- a/subed/subed-srt.el
+++ b/subed/subed-srt.el
@@ -249,14 +249,14 @@ Return point or nil if there is no next subtitle."
   "Move point to previous subtitle's ID.
 Return point or nil if there is no previous subtitle."
   (interactive)
-  (let ((orig-point (point))
-        (orig-sub-id (subed-srt--subtitle-id)))
+  (let ((orig-point (point)))
     (when (subed-srt--jump-to-subtitle-id)
-      (forward-line -1)
-      (if (= (subed-srt--subtitle-id) orig-sub-id)
-          (progn (goto-char orig-point)
-                 nil)
-        (subed-srt--jump-to-subtitle-id)))))
+      (if (re-search-backward (concat "\\(" subed-srt--regexp-separator 
"\\|\\`[[:space:]]*\\)" "\\([0-9]+\\)\n") nil t)
+          (progn
+            (goto-char (match-beginning 2))
+            (point))
+        (goto-char orig-point)
+        nil))))
 
 (defun subed-srt--forward-subtitle-text ()
   "Move point to next subtitle's text.



reply via email to

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