OSDN Git Service

[Fix] クイックメッセージの挙動が以前と異なる
[hengband/hengband.git] / src / main / x11-type-string.c
1 /*!
2  * @brief X11用の文字列処理
3  * @date 2020/06/14
4  * @author Hourier
5  * @details Windowsでは使わない
6  */
7
8 #include "main/x11-type-string.h"
9 #include "term/gameterm.h"
10
11 /*
12  * Add a series of keypresses to the "queue".
13  *
14  * Return any errors generated by term_key_push() in doing so, or SUCCESS
15  * if there are none.
16  *
17  * Catch the "out of space" error before anything is printed.
18  *
19  * NB: The keys added here will be interpreted by any macros or keymaps.
20  */
21 errr type_string(concptr str, uint len)
22 {
23     errr err = 0;
24     term_type *old = Term;
25     if (!str)
26         return -1;
27     if (!len)
28         len = strlen(str);
29
30     term_activate(term_screen);
31     for (concptr s = str; s < str + len; s++) {
32         if (*s == '\0')
33             break;
34
35         err = term_key_push(*s);
36         if (err)
37             break;
38     }
39
40     term_activate(old);
41     return err;
42 }