1

I use multi-term within spacemacs for most of my command-line operations. It works well except some annoying behavior in the shell prompt (zsh but similar for bash) on commands which go over the screen width.

I tried many things without success to fix it but I discovered that if I run the same shell within neovim within multi-term the prompt has no problem. Of course that is not ideal as I cannot scroll up but it may help to isolate the issue.

See below the behavior (I type "l" repeatedly then backspace):

Screencast

Spacemacs (0.200.13@26.1, Ubuntu 16.04, same issue with 25.3) configuration related to the terminal

(setq multi-term-switch-after-close nil)
(setq term-suppress-hard-newline t)
(setq term-char-mode-point-at-process-mark nil)
(add-hook 'term-mode-hook '(lambda () (toggle-truncate-lines 1)))

The issue appears regardless of the value of toggle-truncate-lines.

Any idea of what could cause this behavior?

EDIT: I debugged with (setq term-log-buffer t) and the syntax highlighting in zsh makes things even more complex. Disabling it, the cursor simply returns to the beginning of the line instead of one line below:

enter image description here

It seems that when the line reaches the screen width, the shell sends ^M^[[K, a carriage return and a line kill, so emacs does as expected. Not sure why the shell does not return a line feed too.

With bash --norc, the shell sends only ^M at the end of the line so emacs keeps overwriting the same line without erasing it like for zsh.

EDIT2: Learning more about terminals, the shell behavior seems to be standard. The issue is then that emacs doesn't properly handle the SPCR sequence in this case.

EDIT3: Reported as a bug.

  • Does it happen with emacs -Q ? – phils Nov 1 '18 at 9:27
  • Yes exactly the same behavior. – user355559 Nov 1 '18 at 9:34
  • I was about to point the finger at term-suppress-hard-newline, but that is set to nil by default, so it can't be that. – phils Nov 1 '18 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.