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

Dynamic padding in ML and MR modes #8

Closed
mcookly opened this issue Apr 2, 2023 · 1 comment
Closed

Dynamic padding in ML and MR modes #8

mcookly opened this issue Apr 2, 2023 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@mcookly
Copy link
Owner

mcookly commented Apr 2, 2023

This might be clunky…

When enabling Bidi-Mode, get window width and textwidth (see which is longer).
Use that width to inform fribidi of the padding length for the current line depending on base direction.
Insert contents into buffer, but I think it should also insert some symbol to designate a line break,
so that on a change in textwidth (using SetOption event) or window size (using WindowResized event) lets some function re-wrap the lines accordingly.

↳ or ↪︎ might be good options to use on the left side of the buffer to indicate a line should wrap with the above.
For example (the m's are just to force the base direction as LTR)

|mבראשית ברא אלהים את|
|↪︎    mהשמים ואת הארץ|
^ window edges       ^

This function doesn't have to be super efficient since it only is triggered when the display changes, not when the user is actively editing the file.
I can also add an option to change what the linebreak indicator is.

Things get especially tricky when the user is typing though.
I will have to add an autocmd that listens for InsertCharPre on the current line and updates the whitespace accordingly.
When it comes to wrapping text, I'll have to watch the line-length without padding and jump the user to a new line with padding when the chars reach col 0 (and bring the current word if needbe).
If the user backspaces when in the textwidth/window-width column on a wrapped line,
delete the line and move the cursor back up.

@mcookly mcookly added the enhancement New feature or request label Apr 2, 2023
@mcookly mcookly added this to the 1.0.0 milestone Apr 2, 2023
@mcookly
Copy link
Owner Author

mcookly commented Apr 5, 2023

Unfortunately, this is too clunky and slow to implement at the moment.
I may retry dynamic padding (and hence the ML and MR modes)
if I ever begin to use native C with fribidi.

@mcookly mcookly closed this as completed Apr 5, 2023
@mcookly mcookly reopened this Apr 5, 2023
@mcookly mcookly closed this as not planned Won't fix, can't repro, duplicate, stale Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant