• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revision9dead93de998d3f7bba53a79da2560c803a9d498 (tree)
Time2003-10-13 11:18:46
Authormogami <mogami@0568...>
Commitermogami

Log Message

文字列入力中に、挿入モードへ移行する条件を微調整。deleteやbackspace等を押した時も移行。

Change Summary

Incremental Difference

--- a/src/autopick.c
+++ b/src/autopick.c
@@ -3098,6 +3098,12 @@ static byte get_destroyed_object_for_search(object_type **o_handle, cptr *search
30983098 static byte get_string_for_search(object_type **o_handle, cptr *search_strp)
30993099 {
31003100 int pos = 0;
3101+
3102+ /*
3103+ * Text color
3104+ * TERM_YELLOW : Overwrite mode
3105+ * TERM_WHITE : Insert mode
3106+ */
31013107 byte color = TERM_YELLOW;
31023108 char buf[MAX_NLEN+20];
31033109 const size_t len = 80;
@@ -3140,7 +3146,10 @@ static byte get_string_for_search(object_type **o_handle, cptr *search_strp)
31403146 {
31413147 int i = 0;
31423148
3143- /* No effect at biggining of line */
3149+ /* Now on insert mode */
3150+ color = TERM_WHITE;
3151+
3152+ /* No move at biggining of line */
31443153 if (0 == pos) break;
31453154
31463155 while (TRUE)
@@ -3161,15 +3170,15 @@ static byte get_string_for_search(object_type **o_handle, cptr *search_strp)
31613170 /* Get previous position */
31623171 pos = i;
31633172
3164- /* Now on insert mode */
3165- color = TERM_WHITE;
3166-
31673173 break;
31683174 }
31693175
31703176 case SKEY_RIGHT:
31713177 case KTRL('f'):
3172- /* No effect at end of line */
3178+ /* Now on insert mode */
3179+ color = TERM_WHITE;
3180+
3181+ /* No move at end of line */
31733182 if ('\0' == buf[pos]) break;
31743183
31753184 #ifdef JP
@@ -3180,9 +3189,6 @@ static byte get_string_for_search(object_type **o_handle, cptr *search_strp)
31803189 pos++;
31813190 #endif
31823191
3183- /* Now on insert mode */
3184- color = TERM_WHITE;
3185-
31863192 break;
31873193
31883194 case ESCAPE:
@@ -3214,7 +3220,10 @@ static byte get_string_for_search(object_type **o_handle, cptr *search_strp)
32143220 case '\010':
32153221 /* Backspace */
32163222
3217- /* No effect at biggining of line */
3223+ /* Now on insert mode */
3224+ color = TERM_WHITE;
3225+
3226+ /* No move at biggining of line */
32183227 if (!pos) break;
32193228
32203229 /* Go left 1 unit */
@@ -3226,17 +3235,21 @@ static byte get_string_for_search(object_type **o_handle, cptr *search_strp)
32263235 case KTRL('d'):
32273236 /* Delete key */
32283237 {
3238+ int dst, src;
32293239
3230- int dst = pos;
3240+ /* Now on insert mode */
3241+ color = TERM_WHITE;
32313242
32323243 /* Position of next character */
3233- int src = pos + 1;
3244+ src = pos + 1;
32343245
32353246 #ifdef JP
32363247 /* Next character is one more byte away */
32373248 if (iskanji(src)) src++;
32383249 #endif
32393250
3251+ dst = pos;
3252+
32403253 /* Move characters at src to dst */
32413254 while ('\0' != (buf[dst++] = buf[src++]))
32423255 /* loop */;
--- a/src/util.c
+++ b/src/util.c
@@ -3138,13 +3138,19 @@ void clear_from(int row)
31383138
31393139
31403140 /*
3141- * Get some input at the cursor location.
3141+ * Get some string input at the cursor location.
31423142 * Assume the buffer is initialized to a default string.
3143- * Note that this string is often "empty" (see below).
3144- * The default buffer is displayed in yellow until cleared.
3145- * Pressing RETURN right away accepts the default entry.
3146- * Normal chars clear the default and append the char.
3147- * Backspace clears the default or deletes the final char.
3143+ *
3144+ * The default buffer is in Overwrite mode and displayed in yellow at
3145+ * first. Normal chars clear the yellow text and append the char in
3146+ * white text.
3147+ *
3148+ * LEFT (^B) and RIGHT (^F) movement keys move the cursor position.
3149+ * If the text is still displayed in yellow (Overwite mode), it will
3150+ * turns into white (Insert mode) when cursor moves.
3151+ *
3152+ * DELETE (^D) deletes a char at the cursor position.
3153+ * BACKSPACE (^H) deletes a char at the left of cursor position.
31483154 * ESCAPE clears the buffer and the window and returns FALSE.
31493155 * RETURN accepts the current buffer contents and returns TRUE.
31503156 */
@@ -3152,6 +3158,12 @@ bool askfor_aux(char *buf, int len)
31523158 {
31533159 int y, x;
31543160 int pos = 0;
3161+
3162+ /*
3163+ * Text color
3164+ * TERM_YELLOW : Overwrite mode
3165+ * TERM_WHITE : Insert mode
3166+ */
31553167 byte color = TERM_YELLOW;
31563168
31573169 /* Locate the cursor position */
@@ -3193,7 +3205,10 @@ bool askfor_aux(char *buf, int len)
31933205 {
31943206 int i = 0;
31953207
3196- /* No effect at biggining of line */
3208+ /* Now on insert mode */
3209+ color = TERM_WHITE;
3210+
3211+ /* No move at biggining of line */
31973212 if (0 == pos) break;
31983213
31993214 while (TRUE)
@@ -3214,15 +3229,15 @@ bool askfor_aux(char *buf, int len)
32143229 /* Get previous position */
32153230 pos = i;
32163231
3217- /* Now on insert mode */
3218- color = TERM_WHITE;
3219-
32203232 break;
32213233 }
32223234
32233235 case SKEY_RIGHT:
32243236 case KTRL('f'):
3225- /* No effect at end of line */
3237+ /* Now on insert mode */
3238+ color = TERM_WHITE;
3239+
3240+ /* No move at end of line */
32263241 if ('\0' == buf[pos]) break;
32273242
32283243 #ifdef JP
@@ -3233,9 +3248,6 @@ bool askfor_aux(char *buf, int len)
32333248 pos++;
32343249 #endif
32353250
3236- /* Now on insert mode */
3237- color = TERM_WHITE;
3238-
32393251 break;
32403252
32413253 case ESCAPE:
@@ -3251,7 +3263,10 @@ bool askfor_aux(char *buf, int len)
32513263 case '\010':
32523264 /* Backspace */
32533265
3254- /* No effect at biggining of line */
3266+ /* Now on insert mode */
3267+ color = TERM_WHITE;
3268+
3269+ /* No move at biggining of line */
32553270 if (!pos) break;
32563271
32573272 /* Go left 1 unit */
@@ -3263,17 +3278,21 @@ bool askfor_aux(char *buf, int len)
32633278 case KTRL('d'):
32643279 /* Delete key */
32653280 {
3281+ int dst, src;
32663282
3267- int dst = pos;
3283+ /* Now on insert mode */
3284+ color = TERM_WHITE;
32683285
32693286 /* Position of next character */
3270- int src = pos + 1;
3287+ src = pos + 1;
32713288
32723289 #ifdef JP
32733290 /* Next character is one more byte away */
32743291 if (iskanji(src)) src++;
32753292 #endif
32763293
3294+ dst = pos;
3295+
32773296 /* Move characters at src to dst */
32783297 while ('\0' != (buf[dst++] = buf[src++]))
32793298 /* loop */;
Show on old repository browser