emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/term.el,v


From: Chong Yidong
Subject: [Emacs-diffs] Changes to emacs/lisp/term.el,v
Date: Thu, 25 Sep 2008 00:05:53 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      08/09/25 00:05:52

Index: term.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/term.el,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -b -r1.104 -r1.105
--- term.el     13 Jun 2008 08:04:44 -0000      1.104
+++ term.el     25 Sep 2008 00:05:52 -0000      1.105
@@ -2718,7 +2718,11 @@
 
 (defun term-emulate-terminal (proc str)
   (with-current-buffer (process-buffer proc)
-    (let* ((i 0) char funny count save-point save-marker old-point temp win
+    (let* ((i 0) char funny
+          count       ; number of decoded chars in substring
+          count-bytes ; number of bytes
+          decoded-substring
+          save-point save-marker old-point temp win
           (buffer-undo-list t)
           (selected (selected-window))
           last-win
@@ -2777,6 +2781,10 @@
                                       str i))
                   (when (not funny) (setq funny str-length))
                   (cond ((> funny i)
+                         (setq decoded-substring
+                               (decode-coding-string
+                                (substring str i funny)
+                                locale-coding-system))
                          (cond ((eq term-terminal-state 1)
                                 ;; We are in state 1, we need to wrap
                                 ;; around.  Go to the beginning of
@@ -2785,21 +2793,31 @@
                                 (term-down 1 t)
                                 (term-move-columns (- (term-current-column)))
                                 (setq term-terminal-state 0)))
-                         (setq count (- funny i))
+                         (setq count (length decoded-substring))
                          (setq temp (- (+ (term-horizontal-column) count)
                                        term-width))
                          (cond ((<= temp 0)) ;; All count chars fit in line.
                                ((> count temp) ;; Some chars fit.
                                 ;; This iteration, handle only what fits.
                                 (setq count (- count temp))
+                                (setq count-bytes
+                                      (length
+                                       (encode-coding-string
+                                        (substring decoded-substring 0 count)
+                                        'binary)))
                                 (setq temp 0)
-                                (setq funny (+ count i)))
+                                (setq funny (+ count-bytes i)))
                                ((or (not (or term-pager-count
                                              term-scroll-with-delete))
                                     (>  (term-handle-scroll 1) 0))
                                 (term-adjust-current-row-cache 1)
                                 (setq count (min count term-width))
-                                (setq funny (+ count i))
+                                (setq count-bytes
+                                      (length
+                                       (encode-coding-string
+                                        (substring decoded-substring 0 count)
+                                        'binary)))
+                                (setq funny (+ count-bytes i))
                                 (setq term-start-line-column
                                       term-current-column))
                                (t ;; Doing PAGER processing.
@@ -2813,7 +2831,7 @@
                          ;; 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))
+                           (insert decoded-substring)
                            (setq term-current-column (current-column)
                                  columns (- term-current-column old-column))
                            (when (not (or (eobp) term-insert-mode))




reply via email to

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