1

Specs:

i@debord:~$ emacs --version
GNU Emacs 26.3.50
Copyright (C) 2019 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

i@debord:~$ /bin/bash --version
GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

i@debord:~$ cat /etc/os-release 
NAME="Linux Mint"
VERSION="19.3 (Tricia)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 19.3"
VERSION_ID="19.3"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.ubuntu.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=tricia
UBUNTU_CODENAME=bionic
i@debord:~$ 


In term-mode calling term-send-backspace creates a newline in the buffer. I'm suspect that send_process (process.c) might have something to do with this.

Is there any way/work-around that can prevent this behavior?


Step To Reproduce:

emacs -q
M-x term
ret
ret
asdf
del

Observe (by clicking on the line below the prompt in the *terminal* buffer) that a newline has been created in the *terminal* buffer.

enter image description here


EDIT (08/06/2020): The bug appears to be at the end of function term-erase-in-line:

(defun term-erase-in-line (kind)
  (when (= kind 1) ;; erase left of point
    (let ((cols (term-horizontal-column)) (saved-point (point)))
      (term-vertical-motion 0)
      (delete-region (point) saved-point)
      (term-insert-char ?  cols)))
  (when (not (eq kind 1)) ;; erase right of point
    (let ((saved-point (point))
      (wrapped (and (zerop (term-horizontal-column))
            (not (zerop (term-current-column))))))
      (term-vertical-motion 1)
      (delete-region saved-point (point))
      ;; wrapped is true if we're at the beginning of screen line,
      ;; but not a buffer line.  If we delete the current screen line
      ;; that will make the previous line no longer wrap, and (because
      ;; of the way Emacs display works) point will be at the end of
      ;; the previous screen line rather then the beginning of the
      ;; current one.  To avoid that, we make sure that current line
      ;; contain a space, to force the previous line to continue to wrap.
      ;; We could do this always, but it seems preferable to not add the
      ;; extra space when wrapped is false.
      (when wrapped
    (insert ? ))
      (insert ?\n)
      (put-text-property saved-point (point) 'font-lock-face 'default)
      (goto-char saved-point))))
John DeBord
  • 550
  • 3
  • 13
  • Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/111505/discussion-on-question-by-john-debord-why-does-calling-term-send-backspace-ju). – Dan Aug 06 '20 at 14:53

0 Answers0