Subject: 24.0.50; ansi-term: spurious newlines (soft linebreaks becomes had linebreak)

From: Sébastien Gross <[email-masked]>
Date: Tue, 27 Jul 2010 19:28:03 +0200

Hi,

I am currently using ansi-term as a terminal emulator. the problem is
when lines are longer than the buffer column number a hard newline
('\n') is inserted.
Thus when some text is copied (with using both the mouse or keyboard
sequences) some spurious new line appear into the pasted text.

For example in ansi-term type:

echo "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor in cididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."

(this line is intentionally left long)

If you try to copy/past  it (using the mouse selection and middle click)
you might get something like (depending on term-window-width):

echo "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiu
smod tempor in cididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis n
ostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."

As you can see hard newline appear.

Is there a way to fix this ?

Thanks in advance.

Regards

In GNU Emacs 24.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2010-05-24 on elegiac, modified by Debian
 (emacs-snapshot package, version 1:20100524-1)
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
configured using `configure  '--build' 'x86_64-linux-gnu' '--host' 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.0.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.0.50/site-lisp:/usr/share/emacs/site-lisp' '--with-x=yes' '--with-x-toolkit=gtk' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Article

Minor modes in effect:
  global-auto-complete-mode: t
  yas/global-mode: t
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  savehist-mode: t
  desktop-save-mode: t
  iswitchb-mode: t
  show-paren-mode: t
  global-hl-line-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-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
  auto-fill-mode: 1

Features:
(shadow emacsbug info two-column mule-util tabify pcmpl-unix em-unix
em-term em-script em-prompt em-ls em-hist em-pred em-glob em-dirs
em-cmpl em-basic esh-opt em-banner em-alias esh-var esh-io esh-cmd
esh-ext esh-proc esh-arg esh-groups eshell esh-module esh-mode esh-util
ielm dabbrev ibuf-ext autorevert longlines face-remap debug pp
descr-text flow-fill crm cus-edit cus-start cus-load skeleton sh-script
executable url-mailto url-methods url-util url-handlers url-parse
url-vars jka-compr find-func dns-mode multi-isearch time-stamp ffap
newcomment smiley ansi-color w3m-form w3m-symbol w3m browse-url w3m-hist
w3m-e23 w3m-ccl ccl w3m-fsf w3m-favicon w3m-image w3m-proc w3m-util
gnus-bcklg gnus-async mail-extr bbdb-gui bbdb-com warnings gnus-cite
flyspell ispell qp sort byte-opt bytecomp byte-compile parse-time
gnus-ml gnus-topic nnfolder utf-7 utf7 netrc nnimap imap nndraft nnmh
nnnil gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg
gnus-cache gnus-init cw-gnus-visual cw-gnus-groups-def cw-gnus-groups
cw-gnus-sendmail-def cw-gnus-sendmail cw-gnus-personality-def
cw-gnus-personality gnus-pers cw-gnus-mail-sources-def
cw-gnus-mail-sources jd-buttonize gnus-art mm-uu mml2015 epg-config
mm-view smime dig mailcap gnus-sum gnus-imap-message-count-fix
cw-gnus-daemon gnus-demon nntp gnus-group time-date gnus-undo nnmail
mail-source nnoo gnus-start gnus-spec gnus-int gnus-range message
sendmail rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader
gnus-win gnus gnus-ems nnheader mail-utils mm-util mail-prsvr vc-git
eldoc cw-all dim-switch-window cw-asciidoc doc-mode man cw-modes
cw-dired dired-details dired-x dired-aux cw-keys cw-auto-complete
auto-complete-config auto-complete popup cw-email cw-compile-startup
cw-bbdb bbdb timezone cw-yasnippet yasnippet dropdown-list help-mode
view cw-escreen escreen cw-hl-sexp hl-sexp thingatpt cw-tramp
tramp-multi-sshx cw-cssh cssh dired tramp-imap assoc tramp-gw tramp-fish
tramp-smb tramp-cache tramp-ftp tramp-cmds tramp auth-source gnus-util
shell comint regexp-opt password-cache format-spec tramp-compat trampver
cw-term term disp-table ehelp electric cw-magit magit ediff-merg
ediff-diff ediff-wind ediff-help ediff-util ediff-mult ediff-init ediff
server derived pcomplete diff-mode log-edit pcvs-util add-log cw-zoom
cw-ibuffer projects cw-session savehist desktop cw-buffer iswitchb
ibuffer winner ring buffer-move windmove cw-screen-size edmacro kmacro
cw-visual paren advice help-fns advice-preload hl-line cw-theme
color-theme easymenu wid-edit color-theme-tango-2-cw dim-ports cw-lib cl
cl-19 w3m-load emacs-goodies-el emacs-goodies-custom
emacs-goodies-loaddefs easy-mmode bbdb-autoloads tooltip ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mldrag 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 loaddefs button minibuffer faces cus-face files
text-properties overlay md5 base64 format env code-pages mule custom
widget hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting font-render-setting gtk x-toolkit x multi-tty emacs)
-- 
Sébastien Gross