From c1cfc49998c1441b7c8b0cfc809a4ae92e47d958 Mon Sep 17 00:00:00 2001 From: tnozaki Date: Fri, 4 Jul 2008 15:51:35 +0000 Subject: [PATCH] fix cursor position problem with the character wcwidth > 1. discussed in tech-userlevel, ok'ed by jdc@ thanks! --- lib/libcurses/cr_put.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/libcurses/cr_put.c b/lib/libcurses/cr_put.c index 2b1e04ba2df7..a60dac8f5413 100644 --- a/lib/libcurses/cr_put.c +++ b/lib/libcurses/cr_put.c @@ -1,4 +1,4 @@ -/* $NetBSD: cr_put.c,v 1.25 2007/05/28 15:01:54 blymn Exp $ */ +/* $NetBSD: cr_put.c,v 1.26 2008/07/04 15:51:35 tnozaki Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)cr_put.c 8.3 (Berkeley) 5/4/94"; #else -__RCSID("$NetBSD: cr_put.c,v 1.25 2007/05/28 15:01:54 blymn Exp $"); +__RCSID("$NetBSD: cr_put.c,v 1.26 2008/07/04 15:51:35 tnozaki Exp $"); #endif #endif /* not lint */ @@ -402,16 +402,11 @@ dontcr:while (outline < destline) { if (plodflg) /* Avoid a complex calculation. */ plodcnt--; else { -#ifndef HAVE_WCHAR - i = curscr->lines[outline]->line[outcol].ch - & __CHARTEXT; if (curscr->lines[outline]->line[outcol].attr - == curscr->wattr) - __cputchar(i); + == curscr->wattr) { +#ifndef HAVE_WCHAR + __cputchar(curscr->lines[outline]->line[outcol].ch & __CHARTEXT); #else - if ((curscr->lines[outline]->line[outcol].attr - & WA_ATTRIBUTES) - == curscr->wattr ) { if (WCOL(curscr->lines[outline]->line[outcol]) > 0) { __cputwchar(curscr->lines[outline]->line[outcol].ch); __cursesi_putnsp(curscr->lines[outline]->line[outcol].nsp, @@ -426,9 +421,8 @@ dontcr:while (outline < destline) { curscr->lines[outline]->line[outcol].ch); #endif /* DEBUG */ } - } #endif /* HAVE_WCHAR */ - else + } else goto nondes; } else