Is there a way to get the Emacs terminal emulator to support cursor movement escape sequences beyond its vt100 features? A specific example is CHA (Cursor-Character-Absolute), e.g. ESC[0G should move the cursor to column 0. CHA and a few other sequences were added as part of ISO-6429 (ECMA-48).

Try this rudimentary test in eterm and another terminal emulator:

printf "hello\033[0Gworld\n"

In eterm (M-x term or M-x multi-term) you will see:


In Terminal.app I see:


For a full featured test check out vttest (brew install test for me).


No, it doesn't look that it's possible without some hacking. The function term-handle-ansi-escape in term.el doesn't have a case for ESC [ G.

  • Is that a bug or a feature? – PythonNut Dec 24 '15 at 16:13

Given the pointer to term-handle-ansi-escape by @jch I was able to add support for CHA as follows:

(defun toolbear:term-handle-more-ansi-escapes (proc char)
  "Handle additional ansi escapes."
   ;; \E[nG - Cursor Horizontal Absolute, e.g. move cursor to column n
   ((eq char ?G)
    (let ((col (min term-width (max 0 term-terminal-parameter))))
      (term-move-columns (- col (term-current-column)))))
(advice-add 'term-handle-ansi-escape :before #'toolbear:term-handle-more-ansi-escapes)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.