[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/term.el
From: |
Dan Nicolaescu |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/term.el |
Date: |
Sat, 02 Oct 2004 14:30:22 -0400 |
Index: emacs/lisp/term.el
diff -c emacs/lisp/term.el:1.59 emacs/lisp/term.el:1.60
*** emacs/lisp/term.el:1.59 Sun Sep 26 18:39:10 2004
--- emacs/lisp/term.el Sat Oct 2 18:23:27 2004
***************
*** 2588,2595 ****
(- (term-vertical-motion -9999))))))))
(defun term-adjust-current-row-cache (delta)
! (if term-current-row
! (setq term-current-row (+ term-current-row delta))))
(defun term-terminal-pos ()
(save-excursion ; save-restriction
--- 2588,2596 ----
(- (term-vertical-motion -9999))))))))
(defun term-adjust-current-row-cache (delta)
! (when term-current-row
! (setq term-current-row
! (max 0 (+ term-current-row delta)))))
(defun term-terminal-pos ()
(save-excursion ; save-restriction
***************
*** 2764,2770 ****
(when (not (or (eobp) term-insert-mode))
(setq pos (point))
(term-move-columns columns)
! (delete-region pos (point))))
(setq term-current-column nil)
(put-text-property old-point (point)
--- 2765,2781 ----
(when (not (or (eobp) term-insert-mode))
(setq pos (point))
(term-move-columns columns)
! (delete-region pos (point)))
! ;; In insert if the if the current line
! ;; has become too long it needs to be
! ;; chopped off.
! (when term-insert-mode
! (setq pos (point))
! (end-of-line)
! (when (> (current-column) term-width)
! (delete-region (- (point) (- (current-column)
term-width))
! (point)))
! (goto-char pos)))
(setq term-current-column nil)
(put-text-property old-point (point)
***************
*** 2778,2789 ****
(setq i (1- funny)))
((and (setq term-terminal-state 0)
(eq char ?\^I)) ; TAB (terminfo: ht)
- ;; FIXME: Does not handle line wrap!
(setq count (term-current-column))
! (setq count (+ count 8 (- (mod count 8))))
! (if (< (move-to-column count nil) count)
! (term-insert-char char 1))
! (setq term-current-column count))
((eq char ?\r)
;; Optimize CRLF at end of buffer:
(cond ((and (< (setq temp (1+ i)) str-length)
--- 2789,2809 ----
(setq i (1- funny)))
((and (setq term-terminal-state 0)
(eq char ?\^I)) ; TAB (terminfo: ht)
(setq count (term-current-column))
! ;; The line cannot exceed term-width. TAB at
! ;; the end of a line should not cause wrapping.
! (setq count (min term-width
! (+ count 8 (- (mod count 8)))))
! (if (> term-width count)
! (progn
! (term-move-columns
! (- count (term-current-column)))
! (setq term-current-column count))
! (when (> term-width (term-current-column))
! (term-move-columns
! (1- (- term-width (term-current-column)))))
! (when (= term-width (term-current-column))
! (term-move-columns -1))))
((eq char ?\r)
;; Optimize CRLF at end of buffer:
(cond ((and (< (setq temp (1+ i)) str-length)
***************
*** 2851,2858 ****
(term-handle-deferred-scroll)
(term-down 1 t)
(setq term-terminal-state 0))
! ((eq char ?M) ;; scroll reversed
! (term-insert-lines 1)
(setq term-terminal-state 0))
((eq char ?7) ;; Save cursor (terminfo: sc)
(term-handle-deferred-scroll)
--- 2871,2884 ----
(term-handle-deferred-scroll)
(term-down 1 t)
(setq term-terminal-state 0))
! ;; ((eq char ?E) ;; (terminfo: nw), not used for
! ;; ;; now, but this is a working
! ;; ;; implementation
! ;; (term-down 1)
! ;; (term-goto term-current-row 0)
! ;; (setq term-terminal-state 0))
! ((eq char ?M) ;; scroll reversed (terminfo: ri)
! (term-down -1)
(setq term-terminal-state 0))
((eq char ?7) ;; Save cursor (terminfo: sc)
(term-handle-deferred-scroll)
***************
*** 2865,2870 ****
--- 2891,2903 ----
(term-goto (car term-saved-cursor)
(cdr term-saved-cursor)))
(setq term-terminal-state 0))
+ ;; The \E#8 reset sequence for xterm. We
+ ;; probably don't need to handle it, but this
+ ;; is the code to parse it.
+ ;; ((eq char ?#)
+ ;; (when (eq (aref str (1+ i)) ?8)
+ ;; (setq i (1+ i))
+ ;; (setq term-terminal-state 0)))
((setq term-terminal-state 0))))
((eq term-terminal-state 3) ; Seen Esc [
(cond ((and (>= char ?0) (<= char ?9))
***************
*** 3121,3127 ****
(defun term-handle-ansi-escape (proc char)
(cond
! ((eq char ?H) ; cursor motion
(if (<= term-terminal-parameter 0)
(setq term-terminal-parameter 1))
(if (<= term-terminal-previous-parameter 0)
--- 3154,3163 ----
(defun term-handle-ansi-escape (proc char)
(cond
! ((or (eq char ?H) ; cursor motion (terminfo: cup)
! ;; (eq char ?f) ; xterm seems to handle this sequence too, not
! ;; needed for now
! )
(if (<= term-terminal-parameter 0)
(setq term-terminal-parameter 1))
(if (<= term-terminal-previous-parameter 0)
***************
*** 3133,3149 ****
(term-goto
(1- term-terminal-previous-parameter)
(1- term-terminal-parameter)))
! ;; \E[A - cursor up (terminfo: cuu1)
((eq char ?A)
(term-handle-deferred-scroll)
(term-down (- (max 1 term-terminal-parameter)) t))
! ;; \E[B - cursor down
((eq char ?B)
(term-down (max 1 term-terminal-parameter) t))
! ;; \E[C - cursor right
((eq char ?C)
! (term-move-columns (max 1 term-terminal-parameter)))
! ;; \E[D - cursor left
((eq char ?D)
(term-move-columns (- (max 1 term-terminal-parameter))))
;; \E[J - clear to end of screen (terminfo: ed, clear)
--- 3169,3189 ----
(term-goto
(1- term-terminal-previous-parameter)
(1- term-terminal-parameter)))
! ;; \E[A - cursor up (terminfo: cuu, cuu1)
((eq char ?A)
(term-handle-deferred-scroll)
(term-down (- (max 1 term-terminal-parameter)) t))
! ;; \E[B - cursor down (terminfo: cud)
((eq char ?B)
(term-down (max 1 term-terminal-parameter) t))
! ;; \E[C - cursor right (terminfo: cuf)
((eq char ?C)
! (term-move-columns
! (max 1
! (if (>= (+ term-terminal-parameter (term-current-column)) term-width)
! (- term-width (term-current-column) 1)
! term-terminal-parameter))))
! ;; \E[D - cursor left (terminfo: cub)
((eq char ?D)
(term-move-columns (- (max 1 term-terminal-parameter))))
;; \E[J - clear to end of screen (terminfo: ed, clear)
***************
*** 3201,3207 ****
(1+ (term-current-row))
(1+ (term-horizontal-column)))))
;; \E[r - Set scrolling region
! ((eq char ?r)
(term-scroll-region
(1- term-terminal-previous-parameter)
term-terminal-parameter))
--- 3241,3247 ----
(1+ (term-current-row))
(1+ (term-horizontal-column)))))
;; \E[r - Set scrolling region
! ((eq char ?r) ;; (terminfo: csr)
(term-scroll-region
(1- term-terminal-previous-parameter)
term-terminal-parameter))
***************
*** 3223,3229 ****
(setq term-scroll-with-delete
(or (term-using-alternate-sub-buffer)
(not (and (= term-scroll-start 0)
! (= term-scroll-end term-height))))))
;; (defun term-switch-to-alternate-sub-buffer (set)
;; ;; If asked to switch to (from) the alternate sub-buffer, and already
(not)
--- 3263,3272 ----
(setq term-scroll-with-delete
(or (term-using-alternate-sub-buffer)
(not (and (= term-scroll-start 0)
! (= term-scroll-end term-height)))))
! (term-move-columns (- (term-current-column)))
! (term-goto
! term-scroll-start (term-current-column)))
;; (defun term-switch-to-alternate-sub-buffer (set)
;; ;; If asked to switch to (from) the alternate sub-buffer, and already
(not)
***************
*** 3601,3608 ****
(end-region (if (eq kind 1) (point) (point-max))))
(delete-region start-region end-region)
(term-unwrap-line)
! (if (eq kind 1)
! (term-insert-char ?\n row))
(setq term-current-column nil)
(setq term-current-row nil)
(term-goto row col)))))
--- 3644,3651 ----
(end-region (if (eq kind 1) (point) (point-max))))
(delete-region start-region end-region)
(term-unwrap-line)
! (when (eq kind 1)
! (term-insert-char ?\n row))
(setq term-current-column nil)
(setq term-current-row nil)
(term-goto row col)))))
- [Emacs-diffs] Changes to emacs/lisp/term.el,
Dan Nicolaescu <=