diff options
author | Christoph Lohmann <20h@r-36.net> | 2013-01-18 19:11:25 +0100 |
---|---|---|
committer | Christoph Lohmann <20h@r-36.net> | 2013-01-18 19:11:25 +0100 |
commit | ed90afb743911b7b95dc2bf36b65076532779269 (patch) | |
tree | ccad6b6245d61ee7b8bfe7c46fd23acba5f8fafa | |
parent | c9bd58e4dd04e61aa3613eab57ba6fb716a41146 (diff) | |
download | st-patched-ed90afb743911b7b95dc2bf36b65076532779269.tar.bz2 st-patched-ed90afb743911b7b95dc2bf36b65076532779269.tar.xz st-patched-ed90afb743911b7b95dc2bf36b65076532779269.zip |
The title can now be set with UTF-8 characters.
Thanks Mihail Zenkov <mihail.zenkov@gmail.com>!
-rw-r--r-- | st.c | 34 |
1 files changed, 24 insertions, 10 deletions
@@ -53,12 +53,12 @@ | |||
53 | #define XEMBED_FOCUS_OUT 5 | 53 | #define XEMBED_FOCUS_OUT 5 |
54 | 54 | ||
55 | /* Arbitrary sizes */ | 55 | /* Arbitrary sizes */ |
56 | #define ESC_BUF_SIZ 256 | 56 | #define UTF_SIZ 4 |
57 | #define ESC_BUF_SIZ (128*UTF_SIZ) | ||
57 | #define ESC_ARG_SIZ 16 | 58 | #define ESC_ARG_SIZ 16 |
58 | #define STR_BUF_SIZ 256 | 59 | #define STR_BUF_SIZ ESC_BUF_SIZ |
59 | #define STR_ARG_SIZ 16 | 60 | #define STR_ARG_SIZ ESC_ARG_SIZ |
60 | #define DRAW_BUF_SIZ 20*1024 | 61 | #define DRAW_BUF_SIZ 20*1024 |
61 | #define UTF_SIZ 4 | ||
62 | #define XK_ANY_MOD UINT_MAX | 62 | #define XK_ANY_MOD UINT_MAX |
63 | #define XK_NO_MOD 0 | 63 | #define XK_NO_MOD 0 |
64 | 64 | ||
@@ -168,7 +168,7 @@ typedef struct { | |||
168 | int len; /* raw string length */ | 168 | int len; /* raw string length */ |
169 | char priv; | 169 | char priv; |
170 | int arg[ESC_ARG_SIZ]; | 170 | int arg[ESC_ARG_SIZ]; |
171 | int narg; /* nb of args */ | 171 | int narg; /* nb of args */ |
172 | char mode; | 172 | char mode; |
173 | } CSIEscape; | 173 | } CSIEscape; |
174 | 174 | ||
@@ -1911,12 +1911,13 @@ tputc(char *c, int len) { | |||
1911 | 1911 | ||
1912 | if(iofd != -1) { | 1912 | if(iofd != -1) { |
1913 | if (xwrite(iofd, c, len) < 0) { | 1913 | if (xwrite(iofd, c, len) < 0) { |
1914 | fprintf(stderr, "Error writting in %s:%s\n", | 1914 | fprintf(stderr, "Error writing in %s:%s\n", |
1915 | opt_io, strerror(errno)); | 1915 | opt_io, strerror(errno)); |
1916 | close(iofd); | 1916 | close(iofd); |
1917 | iofd = -1; | 1917 | iofd = -1; |
1918 | } | 1918 | } |
1919 | } | 1919 | } |
1920 | |||
1920 | /* | 1921 | /* |
1921 | * STR sequences must be checked before anything else | 1922 | * STR sequences must be checked before anything else |
1922 | * because it can use some control codes as part of the sequence. | 1923 | * because it can use some control codes as part of the sequence. |
@@ -1931,10 +1932,23 @@ tputc(char *c, int len) { | |||
1931 | strhandle(); | 1932 | strhandle(); |
1932 | break; | 1933 | break; |
1933 | default: | 1934 | default: |
1934 | strescseq.buf[strescseq.len++] = ascii; | 1935 | if(strescseq.len + len < sizeof(strescseq.buf)) { |
1935 | if(strescseq.len+1 >= STR_BUF_SIZ) { | 1936 | memmove(&strescseq.buf[strescseq.len], c, len); |
1936 | term.esc = 0; | 1937 | strescseq.len += len; |
1937 | strhandle(); | 1938 | } else { |
1939 | /* | ||
1940 | * Here is a bug in terminals. If the user never sends | ||
1941 | * some code to stop the str or esc command, then st | ||
1942 | * will stop responding. But this is better than | ||
1943 | * silently failing with unknown characters. At least | ||
1944 | * then users will report back. | ||
1945 | * | ||
1946 | * In the case users ever get fixed, here is the code: | ||
1947 | */ | ||
1948 | /* | ||
1949 | * term.esc = 0; | ||
1950 | * strhandle(); | ||
1951 | */ | ||
1938 | } | 1952 | } |
1939 | } | 1953 | } |
1940 | return; | 1954 | return; |