From 3299ee0894526f3564ee43a4b83e07b10732592e Mon Sep 17 00:00:00 2001 From: mogami Date: Tue, 21 Oct 2003 13:31:37 +0000 Subject: [PATCH] =?utf8?q?util.c=201.50=20=E3=81=AE=20askfor=5Faux()=20?= =?utf8?q?=E3=81=AE=E4=BF=AE=E6=AD=A3(=E5=B7=A6=E3=82=AB=E3=83=BC=E3=82=BD?= =?utf8?q?=E3=83=AB=E7=A7=BB=E5=8B=95=E3=81=A8=E3=83=90=E3=83=83=E3=82=AF?= =?utf8?q?=E3=82=B9=E3=83=9A=E3=83=BC=E3=82=B9)=E3=82=92autopick.c?= =?utf8?q?=E3=81=AE=E6=A4=9C=E7=B4=A2=E6=96=87=E5=AD=97=E5=88=97=E5=85=A5?= =?utf8?q?=E5=8A=9B=E3=81=AE=E3=82=B3=E3=83=BC=E3=83=89=E3=81=AB=E9=81=A9?= =?utf8?q?=E7=94=A8=E3=81=99=E3=82=8B=E3=82=92=E5=BF=98=E3=82=8C=E3=81=A6?= =?utf8?q?=E3=81=84=E3=81=9F=E3=81=AE=E3=81=A7=E4=BB=8A=E9=81=A9=E7=94=A8?= =?utf8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/autopick.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/autopick.c b/src/autopick.c index f41d43414..7080b5b8d 100644 --- a/src/autopick.c +++ b/src/autopick.c @@ -3238,18 +3238,37 @@ static byte get_string_for_search(object_type **o_handle, cptr *search_strp) break; case '\010': + { /* Backspace */ + int i = 0; + /* Now on insert mode */ color = TERM_WHITE; /* No move at biggining of line */ - if (!pos) break; + if (0 == pos) break; - /* Go left 1 unit */ - pos--; + while (TRUE) + { + int next_pos = i + 1; + +#ifdef JP + if (iskanji(buf[i])) next_pos++; +#endif + + /* Is there the cursor at next position? */ + if (next_pos >= pos) break; + + /* Move to next */ + i = next_pos; + } + + /* Get previous position */ + pos = i; /* Fall through to 'Delete key' */ + } case 0x7F: case KTRL('d'): @@ -3265,7 +3284,7 @@ static byte get_string_for_search(object_type **o_handle, cptr *search_strp) #ifdef JP /* Next character is one more byte away */ - if (iskanji(src)) src++; + if (iskanji(buf[pos])) src++; #endif dst = pos; -- 2.11.0