From 3856ff5f82665a83b71b1ee5c7d19de1e6390246 Mon Sep 17 00:00:00 2001 From: mogami Date: Fri, 31 Oct 2003 17:59:38 +0000 Subject: [PATCH] =?utf8?q?=E8=87=AA=E5=8B=95=E6=8B=BE=E3=81=84=E3=82=A8?= =?utf8?q?=E3=83=87=E3=82=A3=E3=82=BF=E3=81=AE=E3=82=A2=E3=82=A4=E3=83=86?= =?utf8?q?=E3=83=A0=E3=81=A7=E6=A4=9C=E7=B4=A2=E3=81=99=E3=82=8B=E6=A9=9F?= =?utf8?q?=E8=83=BD=E3=81=AE=E3=82=B3=E3=83=BC=E3=83=89=E3=81=8C=E3=81=A1?= =?utf8?q?=E3=82=83=E3=82=93=E3=81=A8=20inkey=5Fspecial()=20=E3=81=AB?= =?utf8?q?=E3=82=88=E3=82=8B=E3=82=A8=E3=83=87=E3=82=A3=E3=83=83=E3=83=88?= =?utf8?q?=E3=81=AB=E5=AF=BE=E5=BF=9C=E3=81=97=E3=81=A6=E3=81=84=E3=81=AA?= =?utf8?q?=E3=81=8B=E3=81=A3=E3=81=9F=E3=81=AE=E3=81=A7=E4=BF=AE=E6=AD=A3?= =?utf8?q?=E3=80=82=20=E3=81=BE=E3=81=9F=E3=80=81=E7=A9=BA=E7=99=BD?= =?utf8?q?=E6=96=87=E5=AD=97=E5=88=97=E3=81=A7=E6=A4=9C=E7=B4=A2=E3=81=97?= =?utf8?q?=E3=82=88=E3=81=86=E3=81=A8=E3=81=97=E3=81=9F=E6=99=82=E3=81=AE?= =?utf8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC?= =?utf8?q?=E3=82=B8=E3=81=8C=E5=87=BA=E3=81=AA=E3=81=8F=E3=81=AA=E3=81=A3?= =?utf8?q?=E3=81=A6=20=E3=81=84=E3=81=9F=E3=81=AE=E3=81=A7=E5=87=BA?= =?utf8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/autopick.c | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/src/autopick.c b/src/autopick.c index 2963e7709..b85c20285 100644 --- a/src/autopick.c +++ b/src/autopick.c @@ -3293,9 +3293,16 @@ static byte get_string_for_search(object_type **o_handle, cptr *search_strp) #endif int col = sizeof(prompt) - 1; + /* Prepare string buffer for edit */ if (*search_strp) strcpy(buf, *search_strp); else buf[0] = '\0'; + /* Object searching mode */ + if (*o_handle) + { + color = TERM_L_GREEN; + } + /* Display prompt */ prt(prompt, 0, 0); @@ -3379,7 +3386,7 @@ static byte get_string_for_search(object_type **o_handle, cptr *search_strp) case '\n': case '\r': case KTRL('s'): - if (!pos && *o_handle) return (back ? -1 : 1); + if (*o_handle) return (back ? -1 : 1); string_free(*search_strp); *search_strp = string_make(buf); *o_handle = NULL; @@ -3470,8 +3477,20 @@ static byte get_string_for_search(object_type **o_handle, cptr *search_strp) /* Get a character code */ c = (char)skey; - if (color == TERM_YELLOW) + /* Was non insert mode? */ + if (color != TERM_WHITE) { + /* Was object searching mode */ + if (color == TERM_L_GREEN) + { + /* Cancel the mode */ + *o_handle = NULL; + + /* Remove indicating string */ + string_free(*search_strp); + *search_strp = NULL; + } + /* Overwrite default string */ buf[0] = '\0'; @@ -3528,6 +3547,20 @@ static byte get_string_for_search(object_type **o_handle, cptr *search_strp) } + /* Object searching mode was cancelled? */ + if (*o_handle && color != TERM_L_GREEN) + { + /* Cancel the mode */ + *o_handle = NULL; + + /* Remove indicating string */ + buf[0] = '\0'; + string_free(*search_strp); + *search_strp = NULL; + + } + + } /* while (TRUE) */ } @@ -5471,7 +5504,7 @@ static bool do_editor_command(text_body_type *tb, int com_id) { search_for_object(tb, tb->search_o_ptr, TRUE); } - else if (tb->search_str) + else if (tb->search_str && tb->search_str[0]) { search_for_string(tb, tb->search_str, TRUE); } @@ -5486,7 +5519,7 @@ static bool do_editor_command(text_body_type *tb, int com_id) { search_for_object(tb, tb->search_o_ptr, FALSE); } - else if (tb->search_str) + else if (tb->search_str && tb->search_str[0]) { search_for_string(tb, tb->search_str, FALSE); } -- 2.11.0