Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fancy overwrite-mode when point is on a timestamp #2

Open
rndusr opened this issue Jul 2, 2019 · 1 comment
Open

Fancy overwrite-mode when point is on a timestamp #2

rndusr opened this issue Jul 2, 2019 · 1 comment

Comments

@rndusr
Copy link
Collaborator

rndusr commented Jul 2, 2019

It would be convenient if a timestamp could be edited by just typing the new digits without removing the old ones, i.e. what overwrite-mode (bound to Insert by default) does.

Point could also automatically skip over colons and the comma in a timestamp so that you can move point to the beginning of "00:00:00,000", type "123456789" and it would result in "12:34:56,789".

Essentially, it should be impossible to make the timestamp invalid while in subed-mode, and it should be very quick to navigate to and within timestamps and changing them.

Implementation

Text properties or overlays should make this possible, but I have no idea how exactly.

Maybe a function in modification_hooks? For overlays, these are called both before and after a buffer change. But that seems quite complicated.

There is already subed-point-motion-hook, which could be used to determine if point is on a timestamp and enable or disable overlay-mode accordingly.

Maybe it's possible to use the cursor-intangible property to implement the skipping of ":" and ","?

Is it a good idea to apply properties when loading a file or does that take too many resources? Would it be possible to add/remove properties as they come into view?

Or should there be a special mode for editing the timestamps of the current subtitle that can be enabled with a key? For example, M-RET moves point to the beginning of the start time and creates an overlay. If point is already on the start time, M-RET moves point to the stop time. If point is already on the stop time, move back to the text or original position.

@mbork
Copy link
Contributor

mbork commented May 17, 2021

You could define commands to enter digits with overwriting/skipping non-digits, define a keymap with them and use the keymap property on the timestamps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants