X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/9f2f14a0725211b13a744573344636b57b9c98b9..7ed767557eb608a0ad7097dc80d84af568ab00b1:/lisp/term.el diff --git a/lisp/term.el b/lisp/term.el index 5dd965d2d3..28be8c8c53 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -1,6 +1,6 @@ ;;; term.el --- general command interpreter in a window stuff -;; Copyright (C) 1988, 1990, 1992, 1994-1995, 2001-2015 Free Software +;; Copyright (C) 1988, 1990, 1992, 1994-1995, 2001-2016 Free Software ;; Foundation, Inc. ;; Author: Per Bothner @@ -834,6 +834,10 @@ is buffer-local." (define-key map [down] 'term-send-down) (define-key map [right] 'term-send-right) (define-key map [left] 'term-send-left) + (define-key map [C-up] 'term-send-ctrl-up) + (define-key map [C-down] 'term-send-ctrl-down) + (define-key map [C-right] 'term-send-ctrl-right) + (define-key map [C-left] 'term-send-ctrl-left) (define-key map [delete] 'term-send-del) (define-key map [deletechar] 'term-send-del) (define-key map [backspace] 'term-send-backspace) @@ -915,19 +919,6 @@ is buffer-local." (term-set-escape-char (or term-escape-char ?\C-c)) -(defvar overflow-newline-into-fringe) - -(defun term-window-width () - (if (and (not (featurep 'xemacs)) - (display-graphic-p) - overflow-newline-into-fringe - ;; Subtract 1 from the width when any fringe has zero width, - ;; not just the right fringe. Bug#18601. - (/= (frame-parameter nil 'left-fringe) 0) - (/= (frame-parameter nil 'right-fringe) 0)) - (window-body-width) - (1- (window-body-width)))) - (put 'term-mode 'mode-class 'special) @@ -1014,7 +1005,7 @@ Entry to this mode runs the hooks on `term-mode-hook'." (setq buffer-display-table term-display-table) (set (make-local-variable 'term-home-marker) (copy-marker 0)) (set (make-local-variable 'term-height) (1- (window-height))) - (set (make-local-variable 'term-width) (term-window-width)) + (set (make-local-variable 'term-width) (window-max-chars-per-line)) (set (make-local-variable 'term-last-input-start) (make-marker)) (set (make-local-variable 'term-last-input-end) (make-marker)) (set (make-local-variable 'term-last-input-match) "") @@ -1217,6 +1208,10 @@ without any interpretation." (defun term-send-down () (interactive) (term-send-raw-string "\eOB")) (defun term-send-right () (interactive) (term-send-raw-string "\eOC")) (defun term-send-left () (interactive) (term-send-raw-string "\eOD")) +(defun term-send-ctrl-up () (interactive) (term-send-raw-string "\e[1;5A")) +(defun term-send-ctrl-down () (interactive) (term-send-raw-string "\e[1;5B")) +(defun term-send-ctrl-right () (interactive) (term-send-raw-string "\e[1;5C")) +(defun term-send-ctrl-left () (interactive) (term-send-raw-string "\e[1;5D")) (defun term-send-home () (interactive) (term-send-raw-string "\e[1~")) (defun term-send-insert() (interactive) (term-send-raw-string "\e[2~")) (defun term-send-end () (interactive) (term-send-raw-string "\e[4~")) @@ -1454,6 +1449,13 @@ Using \"emacs\" loses, because bash disables editing if $TERM == emacs.") (format "TERMINFO=%s" data-directory) (format term-termcap-format "TERMCAP=" term-term-name term-height term-width) + + ;; This is for backwards compatibility with Bash 4.3 and earlier. + ;; Remove this hack once Bash 4.4-or-later is common, because + ;; it breaks './configure' of some packages that expect it to + ;; say where to find EMACS. + (format "EMACS=%s (term:%s)" emacs-version term-protocol-version) + (format "INSIDE_EMACS=%s,term:%s" emacs-version term-protocol-version) (format "LINES=%d" term-height) (format "COLUMNS=%d" term-width)) @@ -3245,6 +3247,10 @@ See `term-prompt-regexp'." ;; \E[D - cursor left (terminfo: cub) ((eq char ?D) (term-move-columns (- (max 1 term-terminal-parameter)))) + ;; \E[G - cursor motion to absolute column (terminfo: hpa) + ((eq char ?G) + (term-move-columns (- (max 0 (min term-width term-terminal-parameter)) + (term-current-column)))) ;; \E[J - clear to end of screen (terminfo: ed, clear) ((eq char ?J) (term-erase-in-display term-terminal-parameter)) @@ -4144,7 +4150,17 @@ the process. Any more args are arguments to PROGRAM." ;; .emacs ... (term-set-escape-char ?\C-x)) - (switch-to-buffer term-ansi-buffer-name)) + (switch-to-buffer term-ansi-buffer-name) + ;; For some reason, without the below setting, ansi-term behaves + ;; sluggishly, not clear why, since the buffer is typically very + ;; small. + ;; + ;; There's a larger problem here with supporting bidirectional text: + ;; the application that writes to the terminal could have its own + ;; ideas about displaying bidirectional text, and might not want us + ;; reordering the text or deciding on base paragraph direction. One + ;; such application is Emacs in TTY mode... FIXME. + (setq bidi-paragraph-direction 'left-to-right)) ;;; Serial terminals