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

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

replacing a certain width string (in term.el)


From: Dan Nicolaescu
Subject: replacing a certain width string (in term.el)
Date: Thu, 16 Sep 2004 10:55:40 -0700

When displaying a curses application to emulate the display of
anything at a certain position on the screen term.el needs replace the
string currently present at the desired position with the new one. 

Currently if the string being replaced contains tabs problems appear
because when tabs are deleted the line length can increase. The code
that appears to do this is in `term-emulate-terminal'

Is the use of `term-move-columns' (which calls move-to-column) correct
in order to accomplish the above goal? 
I am not sure, and I could not find an alternate solution that
works. Some help with tracking down this would be appreciated.

Here's the code in question:

                            ;; Insert a string, check how many columns
                            ;; we moved, then delete that many columns
                            ;; following point if not eob nor insert-mode.
                            (let ((old-column (current-column))
                                  columns pos)
                              (insert (substring str i funny))
                              (setq term-current-column (current-column)
                                    columns (- term-current-column old-column))
                              (when (not (or (eobp) term-insert-mode))
                                (setq pos (point))
                                (term-move-columns columns)
                                (delete-region pos (point))))
                            (setq term-current-column nil)

I don't have a straight way to demonstrate the problem, what you can
do is run "lynx" in a M-x term terminal, browse some web site, press
C-n a few times and you will see that from time to time the screen is
garbled and markers appear in the fringe showing that the line length
has been exceeded. 

Thanks.

        --dan




reply via email to

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