unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20336: 24.4; Support ANSI escape Cursor Horizontal Absolute (CHA) positioning in term.el
@ 2015-04-15  5:34 Tim Taylor
  2018-05-17 22:33 ` Noam Postavsky
  0 siblings, 1 reply; 2+ messages in thread
From: Tim Taylor @ 2015-04-15  5:34 UTC (permalink / raw)
  To: 20336

[-- Attachment #1: Type: text/plain, Size: 6109 bytes --]

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))

[-- Attachment #2: Type: text/html, Size: 8376 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-17 22:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-15  5:34 bug#20336: 24.4; Support ANSI escape Cursor Horizontal Absolute (CHA) positioning in term.el Tim Taylor
2018-05-17 22:33 ` Noam Postavsky

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).