bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#20336: 24.4; Support ANSI escape Cursor Horizontal Absolute (CHA) po


From: Tim Taylor
Subject: bug#20336: 24.4; Support ANSI escape Cursor Horizontal Absolute (CHA) positioning in term.el
Date: Tue, 14 Apr 2015 22:34:44 -0700 (PDT)


Some CLIs use the ANSI escape `ESC[nG` (aka Cursor Horizontal Absolute
or CHA). For example, `ESC[0G` will move the cursor to column 0. This
escape currently isn't supported by `term-handle-ansi-escape`. The
output of a command like `npm install` appears a series of characters
like "-\|/-\|..." instead of the intended progress spinner effect.

The simplest test case:

    printf "hello\033[0Gworld\n"

Within term/ansi-term will display "helloworld", but in other terminal
emulators display "world".

Relevant StackExchange Q&A including my workaround:

    http://emacs.stackexchange.com/a/10698/6709

My workaround also included here:

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

Cheers,
Tim



In GNU Emacs 24.4.1 (x86_64-apple-darwin14.0.0, NS apple-appkit-1343.16)
 of 2015-01-08 on resolute-tumbrel-6808.local
Configured using:
 `configure --prefix=/opt/boxen/homebrew/Cellar/emacs/24.4
 --enable-locallisppath=/opt/boxen/homebrew/share/emacs/site-lisp
 --infodir=/opt/boxen/homebrew/Cellar/emacs/24.4/share/info/emacs
 --without-dbus --without-gnutls --with-ns --disable-ns-self-contained'

Important settings:
  value of $LC_CTYPE: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  recentf-mode: t
  diff-auto-refine-mode: t
  show-paren-mode: t
  global-linum-mode: t
  linum-mode: t
  ido-vertical-mode: t
  ido-ubiquitous-mode: t
  flx-ido-mode: t
  global-auto-revert-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
O D ESC O C ESC O C ESC O C ESC O C ESC O D ESC O D 
ESC O D ESC O C ESC O D DEL DEL DEL DEL C-e ESC O B 
ESC O B ESC O B ESC O B C-x C-s ESC O A ESC O A ESC 
O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A 
ESC O A ESC O B C-@ ESC O B ESC O B ESC O B ESC O B 
ESC O B ESC O B ESC O B ESC O B ESC O B ESC O B ESC 
O B ESC O B ESC O B ESC O B ESC ; C-x C-s C-_ C-x s 
! ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC 
O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC O B 
ESC O B ESC O B C-@ ESC O B ESC O B ESC O B ESC O B 
ESC O B ESC O B ESC O B ESC O B ESC O B C-\ ESC | p 
b c o p y RET ESC O B ESC O A ESC O B ESC O B C-g C-_ 
C-_ C-_ C-_ C-_ C-_ C-_ C-_ C-_ C-_ C-_ C-_ C-_ C-_ 
C-_ C-_ C-_ C-_ C-_ C-_ C-_ C-_ C-_ C-_ C-_ C-_ ESC 
O C ESC O C ESC O C ESC O D DEL # ' C-x C-s ESC x b 
u g TAB TAB DEL DEL DEL DEL DEL DEL DEL DEL DEL DEL 
DEL DEL DEL DEL r e p o r t TAB RET

Recent messages:
Mark activated
Loading quail/rfc1345...done
(Shell command succeeded with no output)
End of buffer [2 times]
Quit
Redo!
Undo! [25 times]
Saving file /Users/toolbear/src/dotfiles/emacs.d/toolbear/terminal.el...
Wrote /Users/toolbear/src/dotfiles/emacs.d/toolbear/terminal.el
Making completion list...

Load-path shadows:
/Users/toolbear/src/dotfiles/emacs.d/.cask/24.4.1/elpa/cask-20150327.208/cask hides /opt/boxen/homebrew/share/emacs/site-lisp/cask
/Users/toolbear/src/dotfiles/emacs.d/.cask/24.4.1/elpa/cask-20150327.208/cask-bootstrap hides /opt/boxen/homebrew/share/emacs/site-lisp/cask-bootstrap

Features:
(shadow sort mail-extr emacsbug message rfc822 mml mml-sec mailabbrev
gmm-utils mailheader sendmail mail-utils rfc1345 quail debug mule-util
jka-compr eieio-opt speedbar sb-image ezimage dframe find-func
two-column tramp tramp-compat auth-source eieio eieio-core gnus-util
password-cache tramp-loaddefs trampver shell pcomplete comint ansi-color
format-spec tmm misearch multi-isearch js imenu thingatpt cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs pp help-mode recentf tree-widget wid-edit vc-git diff-mode
easy-mmode xterm base16-atelierheath-dark-theme paren multi-term cl term
easymenu ehelp ring server disp-table edmacro kmacro linum hl-line
ido-vertical-mode ido-ubiquitous warnings flx-ido byte-opt bytecomp
byte-compile cconv flx ido pallet advice revbufs derived time-date
autorevert filenotify boxed-wine cask cl-macs gv cask-bootstrap
package-build mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 ietf-drums mm-util help-fns mail-prsvr json lisp-mnt shut-up epl
git commander cl-loaddefs cl-lib f dash s ucs-normalize package
epg-config tooltip electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel ns-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode prog-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process cocoa ns multi-tty emacs)

Memory information:
((conses 16 1007815 128695)
 (symbols 48 30733 0)
 (miscs 40 2786 1728)
 (strings 32 57759 18098)
 (string-bytes 1 1635715)
 (vectors 16 128739)
 (vector-slots 8 4259818 15204)
 (floats 8 25451 521)
 (intervals 56 72709 5537)
 (buffers 960 53))


reply via email to

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