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

translate-recenter doesn't work well with markdown bulleted list and numbered list #2

Open
rayw000 opened this issue Apr 2, 2022 · 0 comments

Comments

@rayw000
Copy link
Owner

rayw000 commented Apr 2, 2022

Assume we have sections in translation and reference buffer both in the following format.

some text 1

...

some text 2
- list item 1
- list item 2
- list item 3

By doing translate-recenter when cursor is at some text 2, you will get a highlighted overlay in translation buffer from some text 2 to - list item 3, while in reference buffer, it highlights - list item 3 only.

It is because the two functions markdown-forward-paragraph and markdown-backward-paragraph set to variables translate-*ward-paragraph-function are asymmetric. Doing markdown-forward-paragraph at some text 2 moves cursor to the next line after - list item 3, but markdown-backward-paragraph from this position moves cursor back to - list item 3.

translate-recenter invokes translate-sync-cursor-to-current-paragraph function to achieve cursor syncing. It counts paragraphs by using translate-forward-paragraph-function to jump over them one by one from the beginning of buffer to a maximum position no larger than the current (point), and then let the cursor in the reference buffer jump the same number of paragraphs. To have a pretty highlight overlay without extra blank lines, translate-backward-paragraph-function is used to do some adjustments, which causes these problem.

A possible workaround would be setting the translate-*ward-paragraph-function to forward-paragraph and backward-paragraph, since they are blank line based.

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

1 participant