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

Is Zee overriding the default cursor? #27

Open
tommythorn opened this issue Apr 27, 2022 · 3 comments
Open

Is Zee overriding the default cursor? #27

tommythorn opened this issue Apr 27, 2022 · 3 comments

Comments

@tommythorn
Copy link

I had a hard time finding the cursor in Zee and noticed it wasn't using my terminal (eg. macOS Terminal) default cursor, but uses its own. Is this intentional? Is there a way to make it use the terminal cursor?

@mcobzarenco
Copy link
Collaborator

mcobzarenco commented May 1, 2022

Thanks for issue -- indeed, zee uses the terminal in raw mode and disables the tty cursor.

I would love to help though, would you be so kind to go into some detail about what the issue is? Is it unexpected that the cursor doesn't look the same? Is it a styling consideration?


Raw mode with no tty cursor has many advantages, i.e. you get complete control over what's displayed on the screen + allows accurate incremental repainting that the tty cursor would interfere with. I did start by trying to use the tty cursor early on, but found it to be super limitative, buggy and causing it flickering when repainting incrementally. By painting my own cursor, the behaviour is cross-platform and works the same regardless of terminal emulator, as well as allow for correct handling of wide unicode graphemes or compound graphemes correctly (which most emaulators don't handle correctly most of the time), multiple cursors, box selection etc. etc. AFAIK, emacs does the same, but may have a config option not to..

For more context, the terminal is actually abstracted away, zee renders to a rectangular "canvas" containing of what I call "textel"s (i.e. a grapheme together with associated text styling and a background and foreground colors). This is handled by https://github.com/mcobzarenco/zi . The editor is not really aware of the backend we render to, one thing this will enable down the line is to support a GPU accelerated version, similar to how emacs' GUI verison.

@tommythorn
Copy link
Author

highly unusual; I can't think of a single example where when entering text, we aren't using the terminal cursor. The examples that spring to mind: bash (any shell really), nano, vi, emacs -nw, gpg. Examples without a cursor (but also aren't entering text): top, htop

It's literally the point of the cursor to point out were you are entering text. Arguing about customization is a very zee-centric view of the world - I don't want to have to customize it, I already customized the terminal and that covers all the interactive apps.

I think it's broken, but it's very easy to fix.

@cessen
Copy link

cessen commented May 13, 2022

highly unusual
...
I think it's broken,

Not the author, but I disagree that it's broken or especially unusual. As just a couple of examples, Kakoune and Helix are both terminal-based editors that draw their own cursors.

Now, whether that's a preferable approach or not is certainly up for debate (and somewhat depends on use case--e.g you can't do multiple cursors with the tty cursor). But calling it broken and/or highly unusual seems hyperbolic to me.

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

3 participants