sachac / subed

subed is a subtitle editor for Emacs
177 stars 16 forks source link

subed-split-subtitle: Use offset or text fraction #32

Closed sachac closed 3 years ago

sachac commented 3 years ago

If called interactively, calling it with one prefix argument prompts for the offset in milliseconds. Calling it with two prefix arguments uses the relative position of the point even if MPV is playing.

sachac commented 3 years ago

Hello, @rndusr! I remember you wanted subed-split-subtitle to work even if the current subtitle isn't being played in mpv. This one seems to behave pretty reasonably for me, usually getting a close approximation of the right splitting point instead of splitting halfway. The offset also makes it easy to say "Split the last second into the next subtitle." What do you think?

rndusr commented 3 years ago

Looks good. I only did some quick manual tests and everything seems to work as expected.

There seems to be a very minor bug that adds a surplus newline between the current and the newly inserted subtitle: In a subtitle with two lines, place point on the beginning of the second line and then split. You end up with two empty lines between the subtitles instead of one.

This is fixed automatically when the file is saved, so it's mildly annoying at worst.

Adding tests for all the edge cases would be nice if you feel like writing them (no pressure!). Tests helped me tremendously to keep my sanity because thinking of and applying all the situations a user might use a specific function is not trivial.

Thank you!