syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.63k stars 4.89k forks source link

Cursor acting up in terminal mode #15350

Open pathouse opened 2 years ago

pathouse commented 2 years ago

Description :octocat:

extra characters inserted into terminal related to recent change around cursor shapes

git bisect indicates issue was introduced with this PR: https://github.com/syl20bnr/spacemacs/pull/15322

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart:

Expected behaviour: :heart: :smile:

System Info :computer:


Other details here - although I have .spacemacs.env file where TERM=xterm-256color when I use getenv to see the value of TERM it always returns dumb

lebensterben commented 2 years ago

@pathouse Thanks for reporting.

I didn't see this issue in terminal when I was testing. ( on Linux, the terminal is Alacrity)

Can you try to add "term-cursor" and "evil-terminal-cursor-changer" to excluded-packages and see whether the issue persists?

(It should be evil-terminal-cursor-changer causing the problem but I'm not sure because it acts okay on my system.)

pathouse commented 2 years ago

@lebensterben no worries - when reading through the history around these issues i've learned terminals are a bit of a nightmare

yup when i run M-x evil-terminal-cursor-changer-deactivate the problem goes away

lebensterben commented 2 years ago

Thanks for your reply. I will try to debug it, or I may revert the changes.

lebensterben commented 2 years ago

@pathouse Can you try to set environment variable TERM_PROGRAM to iTerm.app?

If you're using .spacemacs.env, you can manually add this entry.

pathouse commented 2 years ago

@lebensterben yeah i've been looking into that and something seems to be up w/ env vars being set from my .spacemacs.env file

I have the following relevant entries:

TERM=xterm-256color
TERM_PROGRAM=iTerm.app
TERM_PROGRAM_VERSION=3.4.14

TERM_PROGRAM and TERM_PROGRAM_VERSION have the correct values via getenv

but getenv for TERM always returns dumb for me

lebensterben commented 2 years ago

@pathouse

Can you try

pathouse commented 2 years ago

@lebensterben hm tried that and no luck - getting error when i try to call that function there (Spacemacs) Error in dotspacemacs/user-init: Symbol’s function definition is void: exec-path-from-shell-initialize

lebensterben commented 2 years ago

@pathouse Okay.

Instead of replacing this line, comment it out.

And then add (exec-path-from-shell-initialize) in user-config.

(This must work as long as you've added it in dotspacemacs-additional-packages)

pathouse commented 2 years ago

@lebensterben ok after doing that the error is gone but the original issue still happens and getenv for TERM still returns dumb

if this helps at all - when i use setenv to force TERM to be xterm-256color I still have the same issue

lebensterben commented 2 years ago

@pathouse Thanks. You can add the package to excluded-packages list for now. I will investigate.

formido commented 2 years ago

I just installed Spacemacs from develop and have the same issue. I don't have a .spacemacs.env, though.

I switched back to stable so I can't run the Spacemacs bug wizard and get all the best values, but:

Update:

Actually, I see there's no stable anymore (#14843). Thanks for the bisect, @pathouse!

wujiang commented 2 years ago

I have the same issue when running in iTerm2. After evil-terminal-cursor-changer-deactivate, it works fine. Another observation is that it works fine within tmux inside iTerm2.

hrldcpr commented 2 years ago

This is still an issue fyi. (I'm using iTerm2 and emacs editing style.) The fix for me was excluding the package in my spacemacs config, i.e.:

dotspacemacs-excluded-packages
'(
  evil-terminal-cursor-changer
  )
jakshi commented 2 years ago

Just to mention that I have the same issue.

   dotspacemacs-excluded-packages '(
       evil-terminal-cursor-changer
   )

Fixes the issue for me.

Decoherence commented 2 years ago

A big thank you to everyone who's worked on this issue (and @hrldcpr for the suggestion!). I've been trying to track this down for a bit, digging into the lovely complexities of terminals 😎.

The issue occurs in iTerm and the built-in Terminal app, using either zsh or bash.

I figured it could be related to changing editor states since the characters resembled hex color codes (or repeated sequences of hex codes).

dotspacemacs-excluded-packages '(evil-terminal-cursor-changer) did the trick for now.

hrldcpr commented 2 years ago

I just tried this again (i.e. pulled the latest develop and removed the dotspacemacs-excluded-packages fix) and it seems like it's no longer an issue!

@pathouse want to see if it's fixed for you too, and if so close this issue?

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

jakshi commented 1 year ago

Just wanted to confirm that that issue is not appear anymore with latest develop branch spacemacs.

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!