Subject: bug#1469: patch for term.el regression when dealing with long lines under bash

From: Nicholas Maniscalco <[email-masked]>
Date: Fri, 26 Dec 2008 13:12:16 -0800

(I sent this to the wrong list earlier.  Resending to, hopefully, the 
right place this time.)

Here's a patch for bug#1469 (term.el regression when dealing with long 
lines under bash).

* term.el (term-emulate-terminal): Decode substring just prior to 
inserting it.  (Bug#1469)

bug#1469 was introduced while fixing bug#1006.  I verified this patch 
against the repro steps in bug#1006 to make sure I haven't made a 
regression.

Can someone please review?  I'd appreciate any feedback.

-- Nicholas
Index: lisp/term.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/term.el,v
retrieving revision 1.107
diff -c -p -r1.107 term.el
*** lisp/term.el	3 Dec 2008 05:48:33 -0000	1.107
--- lisp/term.el	25 Dec 2008 03:45:24 -0000
*************** See `term-prompt-regexp'."
*** 2834,2840 ****
  			  ;; following point if not eob nor insert-mode.
  			  (let ((old-column (current-column))
  				columns pos)
! 			    (insert decoded-substring)
  			    (setq term-current-column (current-column)
  				  columns (- term-current-column old-column))
  			    (when (not (or (eobp) term-insert-mode))
--- 2834,2840 ----
  			  ;; following point if not eob nor insert-mode.
  			  (let ((old-column (current-column))
  				columns pos)
! 				(insert (decode-coding-string (substring str i funny) locale-coding-system))
  			    (setq term-current-column (current-column)
  				  columns (- term-current-column old-column))
  			    (when (not (or (eobp) term-insert-mode))