From: Clint Adams <clint@zsh.org>
To: zsh-workers@sunsite.dk
Subject: multibyte backwarddeletechar
Date: Sun, 21 Oct 2001 11:42:54 -0400 [thread overview]
Message-ID: <20011021114254.A17952@dman.com> (raw)
I don't intend to commit this patch as-is.
This causes backward-delete-char to delete entire
multibyte characters (valid in the current locale)
rather than their component octets.
For consistency's sake, similar hacks would apply to
backward-char
backward-delete-char
delete-char
forward-char
transpose-chars
vi-find-next-char
vi-backward-char
vi-backward-delete-char
vi-forward-char
Should these be replacements or a set of new widgets?
Index: zshconfig.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/zshconfig.ac,v
retrieving revision 1.20
diff -u -r1.20 zshconfig.ac
--- zshconfig.ac 2001/10/10 16:02:24 1.20
+++ zshconfig.ac 2001/10/21 15:23:42
@@ -476,7 +476,7 @@
limits.h fcntl.h libc.h sys/utsname.h sys/resource.h \
locale.h errno.h stdlib.h unistd.h sys/capability.h \
utmp.h utmpx.h sys/types.h pwd.h grp.h poll.h sys/mman.h \
- netinet/in_systm.h pcre.h)
+ netinet/in_systm.h pcre.h wchar.h)
if test $dynamic = yes; then
AC_CHECK_HEADERS(dlfcn.h)
AC_CHECK_HEADERS(dl.h)
@@ -938,7 +938,8 @@
brk sbrk \
pathconf sysconf \
tgetent tigetflag tigetnum tigetstr setupterm \
- pcre_compile pcre_study pcre_exec)
+ pcre_compile pcre_study pcre_exec \
+ mbtowc)
AC_FUNC_STRCOLL
dnl Check if tgetent accepts NULL (and will allocate its own termcap buffer)
Index: Src/Zle/zle_misc.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_misc.c,v
retrieving revision 1.6
diff -u -r1.6 zle_misc.c
--- Src/Zle/zle_misc.c 2001/09/03 01:39:20 1.6
+++ Src/Zle/zle_misc.c 2001/10/21 15:23:46
@@ -29,6 +29,9 @@
#include "zle.mdh"
#include "zle_misc.pro"
+#ifdef HAVE_MBTOWC
+# include <wchar.h>
+#endif
/* insert a metafied string, with repetition and suffix removal */
@@ -105,6 +108,10 @@
int
backwarddeletechar(char **args)
{
+#ifdef HAVE_MBTOWC
+ int i, j, k;
+ wchar_t pwc;
+#endif
if (zmult < 0) {
int ret;
zmult = -zmult;
@@ -112,7 +119,19 @@
zmult = -zmult;
return ret;
}
+#ifdef HAVE_MBTOWC
+ for(i=(zmult > cs) ? cs : zmult;i>0;i--) {
+ for(j=MB_CUR_MAX;j>0;j--) {
+ k = mbtowc(&pwc, (char *)line+cs-j, j);
+ if (k==j) {
+ backdel(j);
+ j = 0;
+ }
+ }
+ }
+#else
backdel(zmult > cs ? cs : zmult);
+#endif
return 0;
}
next reply other threads:[~2001-10-21 15:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-21 15:42 Clint Adams [this message]
2001-10-21 17:13 ` Bart Schaefer
2001-10-21 18:21 ` Clint Adams
2001-10-22 0:57 ` Geoff Wing
2001-10-22 1:50 ` Clint Adams
2001-10-22 3:23 ` Geoff Wing
2001-10-22 11:27 ` Clint Adams
2001-10-22 5:20 ` Borsenkow Andrej
2001-10-22 11:32 ` Clint Adams
2001-10-22 12:02 ` Borsenkow Andrej
2001-10-24 13:57 ` Clint Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20011021114254.A17952@dman.com \
--to=clint@zsh.org \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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 NNTP newsgroup(s).