Subject: bug#1808: 23.0.60; picture-mode not considering double-width characters alignment

From: poppyer <[email-masked]>
Date: Wed, 07 Jan 2009 01:06:47 +0800

This is not a new bug of EMACS 23; but it is there in EMACS22 for a
long time.  In M-x picture-mode, emacs acts in a "replace" typing
mode, i.e. when you type a char, it replace the old one such that the
alignment is maintained.

But when mixing with double-width characters (e.g. CJK chars), one to
one char replacing become problematic, e.g. if we replace a
single-width char with a double-wdith char, the alignment will be
destroyed.

So, what I suggests is: if we replace a double-width to a
single-width, we should add a extra single-width space; and if we
replace a single-width to a double-witdh, we should check its
following char: if it is single-width, delete it; otherwise replace it
with a single-width space.

In GNU Emacs 23.0.60.1 (i386-apple-darwin9.6.0, NS apple-appkit-949.43)
 of 2008-12-25 on neutron.local
Windowing system distributor `Apple', version 97.112.112.108.101.45.97.112.112.107.105.116.45.57.52.57.46.52.51
configured using `configure  '--with-ns''

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

Major mode: Group

Minor modes in effect:
  erc-log-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  gnus-undo-mode: t
  recentf-mode: t
  which-function-mode: t
  show-paren-mode: t
  mouse-sel-mode: t
  global-hl-line-mode: t
  pinbar-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-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:
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
9 RET C-n C-n SPC F C-\ x t u SPC g f SPC j e r r SPC 
w b SPC s h n SPC w d t SPC w f t c b SPC . RET y i 
SPC j SPC y u SPC d SPC 1 s o v SPC g n g DEL SPC 4 
s o v SPC u j SPC e SPC DEL e t SPC g SPC w h SPC A 
A P DEL DEL DEL k h t SPC m g SPC DEL m g j SPC DEL 
m g SPC DEL m h SPC t SPC g SPC w h SPC A P r a w k 
SPC g SPC g h SPC DEL w h SPC x g SPC ? DEL . RET RET 
ESC [ A ESC [ A C-e ESC [ D ESC [ D DEL t s SPC w y 
SPC u t h p SPC ESC [ C DEL ESC [ B C-x k C-g C-x k 
y q g C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
ESC < n RET SPC n SPC q ESC < ESC > ESC < ESC x n e 
w s C-p C-p RET U N o o o N o o o ESC x n e w s C-p 
C-p RET ESC 1 ESC < ESC > ESC < C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n ESC x r 
e p o TAB r TAB RET

Recent messages:
Reading... done.
Preparing newsticker buffer...
Newsticker stopped!
Mark set [3 times]
Reading active file from gmail via nnimap...
nnimap: Checking mailboxes...done
Reading active file from freenews.netfront.net via nntp...
Reading active file from news.motzarella.org via nntp...
Checking new news...done
Making completion list...