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

Add support for Beam, Underline cursors #608

Merged
merged 1 commit into from
Jun 11, 2017
Merged

Add support for Beam, Underline cursors #608

merged 1 commit into from
Jun 11, 2017

Conversation

jwilm
Copy link
Contributor

@jwilm jwilm commented Jun 11, 2017

Notable about this implementation is it takes a different approach for
managing cursor cells that previously. The terminal Grid is now
borrowed immutably. Instead of mutating Cells in the Grid, a list is
managed within the RenderableCellsIter. The cell at the cursor location
is skipped over, and instead cells are popped off a list of cursor
cells.

It would be good in the future to share some more code between the
different cursor style implementations for populating the cursor cells
list.

Supercedes #349.
Resolves #171.

Notable about this implementation is it takes a different approach for
managing cursor cells that previously. The terminal Grid is now
borrowed *immutably*. Instead of mutating Cells in the Grid, a list is
managed within the RenderableCellsIter. The cell at the cursor location
is skipped over, and instead cells are popped off a list of cursor
cells.

It would be good in the future to share some more code between the
different cursor style implementations for populating the cursor cells
list.

Supercedes #349.
@jwilm jwilm mentioned this pull request Jun 11, 2017
5 tasks
@jwilm jwilm merged commit 529ac47 into master Jun 11, 2017
@jwilm jwilm deleted the cursor-shape branch June 11, 2017 20:21
@maximbaz
Copy link
Contributor

Works nicely 🙂

@jwilm out of curiosity, why did you choose symbols "▎" and "▁" for the cursor shapes? I don't know if this is right or wrong choice, I simply noticed that my monospace font (Consolas) doesn't have these glyphs and a different font is used to render these two symbols (in my case DejaVu Sans). The vertical bar looks not bad, but the underline symbol has a different character width, which looks a bit weird.

image

image

@jwilm
Copy link
Contributor Author

jwilm commented Jun 11, 2017

@maximbaz I tried with _ and originally, but I found them difficult to see while testing. Strange that your DejaVu Sans draws the underscore like that... I'm using the same font but haven't noticed that issue.

Maybe the beam and underscore characters should be configurable? Maybe there's some other codepoint I've overlooked that would be good for the underscore? The symbols chosen here are from the block elements block.

@NickeZ
Copy link
Contributor

NickeZ commented Jun 11, 2017

How do you use this? Did you forget to update the config files?

Edit: it works in neovim with :set guicursor=n-v-c:block-Cursor/lCursor-blinkon0,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor.. Cheers!

@dm1try
Copy link
Contributor

dm1try commented Jun 11, 2017

@NickeZ the build from master branch works for me in Neovim(0.2.1; with default guicursor option)
image

EDIT: added nvim version

@NickeZ
Copy link
Contributor

NickeZ commented Jun 11, 2017

@dm1try strange, it doesn't for me.. tried to remove the line from my init.vim and I'm back to the old block symbol in insert mode..

@net
Copy link

net commented Jun 12, 2017

The sizes are wrong for my font. The | is too short, and the _ is too wide. It seems strange to use characters in the first place. Is drawing simple lines somehow not possible?

@asilvadesigns
Copy link

@jwilm this. is. awesome.

@maximbaz
Copy link
Contributor

@jwilm I think you are right, the _ and | are totally impossible to notice, and I can't really find any better pair of characters for vertical bar and underscore.

However, have a look at how alacritty behaves when I set _ and | as cursor characters:

alacritty

Isn't that weird, how | covers the characters? Now all the glyphs are rendered using one font, Consolas, so I would expect they fit perfectly.

I double the suggestion from @net, perhaps instead of relying on how different systems choose to select font to render and , can't we just go with drawing lines directly?

@aliev
Copy link

aliev commented Jun 23, 2017

@jwilm how to setup it for regular vim (not neovim)?

@Shougo
Copy link

Shougo commented Jun 23, 2017

@aliev :help termcap-cursor-shape

@Shougo
Copy link

Shougo commented Jun 23, 2017

For example:

  let &t_SI = "\<Esc>[6 q"
  let &t_SR = "\<Esc>[4 q"
  let &t_EI = "\<Esc>[0 q"

@aliev
Copy link

aliev commented Jun 23, 2017

@Shougo wow! many thanks!!!

@Shougo
Copy link

Shougo commented Jun 23, 2017

I think it should be documented in Vim documentation...

@gglanzani
Copy link

I don't know if I'm doing something wrong, but I'm using Alactritty 492d1bd (August 11) combined with nvim 0.2.1 and I don't see the cursor shape changing.

I'm pretty sure it's not a neovim thing, as when using iTerm (or Terminal.app) I get different cursor shapes.

@alok
Copy link

alok commented Sep 14, 2017

I'm also having this issue. I'm using eb231b (from ago2 days ago).

@hale
Copy link

hale commented Dec 28, 2017

I had trouble with this using vim8, Alacritty and Tmux.

Fixed by removing all related settings in tmux/vim/alacritty and just installing this plugin: https://github.com/jszakmeister/vim-togglecursor

benknoble added a commit to benknoble/Dotfiles that referenced this pull request Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet