emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

One display problem and one M-x problem


From: Mark Plaksin
Subject: One display problem and one M-x problem
Date: Sat, 21 Aug 2004 13:40:46 -0400
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

CVS Emacs running on Debian unstable recently (in the past month or so)
started misbehaving when running vi inside M-x term.  Emacs seems to add an
extra newline at the end of lines.  I found two problems while trying to
fix it.  Since I haven't found a fix for (1), I'm not sure if it is the
cause of the vi-in-term problem but it seems likely.

1)  The first problem isn't related to M-x term at all.  It's more general.

To reproduce:
- Run emacs -q in X.  My window was 83x40.
- a ;; Type the letter a to mark the beginning of the line
- M-: (insert-char ?b 50000)
- a ;; Another a to mark the end of the line
- C-a  ;; to get to the beginning of the giant line
- ESC 1 0 0 C-f ;; to put the cursor somewhere in the middle of the second
row of b's.
- C-SPC
- ESC >
- C-b ;; to put the cursor on the final a.
- C-w
- ;; At this point, a is in the upper left corner of the window.
- C-p ;; Now the display will contain a spurious newline and a spurious a.
Like this:
http://mcplaksin.org/happy/before.png
- C-l ;; and the extras go away and Emacs displays what you expected to see in
the first place.   Like this:
http://mcplaksin.org/happy/after.png

Since C-l fixes it and that's in the C source, I think I'm helpless to help
solve this.  Let me know if there's more I can do.

2) term inserts a spurious newline if the first command run inside the term
sends ESC[?47h (this just happens to be the first thing vim sends when run
inside M-x term).  To reproduce:

- Create a short shell script called 'testy':
#!/bin/sh

# Instead of ESC, use a real ESC character
echo -n 'ESC[?47h'
- emacs -q
- M-x term RET
- ./testy

The newline is inserted by the following code from
term-switch-to-alternate-sub-buffer which is called from
term-handle-ansi-escape:

 (if (not (eq (preceding-char) ?\n))
    (term-insert-char ?\n 1))

I don't quite get what term-switch-to-alternate-sub-buffer is trying to do
so I don't know how to help further.  The problem goes away if I make
term-switch-to-alternate-sub-buffer do nothing at all; because of (1)
above, I'm not sure whether this change results in the problem described in
term-switch-to-alternate-sub-buffer's comment:

  ;; If asked to switch to (from) the alternate sub-buffer, and already (not)
  ;; using it, do nothing.  This test is needed for some programs (including
  ;; Emacs) that emit the ti termcap string twice, for unknown reason.

Thanks!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]