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

Extmarks api: allow for gravity #13679

Merged
merged 4 commits into from Jan 22, 2021
Merged

Extmarks api: allow for gravity #13679

merged 4 commits into from Jan 22, 2021

Conversation

chentoast
Copy link
Contributor

Allows for extmark gravity to be set.

An example: suppose we have the following text, with an extmark placed where the pipe is:

asdf|asdf

normally, if we type (gravity = "right"), the extmark will move with the cursor:

asdfhello|asdf

but with gravity = "left", the extmark will stay put:

asdf|helloasdf.

To decide: do we want to allow gravity for the end_col and end_row of extmarks as well? Would be useful to know of potential use cases where this would be needed.

src/nvim/api/buffer.c Outdated Show resolved Hide resolved
src/nvim/api/buffer.c Outdated Show resolved Hide resolved
@chentoast
Copy link
Contributor Author

better to make it a bool, there will only be two values.

There was a helpful discussion about this in #12249. In the end, I felt that two options seemed the best to me:

{gravity = "right"}, {gravity = "left"}

or

{right_gravity = true}, {right_gravity = false}

Either option is fine with me. Once we decide on which one to go with, I'll add the corresponding option for end_gravity.

@bfredl
Copy link
Member

bfredl commented Jan 4, 2021

right_gravity=true is better.

@chentoast chentoast requested a review from bfredl January 6, 2021 18:28
@runiq
Copy link
Contributor

runiq commented Jan 10, 2021

What about RTL (if it's ever going to be supported with extmarks, that is)? Would it make sense for RTL text to have right_gravity=false by default?

@runiq
Copy link
Contributor

runiq commented Jan 10, 2021

Friendly reminder: #12742 is still open, if you find anything useful in there, feel free to steal :)

@bfredl
Copy link
Member

bfredl commented Jan 10, 2021

What about RTL (if it's ever going to be supported with extmarks, that is)? Would it make sense for RTL text to have right_gravity=false by default?

RTL is a display feature (that UI:s are gonna handle in differerent ways), it better not affect editing semantics in the core layer.

src/nvim/api/buffer.c Outdated Show resolved Hide resolved
src/nvim/api/buffer.c Outdated Show resolved Hide resolved
@chentoast chentoast requested a review from bfredl January 13, 2021 04:26
@chentoast
Copy link
Contributor Author

@bfredl whenever you have the time, do you mind reviewing this? I think its pretty much ready for merge.

@bfredl bfredl merged commit b803bfa into neovim:master Jan 22, 2021
@bfredl
Copy link
Member

bfredl commented Jan 22, 2021

I agree, merged :)

@chentoast chentoast deleted the gravity branch February 8, 2021 06:21
mikesart pushed a commit to mikesart/neovim that referenced this pull request Mar 10, 2021
@dundargoc dundargoc removed the request for review from bfredl May 13, 2022 11:38
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

Successfully merging this pull request may close these issues.

None yet

4 participants