[uim-commit] r839 - in trunk: . fep
yamamoto at freedesktop.org
yamamoto at freedesktop.org
Sat May 14 22:22:23 PDT 2005
Author: yamamoto
Date: 2005-05-14 22:22:21 -0700 (Sat, 14 May 2005)
New Revision: 839
Added:
trunk/fep/README.key
Modified:
trunk/configure.ac
trunk/fep/README.ja
trunk/fep/callbacks.c
trunk/fep/callbacks.h
trunk/fep/draw.c
trunk/fep/draw.h
trunk/fep/escseq.c
trunk/fep/escseq.h
trunk/fep/key.c
trunk/fep/str.c
trunk/fep/uim-fep.c
trunk/fep/uim-fep.h
Log:
* configure.ac: Add check of ncurses/term.h
* fep/:
- New option -d. ddskk like candidate style
- Remove -D option.
- Change notatoins of some keys.
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2005-05-11 22:56:48 UTC (rev 838)
+++ trunk/configure.ac 2005-05-15 05:22:21 UTC (rev 839)
@@ -138,7 +138,7 @@
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h locale.h stdlib.h unistd.h])
AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/ioctl.h sys/socket.h termios.h unistd.h wchar.h])
-AC_CHECK_HEADERS([sys/time.h sys/stat.h sys/un.h getopt.h assert.h signal.h term.h ctype.h pwd.h stdarg.h fcntl.h])
+AC_CHECK_HEADERS([sys/time.h sys/stat.h sys/un.h getopt.h assert.h signal.h term.h ncurses/term.h ctype.h pwd.h stdarg.h fcntl.h])
AC_CHECK_HEADERS([pty.h util.h libutil.h])
AC_CHECK_HEADERS([curses.h stropts.h])
AC_CHECK_HEADERS([sys/param.h strings.h])
Modified: trunk/fep/README.ja
===================================================================
--- trunk/fep/README.ja 2005-05-11 22:56:48 UTC (rev 838)
+++ trunk/fep/README.ja 2005-05-15 05:22:21 UTC (rev 839)
@@ -156,10 +156,7 @@
-s¥ª¥×¥·¥ç¥ó¤Ë¤«¤«¤ï¤é¤º¥â¡¼¥Éɽ¼¨¤Ë¤Ï
backtick¤¬»È¤ï¤ì¤Þ¤¹¡£
- o -D uim-fep¤Îµ¯Æ°¤Ë¼ºÇÔ¤·¤Æ
- Report Cursor Position is not available
- Please try to use with -D option
- ¤Èɽ¼¨¤µ¤ì¤¿¾ì¹ç¤Ï¡¢µ¯Æ°»þ¤Ë¤³¤Î¥ª¥×¥·¥ç¥ó¤ò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤¡£
+ o -d ¸õÊä°ìÍ÷¤Îɽ¼¨¥¹¥¿¥¤¥ë¤òddskk¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡£
o -e command arg1 arg2 ...
µ¯Æ°¤¹¤ë¥³¥Þ¥ó¥É¤ò»ØÄꤷ¤Þ¤¹¡£¤³¤Î¥ª¥×¥·¥ç¥ó°Ê¹ß¤Î°ú¿ô¤Ï
@@ -206,37 +203,7 @@
* ~/.uim¤ò½ñ¤¯¤È¤¤ÎÃí°ÕÅÀ
- a .. z -> "a" .. "z"
- A .. Z -> "A" .. "Z" (¤Þ¤¿¤Ï "<Shift>A" .. "<Shift>Z")
- C-a .. C-z -> "<Control>a" .. <Control>z"
- M-a .. M-z -> "<Alt>a" .. "<Alt>z"
- M-A .. M-Z -> "<Alt>A" .. "<Alt>Z" (¤Þ¤¿¤Ï "<Alt><Shift>A" .. "<Alt><Shift>Z")
- M-C-a .. M-C-z -> "<Control><Alt>a" .. "<Control><Alt>z"
- return -> "<Control>m"
- backspace(C-h¤Î¤È¤) -> "<Control>h"
- backspace(C-?¤Î¤È¤) -> "delete"
- backspace(¤½¤ì°Ê³°) -> "backspace"
- tab -> "<Control>i"
- del, C-? -> "delete"
- esc, C-[ -> "escape"
- C-\ -> "<Control>\\"
- C-] -> "<Control>]"
- C-^ -> "<Control>^"
- C-_ -> "<Control>_"
- C-space -> "<Control> "
- M-esc, M-C-[ -> "<Alt>escape"
- M-C-\ -> "<Alt><Control>\\"
- M-C-] -> "<Alt><Control>]"
- M-C-^ -> "<Alt><Control>^"
- M-C-_ -> "<Alt><Control>_"
- M-C-space -> "<Alt><Control> "
- ¢¬ ¢ ¢ª ¢« -> "up" "down" "right" "left"
- F1 .. F12 -> "F1" .. "F12"
- Home -> "home"
- End -> "end"
- PageUp -> "prior"
- PageDown -> "next"
- Insert -> »È¤¨¤Þ¤»¤ó
+ o ¥¡¼¤ÎɽµË¡¤Ë¤Ä¤¤¤Æ¤ÏREADME.key¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
o Alt¥¡¼¤ò»È¤¦¤Ë¤ÏAlt¤ò²¡¤·¤Ê¤¬¤é¾¤Î¥¡¼¤ò²¡¤·¤¿¤È¤¤Ë¡¢^[¤¬½ÐÎϤµ
¤ì¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
@@ -265,9 +232,7 @@
$ kill -INT <uim-fep¤Îpid>
¤³¤Î¥³¥Þ¥ó¥É¤Çľ¤ë¤È»×¤¤¤Þ¤¹¡£¤¿¤À¤·ÊÑ´¹¤Ï¤Ç¤¤Ê¤¯¤Ê¤ê¤Þ¤¹¡£
- o Cygwin(DOS¥×¥í¥ó¥×¥È¡¢¥³¥Þ¥ó¥É¥×¥í¥ó¥×¥È)¤ÇÆ°¤¤Þ¤»¤ó¡£
-
* Ãí°Õ
Ãæ¥Ü¥¿¥ó¥¯¥ê¥Ã¥¯¤äShift+Insert¤Î¥Ú¡¼¥¹¥È¤Ê¤É¤Ç°ìÅÙ¤ËÂçÎ̤ËÆþÎϤµ¤ì¤¿
¤È¤¤ÏÊÑ´¹¤»¤º¤Ë¤½¤Î¤Þ¤Þ½ÐÎϤµ¤ì¤Þ¤¹¡£
@@ -277,6 +242,14 @@
* ÍúÎò
+ o 2005/5/15
+ * -d¥ª¥×¥·¥ç¥ó¤òÄɲä·¤Þ¤·¤¿¡£
+ * Cygwin¤ÇÆ°¤¯¤è¤¦¤Ë¤·¤Þ¤·¤¿¡£(EUC-JP¤Î¤ßÂбþ)
+ * DOS¥×¥í¥ó¥×¥È¤ÇÆ°¤¯¤è¤¦¤Ë¤·¤Þ¤·¤¿¡£
+ * ¥¡¼¤Îɽµ¤ò°ìÉôÊѹ¹¤·¤Þ¤·¤¿¡£
+ Ctrl + m¤ò"<Control>m"¤«¤é"return" ¤Ê¤É
+ README.key¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
+
o 2005/2/11
* -S¥ª¥×¥·¥ç¥ó¤òÄɲä·¤Þ¤·¤¿¡£
Added: trunk/fep/README.key
===================================================================
--- trunk/fep/README.key 2005-05-11 22:56:48 UTC (rev 838)
+++ trunk/fep/README.key 2005-05-15 05:22:21 UTC (rev 839)
@@ -0,0 +1,325 @@
+ascii character
+
+Ctrl + space "<Control> "
+Ctrl + a "<Control>a"
+Ctrl + b "<Control>b"
+Ctrl + c "<Control>c"
+Ctrl + d "<Control>d"
+Ctrl + e "<Control>e"
+Ctrl + f "<Control>f"
+Ctrl + g "<Control>g"
+Ctrl + h "backspace"
+Ctrl + i "tab"
+Ctrl + j "<Control>j"
+Ctrl + k "<Control>k"
+Ctrl + l "<Control>l"
+Ctrl + m "return"
+Ctrl + n "<Control>n"
+Ctrl + o "<Control>o"
+Ctrl + p "<Control>p"
+Ctrl + q "<Control>q"
+Ctrl + r "<Control>r"
+Ctrl + s "<Control>s"
+Ctrl + t "<Control>t"
+Ctrl + u "<Control>u"
+Ctrl + v "<Control>v"
+Ctrl + w "<Control>w"
+Ctrl + x "<Control>x"
+Ctrl + y "<Control>y"
+Ctrl + z "<Control>z"
+Ctrl + [ "escape"
+Ctrl + \ "<Control>\\"
+Ctrl + ] "<Control>]"
+Ctrl + ^ "<Control>^"
+Ctrl + _ "<Control>_"
+space " "
+! "!"
+" "\""
+# "#"
+$ "$"
+% "%"
+& "&"
+' "'"
+( "("
+) ")"
+* "*"
++ "+"
+, ","
+- "-"
+. "."
+/ "/"
+0 "0"
+1 "1"
+2 "2"
+3 "3"
+4 "4"
+5 "5"
+6 "6"
+7 "7"
+8 "8"
+9 "9"
+: ":"
+; ";"
+< "<"
+= "="
+> ">"
+? "?"
+@ "@"
+A "A"
+B "B"
+C "C"
+D "D"
+E "E"
+F "F"
+G "G"
+H "H"
+I "I"
+J "J"
+K "K"
+L "L"
+M "M"
+N "N"
+O "O"
+P "P"
+Q "Q"
+R "R"
+S "S"
+T "T"
+U "U"
+V "V"
+W "W"
+X "X"
+Y "Y"
+Z "Z"
+[ "["
+\ "\\"
+] "]"
+^ "^"
+_ "_"
+` "`"
+a "a"
+b "b"
+c "c"
+d "d"
+e "e"
+f "f"
+g "g"
+h "h"
+i "i"
+j "j"
+k "k"
+l "l"
+m "m"
+n "n"
+o "o"
+p "p"
+q "q"
+r "r"
+s "s"
+t "t"
+u "u"
+v "v"
+w "w"
+x "x"
+y "y"
+z "z"
+{ "{"
+| "|"
+} "}"
+~ "~"
+delete "delete"
+
+
+
+special key
+
+enter "return"
+tab "tab"
+backspace "backspace"
+escape "escape"
+delete "delete"
+home "home"
+end "end"
+page up "prior"
+page down "next"
+insert "insert"
+up "up"
+down "down"
+left "left"
+right "right"
+F1 "F1"
+F2 "F2"
+F3 "F3"
+F4 "F4"
+F5 "F5"
+F6 "F6"
+F7 "F7"
+F8 "F8"
+F9 "F9"
+F10 "F10"
+F11 "F11"
+F12 "F12"
+
+
+
+Alt + ascii character
+
+Alt + Ctrl + space "<Alt><Control> "
+Alt + Ctrl + a "<Alt><Control>a"
+Alt + Ctrl + b "<Alt><Control>b"
+Alt + Ctrl + c "<Alt><Control>c"
+Alt + Ctrl + d "<Alt><Control>d"
+Alt + Ctrl + e "<Alt><Control>e"
+Alt + Ctrl + f "<Alt><Control>f"
+Alt + Ctrl + g "<Alt><Control>g"
+Alt + Ctrl + h "<Alt>backspace"
+Alt + Ctrl + i "<Alt>tab"
+Alt + Ctrl + j "<Alt><Control>j"
+Alt + Ctrl + k "<Alt><Control>k"
+Alt + Ctrl + l "<Alt><Control>l"
+Alt + Ctrl + m "<Alt>return"
+Alt + Ctrl + n "<Alt><Control>n"
+Alt + Ctrl + o "<Alt><Control>o"
+Alt + Ctrl + p "<Alt><Control>p"
+Alt + Ctrl + q "<Alt><Control>q"
+Alt + Ctrl + r "<Alt><Control>r"
+Alt + Ctrl + s "<Alt><Control>s"
+Alt + Ctrl + t "<Alt><Control>t"
+Alt + Ctrl + u "<Alt><Control>u"
+Alt + Ctrl + v "<Alt><Control>v"
+Alt + Ctrl + w "<Alt><Control>w"
+Alt + Ctrl + x "<Alt><Control>x"
+Alt + Ctrl + y "<Alt><Control>y"
+Alt + Ctrl + z "<Alt><Control>z"
+Alt + Ctrl + [ "<Alt>escape"
+Alt + Ctrl + \ "<Alt><Control>\\"
+Alt + Ctrl + ] "<Alt><Control>]"
+Alt + Ctrl + ^ "<Alt><Control>^"
+Alt + Ctrl + _ "<Alt><Control>_"
+Alt + space "<Alt> "
+Alt + ! "<Alt>!"
+Alt + " "<Alt>\""
+Alt + # "<Alt>#"
+Alt + $ "<Alt>$"
+Alt + % "<Alt>%"
+Alt + & "<Alt>&"
+Alt + ' "<Alt>'"
+Alt + ( "<Alt>("
+Alt + ) "<Alt>)"
+Alt + * "<Alt>*"
+Alt + + "<Alt>+"
+Alt + , "<Alt>,"
+Alt + - "<Alt>-"
+Alt + . "<Alt>."
+Alt + / "<Alt>/"
+Alt + 0 "<Alt>0"
+Alt + 1 "<Alt>1"
+Alt + 2 "<Alt>2"
+Alt + 3 "<Alt>3"
+Alt + 4 "<Alt>4"
+Alt + 5 "<Alt>5"
+Alt + 6 "<Alt>6"
+Alt + 7 "<Alt>7"
+Alt + 8 "<Alt>8"
+Alt + 9 "<Alt>9"
+Alt + : "<Alt>:"
+Alt + ; "<Alt>;"
+Alt + < "<Alt><"
+Alt + = "<Alt>="
+Alt + > "<Alt>>"
+Alt + ? "<Alt>?"
+Alt + @ "<Alt>@"
+Alt + A "<Alt>A"
+Alt + B "<Alt>B"
+Alt + C "<Alt>C"
+Alt + D "<Alt>D"
+Alt + E "<Alt>E"
+Alt + F "<Alt>F"
+Alt + G "<Alt>G"
+Alt + H "<Alt>H"
+Alt + I "<Alt>I"
+Alt + J "<Alt>J"
+Alt + K "<Alt>K"
+Alt + L "<Alt>L"
+Alt + M "<Alt>M"
+Alt + N "<Alt>N"
+Alt + O "<Alt>O"
+Alt + P "<Alt>P"
+Alt + Q "<Alt>Q"
+Alt + R "<Alt>R"
+Alt + S "<Alt>S"
+Alt + T "<Alt>T"
+Alt + U "<Alt>U"
+Alt + V "<Alt>V"
+Alt + W "<Alt>W"
+Alt + X "<Alt>X"
+Alt + Y "<Alt>Y"
+Alt + Z "<Alt>Z"
+Alt + [ "<Alt>["
+Alt + \ "<Alt>\\"
+Alt + ] "<Alt>]"
+Alt + ^ "<Alt>^"
+Alt + _ "<Alt>_"
+Alt + ` "<Alt>`"
+Alt + a "<Alt>a"
+Alt + b "<Alt>b"
+Alt + c "<Alt>c"
+Alt + d "<Alt>d"
+Alt + e "<Alt>e"
+Alt + f "<Alt>f"
+Alt + g "<Alt>g"
+Alt + h "<Alt>h"
+Alt + i "<Alt>i"
+Alt + j "<Alt>j"
+Alt + k "<Alt>k"
+Alt + l "<Alt>l"
+Alt + m "<Alt>m"
+Alt + n "<Alt>n"
+Alt + o "<Alt>o"
+Alt + p "<Alt>p"
+Alt + q "<Alt>q"
+Alt + r "<Alt>r"
+Alt + s "<Alt>s"
+Alt + t "<Alt>t"
+Alt + u "<Alt>u"
+Alt + v "<Alt>v"
+Alt + w "<Alt>w"
+Alt + x "<Alt>x"
+Alt + y "<Alt>y"
+Alt + z "<Alt>z"
+Alt + { "<Alt>{"
+Alt + | "<Alt>|"
+Alt + } "<Alt>}"
+Alt + ~ "<Alt>~"
+Alt + DEL "<Alt>delete"
+
+
+
+Alt + special key
+
+Alt + enter "<Alt>return"
+Alt + tab "<Alt>tab"
+Alt + backspace "<Alt>backspace"
+Alt + escape "<Alt>escape"
+Alt + delete "<Alt>delete"
+Alt + home "<Alt>home"
+Alt + end "<Alt>end"
+Alt + page up "<Alt>prior"
+Alt + page down "<Alt>next"
+Alt + insert "<Alt>insert"
+Alt + up "<Alt>up"
+Alt + down "<Alt>down"
+Alt + left "<Alt>left"
+Alt + right "<Alt>right"
+Alt + F1 "<Alt>F1"
+Alt + F2 "<Alt>F2"
+Alt + F3 "<Alt>F3"
+Alt + F4 "<Alt>F4"
+Alt + F5 "<Alt>F5"
+Alt + F6 "<Alt>F6"
+Alt + F7 "<Alt>F7"
+Alt + F8 "<Alt>F8"
+Alt + F9 "<Alt>F9"
+Alt + F10 "<Alt>F10"
+Alt + F11 "<Alt>F11"
+Alt + F12 "<Alt>F12"
Modified: trunk/fep/callbacks.c
===================================================================
--- trunk/fep/callbacks.c 2005-05-11 22:56:48 UTC (rev 838)
+++ trunk/fep/callbacks.c 2005-05-15 05:22:21 UTC (rev 839)
@@ -49,18 +49,15 @@
#ifdef HAVE_ASSERT_H
#include <assert.h>
#endif
+#include <iconv.h>
+#include <uim/uim-util.h>
#include "uim-fep.h"
#include "str.h"
#include "callbacks.h"
static uim_context s_context;
-/* TRUE¤Ê¤é¥«¡¼¥½¥ë°ÌÃÖ¤òȿž¤·¤Ê¤¤ */
-static int s_cursor_no_reverse;
-/* ¥¹¥Æ¡¼¥¿¥¹¥é¥¤¥ó¤ÎÉý */
-static int s_statusline_width;
/* ¥¹¥Æ¡¼¥¿¥¹¥é¥¤¥ó¤ÎºÇÂçÉý */
static int s_max_width;
-
static char *s_commit_str;
static char *s_statusline_str;
static char *s_candidate_str;
@@ -68,6 +65,7 @@
static char *s_index_str;
static struct preedit_tag *s_preedit;
static int s_mode;
+static char *s_nokori_str;
static void start_callbacks(void);
static void end_callbacks(void);
@@ -122,14 +120,12 @@
/*
* ½é´ü²½
*/
-void init_callbacks(uim_context context, int status_type, int cursor_no_reverse, int statusline_width)
+void init_callbacks(uim_context context)
{
s_context = context;
- s_cursor_no_reverse = cursor_no_reverse;
- s_statusline_width = statusline_width;
s_max_width = g_win->ws_col;
- if (s_statusline_width != UNDEFINED && s_statusline_width <= s_max_width) {
- s_max_width = s_statusline_width;
+ if (g_opt.statusline_width != UNDEFINED && g_opt.statusline_width <= s_max_width) {
+ s_max_width = g_opt.statusline_width;
}
s_commit_str = strdup("");
s_candidate_str = strdup("");
@@ -140,9 +136,36 @@
s_preedit = create_preedit();
uim_set_preedit_cb(s_context, clear_cb, pushback_cb, update_cb);
uim_set_mode_cb(s_context, mode_update_cb);
- if (status_type != NONE) {
+ if (g_opt.status_type != NONE) {
uim_set_candidate_selector_cb(s_context, activate_cb, select_cb, shift_page_cb, deactivate_cb);
}
+
+ if (g_opt.ddskk) {
+ iconv_t cd;
+ char *nokori_str = "»Ä¤ê";
+ size_t inbytesleft = strlen("»Ä¤ê");
+ size_t outbytesleft = 6;
+ const char *enc;
+
+ s_nokori_str = malloc(outbytesleft + 1);
+ strcpy(s_nokori_str, "»Ä¤ê");
+ if (strcmp(enc = get_enc(), "EUC-JP") != 0) {
+ cd = uim_iconv_open(enc, "EUC-JP");
+ if (cd == (iconv_t)-1) {
+ perror("error in iconv_open");
+ puts("-d option is not available");
+ done(EXIT_FAILURE);
+ }
+ if (iconv(cd, &nokori_str, &inbytesleft, &s_nokori_str, &outbytesleft) == (size_t)-1) {
+ perror("error in iconv");
+ puts("-d option is not available");
+ done(EXIT_FAILURE);
+ }
+ s_nokori_str[0] = '\0';
+ s_nokori_str -= (6 - outbytesleft);
+ iconv_close(cd);
+ }
+ }
}
int press_key(int key, int key_state)
@@ -394,7 +417,7 @@
/* ¶õʸ»úÎó¤Ï̵»ë */
if (width > 0) {
/* ¥«¡¼¥½¥ë°ÌÃÖ¤Îʸ»ú¤òȿž¤µ¤»¤Ê¤¤ */
- if (s_cursor_no_reverse && cursor && attr & UPreeditAttr_Reverse && s_preedit->cursor != UNDEFINED) {
+ if (g_opt.cursor_no_reverse && cursor && attr & UPreeditAttr_Reverse && s_preedit->cursor != UNDEFINED) {
int *rval = width2byte2(str, 1);
int first_char_byte = rval[0];
int first_char_width = rval[1];
@@ -517,10 +540,10 @@
s_candidate.nr_pages = 0;
for (index = 0; index < s_candidate.nr; index++) {
+ /* A:¹© S:¹ D:¸þ F:¹Í J:¹½ K:ÚÊ L:¸å [»Ä¤ê 227] */
int next = FALSE;
/* "[10/20]" ¤ÎÉý */
- int index_width = strlen("[/]") + numwidth(index + 1) + numwidth(s_candidate.nr);
-
+ int index_width;
uim_candidate cand = uim_get_candidate(s_context, index, index_in_page);
const char *cand_str_label = uim_candidate_get_heading_label(cand);
char *cand_str_cand = tab2space(uim_candidate_get_cand_str(cand));
@@ -528,6 +551,13 @@
int cand_width = cand_label_width + strlen(":") + strwidth(cand_str_cand) + strlen(" ");
int cand_byte = strlen(cand_str_label) + strlen(":") + strlen(cand_str_cand) + strlen(" ");
char *cand_str = malloc(cand_byte + 1);
+
+ if (g_opt.ddskk) {
+ index_width = strlen("[xxxx ]") + numwidth(s_candidate.nr - index - 1);
+ } else {
+ index_width = strlen("[/]") + numwidth(index + 1) + numwidth(s_candidate.nr);
+ }
+
sprintf(cand_str, "%s:%s ", cand_str_label, cand_str_cand);
uim_candidate_free(cand);
free(cand_str_cand);
@@ -541,7 +571,11 @@
if (page_width + cand_width + index_width > s_max_width && index_in_page != 0) {
/* ¤Ï¤ß½Ð¤¿¤Î¤Ç¼¡¤Î¥Ú¡¼¥¸¤Ë°Ü¤¹ */
index--;
- index_width = strlen("[/]") + numwidth(index + 1) + numwidth(s_candidate.nr);
+ if (g_opt.ddskk) {
+ index_width = strlen("[xxxx ]") + numwidth(s_candidate.nr - index - 1);
+ } else {
+ index_width = strlen("[/]") + numwidth(index + 1) + numwidth(s_candidate.nr);
+ }
next = TRUE;
} else {
@@ -598,14 +632,18 @@
if (index_width == UNDEFINED) {
s_candidate.index_col[s_candidate.nr_pages] = UNDEFINED;
} else {
- int index_byte = index_width;
+ int index_byte = index_width + 2/* utf-8 */;
char *index_str = malloc(index_byte + 1);
int i;
- sprintf(index_str, "[%d/%d]", index + 1, s_candidate.nr);
- for (i = 0; i < numwidth(index + 1); i++) {
- index_str[1 + i] = ' ';
+ if (g_opt.ddskk) {
+ sprintf(index_str, "[%s %d]", s_nokori_str, s_candidate.nr - index - 1);
+ } else {
+ sprintf(index_str, "[%d/%d]", index + 1, s_candidate.nr);
+ for (i = 0; i < numwidth(index + 1); i++) {
+ index_str[1 + i] = ' ';
+ }
+ index_str[i] = '-';
}
- index_str[i] = '-';
assert(page_width + index_width <= s_max_width);
s_candidate.index_col[s_candidate.nr_pages] = page_width + strlen("[");
page_byte += index_byte;
@@ -744,8 +782,8 @@
void callbacks_winch(void)
{
s_max_width = g_win->ws_col;
- if (s_statusline_width != UNDEFINED && s_statusline_width <= s_max_width) {
- s_max_width = s_statusline_width;
+ if (g_opt.statusline_width != UNDEFINED && g_opt.statusline_width <= s_max_width) {
+ s_max_width = g_opt.statusline_width;
}
if (s_candidate.nr != UNDEFINED) {
if (s_candidate.page_strs != NULL) {
Modified: trunk/fep/callbacks.h
===================================================================
--- trunk/fep/callbacks.h 2005-05-11 22:56:48 UTC (rev 838)
+++ trunk/fep/callbacks.h 2005-05-15 05:22:21 UTC (rev 839)
@@ -50,7 +50,7 @@
} *pseg;
};
-void init_callbacks(uim_context context, int status_type, int cursor_no_reverse, int statusline_width);
+void init_callbacks(uim_context context);
int press_key(int key, int key_state);
char *get_commit_str(void);
char *get_statusline_str(void);
Modified: trunk/fep/draw.c
===================================================================
--- trunk/fep/draw.c 2005-05-11 22:56:48 UTC (rev 838)
+++ trunk/fep/draw.c 2005-05-15 05:22:21 UTC (rev 839)
@@ -37,6 +37,9 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#ifndef DEBUG
+#define NDEBUG
+#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
@@ -78,8 +81,6 @@
static int s_preedit_lines = 0;
static int s_prev_preedit_lines = 0;
-/* ¥¹¥Æ¡¼¥¿¥¹¥é¥¤¥ó¤Î¼ïÎà */
-static int s_status_type;
/* µ¿»÷üËö¥Þ¥¹¥¿¤Î¥Õ¥¡¥¤¥ëµ½Ò»Ò */
static int s_master;
/* ¥â¡¼¥É¾õÂÖʸ»úÎó */
@@ -92,8 +93,6 @@
static const char *s_path_getmode;
/* üËö¥µ¥¤¥º¤¬ÊÑ´¹¤·¤¿¤È¤TRUE */
static int s_winch = FALSE;
-static int s_on_the_spot = FALSE;
-static int s_no_report_cursor = FALSE;
static void init_backtick(void);
static void update_backtick(void);
@@ -101,8 +100,8 @@
static void end_preedit(void);
static void draw_statusline(int force, int restore, int visible, int draw_background);
static void draw_preedit(struct preedit_tag *preedit, struct preedit_tag *prev_preedit);
-static void draw_subpreedit(struct preedit_tag *p, int start, int end);
static int is_eq_region(void);
+static void draw_subpreedit(struct preedit_tag *p, int start, int end);
static void draw_pseg(struct preedit_segment_tag *pseg, int start_width);
static int compare_preedit(struct preedit_tag *p1, struct preedit_tag *p2);
static int compare_preedit_rev(struct preedit_tag *p1, struct preedit_tag *p2);
@@ -121,15 +120,12 @@
static void print_preedit(struct preedit_tag *p);
#endif
-void init_draw(int on_the_spot, int status_type, int no_report_cursor, int master, const char *path_getmode)
+void init_draw(int master, const char *path_getmode)
{
- s_status_type = status_type;
s_master = master;
s_path_getmode = path_getmode;
s_preedit = create_preedit();
- s_on_the_spot = on_the_spot;
- s_no_report_cursor = no_report_cursor;
- if (s_status_type == BACKTICK) {
+ if (g_opt.status_type == BACKTICK) {
init_backtick();
}
}
@@ -167,7 +163,7 @@
/* üËö¥µ¥¤¥º¤¬Êѹ¹¤µ¤ì¤¿¤È¤¤Ïs_head¤òÊѹ¹¤¹¤ë */
if (s_winch && g_start_preedit) {
- if (s_no_report_cursor) {
+ if (g_opt.no_report_cursor) {
s_preedit->cursor = 0;
} else {
s_head = get_cursor_position();
@@ -189,7 +185,7 @@
s_save_preedit.width = s_save_preedit.cursor = s_save_preedit.nr_psegs = 0;
/* ¥×¥ê¥¨¥Ç¥£¥Ã¥È¤¬Ìµ¤±¤ì¤Ð¥«¡¼¥½¥ë¤òÌ᤹ */
- draw_statusline(FALSE, !g_start_preedit || s_no_report_cursor, FALSE, FALSE);
+ draw_statusline(FALSE, !g_start_preedit || g_opt.no_report_cursor, FALSE, FALSE);
/* ¥³¥ß¥Ã¥È¤µ¤ì¤¿¤« */
if (commit_str[0] != '\0') {
@@ -197,9 +193,9 @@
/* ¥×¥ê¥¨¥Ç¥£¥Ã¥È¤ò¾Ã¤¹É¬Íפ¬¤¢¤ë¤« */
if (prev_preedit->width > 0) {
put_cursor_invisible();
- if (s_no_report_cursor) {
+ if (g_opt.no_report_cursor) {
put_cursor_left(prev_preedit->cursor);
- if (s_on_the_spot) {
+ if (g_opt.on_the_spot) {
put_delete(prev_preedit->width);
} else {
put_erase(prev_preedit->width);
@@ -248,7 +244,7 @@
if (!g_start_preedit) {
debug2(("start_preedit()\n"));
g_start_preedit = TRUE;
- if (s_no_report_cursor) {
+ if (g_opt.no_report_cursor) {
return;
}
@@ -277,7 +273,7 @@
debug2(("end_preedit()\n"));
assert(g_start_preedit);
g_start_preedit = FALSE;
- if (s_no_report_cursor) {
+ if (g_opt.no_report_cursor) {
return;
}
@@ -381,16 +377,10 @@
/* ¸õÊä°ìÍ÷¤ò¾Ãµî */
if (statusline_str[0] == '\0' && prev_statusline_str[0] != '\0') {
- if (s_status_type == LASTLINE) {
- if (restore) {
- put_save_cursor();
- }
- put_cursor_invisible();
- put_goto_lastline(0);
- put_clear_to_end_of_line();
+ if (g_opt.status_type == LASTLINE) {
/* ¸õÊä°ìÍ÷¤ò¾Ã¤·¤¿¸å¤Ï¥â¡¼¥É¤òÉÁ²è¤¹¤ëɬÍפ¬¤¢¤ë */
force = TRUE;
- } else if (s_status_type == BACKTICK) {
+ } else if (g_opt.status_type == BACKTICK) {
s_candbuf[0] = '\0';
}
} else {
@@ -399,7 +389,7 @@
/* ¿·¤·¤¤¸õÊä°ìÍ÷¤Ê¤Î¤ÇÁ°²ó¤Î¸õÊä¤Ï¤Ê¤¤ */
prev_candidate_col = UNDEFINED;
prev_index_col = UNDEFINED;
- if (s_status_type == LASTLINE) {
+ if (g_opt.status_type == LASTLINE) {
if (restore) {
put_save_cursor();
}
@@ -409,52 +399,58 @@
if (candidate_col != UNDEFINED) {
int byte_cand = (width2byte(statusline_str, candidate_col))[0];
int byte_index;
- put_uim_str_no_color_len(statusline_str, UPreeditAttr_None, byte_cand);
- put_uim_str_no_color(candidate_str, UPreeditAttr_Reverse);
+ put_uim_str_len(statusline_str, UPreeditAttr_None, byte_cand);
+ put_uim_str(candidate_str, UPreeditAttr_Reverse);
if (index_col == UNDEFINED) {
- put_uim_str_no_color(statusline_str + byte_cand + strlen(candidate_str), UPreeditAttr_None);
+ put_uim_str(statusline_str + byte_cand + strlen(candidate_str), UPreeditAttr_None);
} else {
- byte_index = (width2byte(statusline_str, index_col))[0];
- put_uim_str_no_color_len(statusline_str + byte_cand + strlen(candidate_str),
- UPreeditAttr_None,
- byte_index - byte_cand - strlen(candidate_str));
- put_uim_str_no_color(index_str, UPreeditAttr_None);
- put_uim_str_no_color(statusline_str + byte_index + strlen(index_str), UPreeditAttr_None);
+ if (g_opt.ddskk) {
+ put_uim_str(statusline_str + byte_cand + strlen(candidate_str), UPreeditAttr_None);
+ } else {
+ byte_index = (width2byte(statusline_str, index_col))[0];
+ put_uim_str_len(statusline_str + byte_cand + strlen(candidate_str),
+ UPreeditAttr_None,
+ byte_index - byte_cand - strlen(candidate_str));
+ put_uim_str(index_str, UPreeditAttr_None);
+ put_uim_str(statusline_str + byte_index + strlen(index_str), UPreeditAttr_None);
+ }
}
} else {
- put_uim_str_no_color(statusline_str, UPreeditAttr_None);
+ put_uim_str(statusline_str, UPreeditAttr_None);
}
statusline_str_width = strwidth(statusline_str);
- if (draw_background || statusline_str_width < prev_statusline_str_width) {
- put_clear_to_end_of_line();
+ if (draw_background) {
+ put_clear_to_end_of_line(g_win->ws_col - statusline_str_width);
+ } else if (statusline_str_width < prev_statusline_str_width) {
+ put_clear_to_end_of_line(prev_statusline_str_width - statusline_str_width);
}
goto end_candidate;
- } else if (s_status_type == BACKTICK) {
+ } else if (g_opt.status_type == BACKTICK) {
strncpy(s_candbuf, statusline_str, CANDSIZE - 1);
}
}
if (prev_candidate_col != candidate_col) {
/* Á°²ó¤Î¸õÊä¤Îȿž¤òÌ᤹ */
if (prev_candidate_col != UNDEFINED) {
- if (s_status_type == LASTLINE) {
+ if (g_opt.status_type == LASTLINE) {
if (restore) {
put_save_cursor();
}
put_cursor_invisible();
put_goto_lastline(prev_candidate_col);
- put_uim_str_no_color(prev_candidate_str, UPreeditAttr_None);
+ put_uim_str(prev_candidate_str, UPreeditAttr_None);
}
}
/* ÁªÂò¤µ¤ì¤¿¸õÊä¤òȿž¤¹¤ë */
if (candidate_col != UNDEFINED) {
- if (s_status_type == LASTLINE) {
+ if (g_opt.status_type == LASTLINE) {
if (restore) {
put_save_cursor();
}
put_cursor_invisible();
put_goto_lastline(candidate_col);
- put_uim_str_no_color(candidate_str, UPreeditAttr_Reverse);
- } else if (s_status_type == BACKTICK) {
+ put_uim_str(candidate_str, UPreeditAttr_Reverse);
+ } else if (g_opt.status_type == BACKTICK) {
int byte;
strncpy(s_candbuf, statusline_str, CANDSIZE - 1);
byte = (width2byte(statusline_str, candidate_col))[0] + strlen(candidate_str);
@@ -468,8 +464,8 @@
}
}
}
- if (index_col != UNDEFINED) {
- if (s_status_type == LASTLINE) {
+ if (index_col != UNDEFINED && !g_opt.ddskk) {
+ if (g_opt.status_type == LASTLINE) {
int i = 0;
if (restore) {
put_save_cursor();
@@ -485,9 +481,9 @@
}
if (i < (int)strlen(index_str)) {
put_goto_lastline(index_col + i);
- put_uim_str_no_color(index_str + i, UPreeditAttr_None);
+ put_uim_str(index_str + i, UPreeditAttr_None);
}
- } else if (s_status_type == BACKTICK) {
+ } else if (g_opt.status_type == BACKTICK) {
memcpy(s_candbuf + (width2byte(statusline_str, index_col))[0], index_str, strlen(index_str));
}
}
@@ -505,21 +501,23 @@
}
}
- if (s_status_type != NONE && statusline_str[0] == '\0') {
+ if (g_opt.status_type != NONE && statusline_str[0] == '\0') {
char *mode_str = get_mode_str();
return_if_fail(mode_str != NULL);
- if (s_status_type == LASTLINE) {
+ if (g_opt.status_type == LASTLINE) {
if (restore) {
put_save_cursor();
}
put_cursor_invisible();
put_goto_lastline(0);
- put_uim_str_no_color(mode_str, UPreeditAttr_None);
+ put_uim_str(mode_str, UPreeditAttr_None);
statusline_str_width = strwidth(mode_str);
- if (draw_background || prev_statusline_str_width > statusline_str_width) {
- put_clear_to_end_of_line();
+ if (draw_background) {
+ put_clear_to_end_of_line(g_win->ws_col - statusline_str_width);
+ } else if (statusline_str_width < prev_statusline_str_width) {
+ put_clear_to_end_of_line(prev_statusline_str_width - statusline_str_width);
}
- } else if (s_status_type == BACKTICK) {
+ } else if (g_opt.status_type == BACKTICK) {
strncpy(s_modebuf, mode_str, MODESIZE - 1);
}
free(mode_str);
@@ -531,7 +529,7 @@
if (restore) {
put_restore_cursor();
}
- if (s_status_type == BACKTICK) {
+ if (g_opt.status_type == BACKTICK) {
update_backtick();
}
if (visible) {
@@ -550,21 +548,11 @@
}
/*
- * ¥¹¥Æ¡¼¥¿¥¹¥é¥¤¥ó¤Î¥â¡¼¥Éɽ¼¨¤òmode¤Ë¤¹¤ë
- * ¥«¡¼¥½¥ë¤ÏºÇ²¼¹Ô¤Ë°ÜÆ°¤¹¤ë
- */
-void draw_statusline_no_restore(void)
-{
- draw_statusline(FALSE, FALSE, FALSE, TRUE);
-}
-
-/*
* ºÇ²¼¹Ô¤òºÆÉÁ²è¤¹¤ë
* ¥«¡¼¥½¥ë¤ÏºÇ²¼¹Ô¤Ë°ÜÆ°¤¹¤ë
*/
void draw_statusline_force_no_restore(void)
{
- assert(s_status_type == LASTLINE);
draw_statusline(TRUE, FALSE, FALSE, TRUE);
}
@@ -574,7 +562,6 @@
*/
void draw_statusline_force_restore(void)
{
- assert(s_status_type == LASTLINE);
draw_statusline(TRUE, TRUE, TRUE, TRUE);
}
@@ -584,9 +571,9 @@
*/
void clear_lastline(void)
{
- assert(s_status_type == LASTLINE);
+ assert(g_opt.status_type == LASTLINE);
put_goto_lastline(0);
- put_clear_to_end_of_line();
+ put_clear_to_end_of_line(g_win->ws_col);
}
/*
@@ -594,7 +581,7 @@
*/
void clear_backtick(void)
{
- assert(s_status_type == BACKTICK);
+ assert(g_opt.status_type == BACKTICK);
sendline("");
}
@@ -627,7 +614,7 @@
/* preedit == prev_preedit¤Î¤È¤¤Ï¡¢¥«¡¼¥½¥ë¤Î°ÜÆ°¤À¤± */
if (eq_width == preedit->width && eq_width == prev_preedit->width && eq_width > 0) {
- if (s_no_report_cursor) {
+ if (g_opt.no_report_cursor) {
put_move_cur(prev_preedit->cursor, preedit->cursor);
} else {
goto_char(preedit->cursor);
@@ -635,23 +622,23 @@
return;
}
- if (!s_no_report_cursor) {
+ if (!g_opt.no_report_cursor) {
set_line2width(preedit);
}
/* ½ÐÎϤ¹¤ë°ÌÃ֤˰ÜÆ° */
- if (s_no_report_cursor) {
+ if (g_opt.no_report_cursor) {
put_move_cur(prev_preedit->cursor, eq_width);
} else {
goto_col(eq_width);
}
/* Îΰ褬ÊѤï¤Ã¤Æ¤¤¤Ê¤¤¤Î¤ÇÊѹ¹Éôʬ¤À¤±¾å½ñ¤ */
- if ((s_no_report_cursor && preedit->width == prev_preedit->width) || (!s_no_report_cursor && is_eq_region())) {
+ if ((g_opt.no_report_cursor && preedit->width == prev_preedit->width) || (!g_opt.no_report_cursor && is_eq_region())) {
int eq_width_rev = compare_preedit_rev(preedit, prev_preedit);
debug2(("eq_width_rev = %d\n", eq_width_rev));
draw_subpreedit(preedit, eq_width, preedit->width - eq_width_rev);
- if (s_no_report_cursor) {
+ if (g_opt.no_report_cursor) {
put_move_cur(preedit->width - eq_width_rev, preedit->cursor);
} else {
goto_char(preedit->cursor);
@@ -659,16 +646,16 @@
return;
}
- if (s_no_report_cursor && s_on_the_spot && preedit->width > prev_preedit->width) {
+ if (g_opt.no_report_cursor && g_opt.on_the_spot && preedit->width > prev_preedit->width) {
put_insert(preedit->width - prev_preedit->width);
}
draw_subpreedit(preedit, eq_width, preedit->width);
- if (s_no_report_cursor) {
+ if (g_opt.no_report_cursor) {
if (preedit->width > prev_preedit->width) {
put_cursor_left(preedit->width - preedit->cursor);
} else {
- if (s_on_the_spot) {
+ if (g_opt.on_the_spot) {
put_delete(prev_preedit->width - preedit->width);
put_cursor_left(preedit->width - preedit->cursor);
} else {
@@ -739,7 +726,7 @@
char *seg_str = p->pseg[i].str;
int seg_w = strwidth(seg_str);
if (w + seg_w <= width) {
- if (s_no_report_cursor) {
+ if (g_opt.no_report_cursor) {
put_uim_str(seg_str, p->pseg[i].attr);
} else {
draw_pseg(&(p->pseg[i]), start + w);
@@ -753,7 +740,7 @@
int byte = byte_width[0];
int save_char = seg_str[byte];
seg_str[byte] = '\0';
- if (s_no_report_cursor) {
+ if (g_opt.no_report_cursor) {
put_uim_str(seg_str, p->pseg[i].attr);
} else {
draw_pseg(&(p->pseg[i]), start + w);
@@ -785,7 +772,7 @@
int byte;
int width;
- if (s_on_the_spot && s_line2width[lineno] > s_prev_line2width[lineno]) {
+ if (g_opt.on_the_spot && s_line2width[lineno] > s_prev_line2width[lineno]) {
int margin2 = margin - g_win->ws_col - s_prev_line2width[lineno];
if (seg_w >= margin2) {
byte_width = width2byte(seg_str, margin2);
@@ -821,7 +808,7 @@
/* ±¦Ã¼¤Îʸ»ú¤ò¾Ã¤¹É¬Íפ¬¤¢¤ë¤« */
if (s_line2width[lineno] < s_prev_line2width[lineno]) {
- if (s_on_the_spot) {
+ if (g_opt.on_the_spot) {
put_delete(s_prev_line2width[lineno] - s_line2width[lineno]);
} else {
put_erase(s_prev_line2width[lineno] - s_line2width[lineno]);
@@ -903,10 +890,10 @@
{
int lineno;
for (lineno = 0; lineno < s_preedit_lines; lineno++) {
- assert(!s_on_the_spot || s_line2width[lineno] <= s_prev_line2width[lineno]);
+ assert(!g_opt.on_the_spot || s_line2width[lineno] <= s_prev_line2width[lineno]);
if (s_prev_line2width[lineno] > s_line2width[lineno]) {
put_cursor_address(s_head.row + lineno, s_line2width[lineno]);
- if (s_on_the_spot) {
+ if (g_opt.on_the_spot) {
put_delete(s_prev_line2width[lineno] - s_line2width[lineno]);
} else {
put_erase(s_prev_line2width[lineno] - s_line2width[lineno]);
@@ -916,7 +903,7 @@
for (; lineno < s_prev_preedit_lines; lineno++) {
if (s_prev_line2width[lineno] > 0) {
put_cursor_address(s_head.row + lineno, 0);
- if (s_on_the_spot) {
+ if (g_opt.on_the_spot) {
put_delete(s_prev_line2width[lineno]);
} else {
put_erase(s_prev_line2width[lineno]);
Modified: trunk/fep/draw.h
===================================================================
--- trunk/fep/draw.h 2005-05-11 22:56:48 UTC (rev 838)
+++ trunk/fep/draw.h 2005-05-15 05:22:21 UTC (rev 839)
@@ -44,10 +44,9 @@
extern int g_start_preedit;
extern int g_commit;
-void init_draw(int on_the_spot, int status_type, int gnu_screen, int master, const char *path_getmode);
+void init_draw(int master, const char *path_getmode);
void draw(void);
void draw_statusline_restore(void);
-void draw_statusline_no_restore(void);
void draw_statusline_force_no_restore(void);
void draw_statusline_force_restore(void);
void clear_lastline(void);
Modified: trunk/fep/escseq.c
===================================================================
--- trunk/fep/escseq.c 2005-05-11 22:56:48 UTC (rev 838)
+++ trunk/fep/escseq.c 2005-05-15 05:22:21 UTC (rev 839)
@@ -41,6 +41,9 @@
#ifdef HAVE_CURSES_H
#include <curses.h>
#endif
+#ifdef HAVE_NCURSES_TERM_H
+#include <ncurses/term.h>
+#endif
#ifdef HAVE_TERM_H
#include <term.h>
#endif
@@ -68,12 +71,7 @@
#define my_putp(str) tputs(str, 1, my_putchar);
-/* ¥«¡¼¥½¥ë¤ò¾Ã¤¹¤« */
-static int s_use_civis = FALSE;
-/* ¥¹¥Æ¡¼¥¿¥¹¥é¥¤¥ó¤Î¼ïÎà */
-static int s_status_type;
-/* GNU screen ¥â¡¼¥É¤« */
-static int s_no_report_cursor;
+
/* ½é´ü²½¤·¤¿¤éTRUE */
static int s_init = FALSE;
/* ¸½ºß¤Î¥«¡¼¥½¥ë°ÌÃÖ */
@@ -141,30 +139,49 @@
FALSE /* background */
};
-static void fixtty(void);
+static void check_escseq(void);
static char *escseq2n(const char *escseq);
static void escseq2n2(const char *escseq, const char **first, const char **second);
+static void fixtty(void);
+#ifndef HAVE_CFMAKERAW
+static int cfmakeraw(struct termios *termios_p);
+#endif
+static void change_background_attr(struct attribute_tag *from, struct attribute_tag to);
static const char *attr2escseq(const struct attribute_tag *attr);
static void set_attr(const char *str, int len);
static int my_putchar(int c);
-#ifndef HAVE_CFMAKERAW
-static int cfmakeraw(struct termios *termios_p);
-#endif
#if defined(DEBUG) && DEBUG > 1
static void print_attr(struct attribute_tag *attr);
#endif
+void init_escseq(const struct attribute_tag *attr_uim)
+{
+ s_attr_uim = *attr_uim;
+
+ s_enter_underline_num = escseq2n(enter_underline_mode);
+ s_exit_underline_num = escseq2n(exit_underline_mode);
+ s_enter_standout_num = escseq2n(enter_standout_mode);
+ s_exit_standout_num = escseq2n(exit_standout_mode);
+ s_bold_num = escseq2n(enter_bold_mode);
+ s_blink_num = escseq2n(enter_blink_mode);
+ s_orig_pair_num = escseq2n(orig_pair);
+ escseq2n2(orig_pair, &s_orig_fore_num, &s_orig_back_num);
+ s_enter_uim_mode = attr2escseq(&s_attr_uim);
+ if (s_enter_uim_mode != NULL) {
+ s_enter_uim_mode = strdup(s_enter_uim_mode);
+ }
+
+ fixtty();
+ check_escseq();
+ s_init = TRUE;
+}
+
/*
* termcap/terminfo¤Î¥¨¥ó¥È¥ê¤¬¤¢¤ë¤«³Îǧ¤¹¤ë
*/
-void init_escseq(int use_civis, int use_ins_del, int status_type, int no_report_cursor, const struct attribute_tag *attr_uim)
+static void check_escseq(void)
{
- s_use_civis = use_civis;
- s_status_type = status_type;
- s_attr_uim = *attr_uim;
- s_no_report_cursor = no_report_cursor;
-
if (enter_underline_mode == NULL) {
printf("enter_underline_mode is not available\n");
done(EXIT_FAILURE);
@@ -193,12 +210,12 @@
printf("cursor_address is not available\n");
done(EXIT_FAILURE);
}
- if (s_status_type == LASTLINE) {
+ if (g_opt.status_type == LASTLINE) {
if (change_scroll_region == NULL) {
printf("change_scroll_region is not available\n");
done(EXIT_FAILURE);
}
- if (s_no_report_cursor) {
+ if (g_opt.no_report_cursor) {
if (save_cursor == NULL) {
printf("save_cursor is not available.\n");
done(EXIT_FAILURE);
@@ -213,7 +230,7 @@
}
}
}
- if (s_no_report_cursor) {
+ if (g_opt.no_report_cursor) {
if (cursor_left == NULL) {
printf("cursor_left is not available\n");
done(EXIT_FAILURE);
@@ -223,7 +240,7 @@
done(EXIT_FAILURE);
}
}
- if (use_ins_del) {
+ if (g_opt.on_the_spot) {
if (parm_ich == NULL) {
printf("parm_ich is not available\n");
done(EXIT_FAILURE);
@@ -233,20 +250,6 @@
done(EXIT_FAILURE);
}
}
- s_enter_underline_num = escseq2n(enter_underline_mode);
- s_exit_underline_num = escseq2n(exit_underline_mode);
- s_enter_standout_num = escseq2n(enter_standout_mode);
- s_exit_standout_num = escseq2n(exit_standout_mode);
- s_bold_num = escseq2n(enter_bold_mode);
- s_blink_num = escseq2n(enter_blink_mode);
- s_orig_pair_num = escseq2n(orig_pair);
- escseq2n2(orig_pair, &s_orig_fore_num, &s_orig_back_num);
- s_enter_uim_mode = attr2escseq(&s_attr_uim);
- if (s_enter_uim_mode != NULL) {
- s_enter_uim_mode = strdup(s_enter_uim_mode);
- }
- fixtty();
- s_init = TRUE;
}
/*
@@ -325,7 +328,7 @@
return;
}
put_exit_attribute_mode();
- if (s_status_type == LASTLINE) {
+ if (g_opt.status_type == LASTLINE) {
put_save_cursor();
put_change_scroll_region(0, g_win->ws_row);
put_goto_lastline(0);
@@ -354,8 +357,16 @@
tios.c_cc[VTIME] = 3;
tcsetattr(g_win_in, TCSANOW, &tios);
- if (s_no_report_cursor) {
- if (s_status_type == LASTLINE) {
+ if (!g_opt.no_report_cursor) {
+ /* ³«»Ï°ÌÃÖ¤òÊݸ */
+ start_cursor = get_cursor_position();
+ if (start_cursor.row == UNDEFINED) {
+ g_opt.no_report_cursor = TRUE;
+ }
+ }
+
+ if (g_opt.no_report_cursor) {
+ if (g_opt.status_type == LASTLINE) {
put_cursor_invisible();
put_crlf();
my_putp(cursor_up);
@@ -364,20 +375,13 @@
put_restore_cursor();
put_cursor_normal();
}
- draw_statusline_restore();
+ draw_statusline_force_restore();
return;
}
- /* ³«»Ï°ÌÃÖ¤òÊݸ */
- start_cursor = get_cursor_position();
- if (start_cursor.row == UNDEFINED) {
- printf("Report Cursor Position is not available\r\n");
- printf("Please try to use with -D option\r\n");
- done(EXIT_FAILURE);
- }
put_cursor_invisible();
/* ºÇ²¼¹Ô¤«¤é³«»Ï¤·¤¿¤È¤¤Î¤¿¤á¤Ë¥¹¥¯¥í¡¼¥ë */
- if (s_status_type == LASTLINE) {
+ if (g_opt.status_type == LASTLINE) {
write(g_win_out, "\n", strlen("\n"));
}
/* °ÂÁ´¤Ê°ÌÃ֤˰ÜÆ° */
@@ -396,10 +400,10 @@
s_cursor_diff.col = cursor2.col - cursor.col;
start_cursor.row -= s_cursor_diff.row;
start_cursor.col -= s_cursor_diff.col;
- if (s_status_type == LASTLINE) {
+ if (g_opt.status_type == LASTLINE) {
put_change_scroll_region(0, g_win->ws_row - 1);
}
- draw_statusline_no_restore();
+ draw_statusline_force_no_restore();
/* ³«»Ï°ÌÃÖ¤ËÌá¤ë */
put_cursor_address_p(&start_cursor);
put_cursor_normal();
@@ -452,7 +456,7 @@
if (!s_save) {
s_save = TRUE;
debug(("<put_save_cursor>"));
- if (s_no_report_cursor) {
+ if (g_opt.no_report_cursor) {
my_putp(save_cursor);
s_save_cursor = s_cursor;
} else {
@@ -469,7 +473,7 @@
if (s_save) {
s_save = FALSE;
debug(("<put_restore_cursor>"));
- if (s_no_report_cursor) {
+ if (g_opt.no_report_cursor) {
my_putp(restore_cursor);
/* DOS¥×¥í¥ó¥×¥È¤Ç¤Ï1²ó¤Îrestore_cursor¤Ç¤ÏÌá¤é¤Ê¤¤ */
my_putp(restore_cursor);
@@ -489,10 +493,10 @@
{
char ibuf[BUFSIZ];
ssize_t len = 0;
+ ssize_t read_len = 0;
char *escseq = ibuf - 1;
- int loop_count;
- assert(!s_no_report_cursor);
+ assert(!g_opt.no_report_cursor);
if (s_cursor.row != UNDEFINED) {
return s_cursor;
@@ -500,9 +504,12 @@
write(g_win_out, "\033[6n", strlen("\033[6n"));
- for (loop_count = 0; loop_count < 10; loop_count++) {
+ while (TRUE) {
char *next_escseq;
- len += read_stdin(ibuf + len, sizeof(ibuf) - len);
+ len += (read_len = read_stdin(ibuf + len, sizeof(ibuf) - len));
+ if (read_len == 0) {
+ break;
+ }
ibuf[len] = '\0';
debug2(("get = \""));
@@ -556,7 +563,7 @@
*/
void put_cursor_invisible(void)
{
- if (s_use_civis && !s_cursor_invisible && cursor_invisible != NULL && cursor_normal != NULL) {
+ if (g_opt.use_civis && !s_cursor_invisible && cursor_invisible != NULL && cursor_normal != NULL) {
s_cursor_invisible = TRUE;
my_putp(cursor_invisible);
debug(("<invis>"));
@@ -593,12 +600,12 @@
{
const char *escseq;
- if ( (from->underline && !to->underline)
- || (from->standout && !to->standout)
- || (from->bold && !to->bold)
- || (from->blink && !to->blink)
- || (from->foreground != FALSE && to->foreground == FALSE)
- || (from->background != FALSE && to->background == FALSE)
+ if ( (from->underline && !to->underline )
+ || (from->standout && !to->standout )
+ || (from->bold && !to->bold )
+ || (from->blink && !to->blink )
+ || (from->foreground != FALSE && to->foreground == FALSE)
+ || (from->background != FALSE && to->background == FALSE)
) {
put_exit_attribute_mode();
escseq = attr2escseq(to);
@@ -632,6 +639,23 @@
}
/*
+ * ÇØ·Ê°À¤òfrom¤«¤éto¤ËÊѹ¹¤·¡¢from <= to
+ * ʸ»ú¿§¤ÏÊѤï¤é¤Ê¤¤¤«¤â¤·¤ì¤Ê¤¤
+ */
+static void change_background_attr(struct attribute_tag *from, struct attribute_tag to)
+{
+ if (!( (from->underline && !to.underline )
+ || (from->standout && !to.standout )
+ || (from->blink && !to.blink )
+ || (from->background != FALSE && to.background == FALSE)
+ )) {
+ to.bold = from->bold;
+ to.foreground = from->foreground;
+ }
+ change_attr(from, &to);
+}
+
+/*
* attr¤ËÂбþ¤¹¤ë¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹¤òÊÖ¤¹
* ÊÖ¤êÃͤÏÀÅŪ¤Ê¥Ð¥Ã¥Õ¥¡
*/
@@ -858,12 +882,9 @@
}
if (back_color_erase) {
- struct attribute_tag no_background_attr = s_attr_none;
- if (!(s_attr.underline || s_attr.standout || s_attr.blink || s_attr.background)) {
- no_background_attr.bold = s_attr.bold;
- no_background_attr.foreground = s_attr.foreground;
- }
- change_attr(&s_attr, &no_background_attr);
+ s_attr_uim.standout = FALSE;
+ s_attr_uim.underline = FALSE;
+ change_background_attr(&s_attr, s_attr_uim);
}
tmp = tparm(parm_dch, n);
@@ -921,8 +942,19 @@
}
spaces[n] = '\0';
- put_uim_str(spaces, UPreeditAttr_None);
+ if (s_escseq_buf != NULL) {
+ free(s_escseq_buf);
+ s_escseq_buf = NULL;
+ }
+ s_attr_uim.standout = FALSE;
+ s_attr_uim.underline = FALSE;
+ change_background_attr(&s_attr, s_attr_uim);
+
+ s_cursor.col += n;
+ assert(s_cursor.col <= g_win->ws_col || g_opt.no_report_cursor);
+ write(g_win_out, spaces, n);
+
free(spaces);
debug(("<put erase %d>", n));
}
@@ -931,15 +963,16 @@
* underline¥â¡¼¥É¤Èstandout¥â¡¼¥É¤ò½ªÎ»¤·¤Æ¹ÔËö¤Þ¤Ç¾Ãµî
* ¥«¡¼¥½¥ë°ÌÃÖ¤ÏÊѤï¤é¤Ê¤¤
*/
-void put_clear_to_end_of_line(void)
+void put_clear_to_end_of_line(int width)
{
+ if (s_attr_uim.background != FALSE && !back_color_erase) {
+ put_erase(width);
+ return;
+ }
if (back_color_erase) {
- struct attribute_tag no_background_attr = s_attr_none;
- if (!(s_attr.underline || s_attr.standout || s_attr.blink || s_attr.background)) {
- no_background_attr.bold = s_attr.bold;
- no_background_attr.foreground = s_attr.foreground;
- }
- change_attr(&s_attr, &no_background_attr);
+ s_attr_uim.standout = FALSE;
+ s_attr_uim.underline = FALSE;
+ change_background_attr(&s_attr, s_attr_uim);
}
my_putp(clr_eol);
debug(("<clear>"));
@@ -977,7 +1010,7 @@
change_attr(&s_attr, &s_attr_uim);
s_cursor.col += strwidth(str);
- assert(s_cursor.col <= g_win->ws_col || s_no_report_cursor);
+ assert(s_cursor.col <= g_win->ws_col || g_opt.no_report_cursor);
write(g_win_out, str, strlen(str));
debug(("<put_uim_str \"%s\">", str));
}
Modified: trunk/fep/escseq.h
===================================================================
--- trunk/fep/escseq.h 2005-05-11 22:56:48 UTC (rev 838)
+++ trunk/fep/escseq.h 2005-05-15 05:22:21 UTC (rev 839)
@@ -49,7 +49,7 @@
};
-void init_escseq(int use_civis, int use_ins_del, int status_type, int gnu_screen, const struct attribute_tag *attr_uim);
+void init_escseq(const struct attribute_tag *attr_uim);
void quit_escseq(void);
struct point_tag get_cursor_position(void);
void put_move_cur(int from, int to);
@@ -67,7 +67,7 @@
void put_crlf(void);
void put_goto_lastline(int col);
void put_erase(int n);
-void put_clear_to_end_of_line(void);
+void put_clear_to_end_of_line(int width);
void put_change_scroll_region(int start, int end);
void put_uim_str(const char *str, int attr);
void put_uim_str_len(const char *str, int attr, int len);
Modified: trunk/fep/key.c
===================================================================
--- trunk/fep/key.c 2005-05-11 22:56:48 UTC (rev 838)
+++ trunk/fep/key.c 2005-05-15 05:22:21 UTC (rev 839)
@@ -43,6 +43,9 @@
#ifdef HAVE_CURSES_H
#include <curses.h>
#endif
+#ifdef HAVE_NCURSES_TERM_H
+#include <ncurses/term.h>
+#endif
#ifdef HAVE_TERM_H
#include <term.h>
#endif
@@ -64,6 +67,23 @@
int tty2key(char key)
{
+ switch (key) {
+ /* c-space */
+ case 0:
+ return ' ';
+ case '\b':
+ return UKey_Backspace;
+ case '\t':
+ return UKey_Tab;
+ case '\r':
+ return UKey_Return;
+ /* c-[ */
+ case ESCAPE_CODE:
+ return UKey_Escape;
+ /* c-? */
+ case 0x7f:
+ return UKey_Delete;
+ }
/* c-a ¤«¤é c-z */
if (key >= 1 && key <= 26) {
return key + ('a' - 1);
@@ -72,27 +92,23 @@
if (key >= 28 && key <= 31) {
return key + ('A' - 1);
}
- switch (key) {
- /* c-space */
- case 0:
- return ' ';
- /* c-? */
- case 0x7f:
- return UKey_Delete;
- /* c-[ */
- case ESCAPE_CODE:
- return UKey_Escape;
- }
return key;
}
int tty2key_state(char key)
{
int key_state = 0;
+ if (key == '\b' ||
+ key == '\t' ||
+ key == '\r' ||
+ key == ESCAPE_CODE ||
+ key == 0x7f) {
+ return 0;
+ }
if (key >= 'A' && key <= 'Z') {
key_state += UMod_Shift;
}
- if (key >= 0 && key <= 31 && key != ESCAPE_CODE) {
+ if (key >= 0 && key <= 31) {
key_state += UMod_Control;
}
return key_state;
@@ -134,6 +150,8 @@
rval[0] = UKey_Home;
} else if (key_end != NULL && (len = strcmp_prefix(str, key_end)) > 0) {
rval[0] = UKey_End;
+ } else if (key_ic != NULL && (len = strcmp_prefix(str, key_ic)) > 0) {
+ rval[0] = UKey_Insert;
} else if (key_f1 != NULL && (len = strcmp_prefix(str, key_f1)) > 0) {
rval[0] = UKey_F1;
} else if (key_f2 != NULL && (len = strcmp_prefix(str, key_f2)) > 0) {
Modified: trunk/fep/str.c
===================================================================
--- trunk/fep/str.c 2005-05-11 22:56:48 UTC (rev 838)
+++ trunk/fep/str.c 2005-05-15 05:22:21 UTC (rev 839)
@@ -81,6 +81,9 @@
*/
const char *get_enc(void)
{
+#ifdef __CYGWIN32__
+ return "EUC-JP";
+#else
const char *locale = setlocale(LC_CTYPE, NULL);
assert(locale != NULL);
@@ -91,6 +94,7 @@
return ptr != NULL ? ptr + 1 : "UTF-8";
}
return "UTF-8";
+#endif
}
/*
@@ -147,7 +151,7 @@
* strwidth("¤¢a") = 3
* strwidth("") = 0
*/
-#ifdef HAVE_WCSWIDTH
+#if defined(HAVE_WCSWIDTH) && !defined(__CYGWIN32__)
int strwidth(const char *str)
{
int width;
@@ -209,7 +213,7 @@
* const char *str¤È¤Ê¤Ã¤Æ¤¤¤ë¤¬¡¤°ì»þŪ¤Ë½ñ´¹¤¨¤ë¤Î¤Çstr¤òʸ»úÎóÄê¿ô
* ¤Ë¤·¤Æ¤Ï¤¤¤±¤Ê¤¤¡¥
*/
-#ifdef HAVE_WCSWIDTH
+#if defined(HAVE_WCSWIDTH) && !defined(__CYGWIN32__)
int byte2width(const char *str, int n)
{
int width;
@@ -310,7 +314,7 @@
* const char *str¤È¤Ê¤Ã¤Æ¤¤¤ë¤¬¡¤°ì»þŪ¤Ë½ñ´¹¤¨¤ë¤Î¤Çstr¤òʸ»úÎóÄê¿ô
* ¤Ë¤·¤Æ¤Ï¤¤¤±¤Ê¤¤¡¥
*/
-#ifdef HAVE_WCSWIDTH
+#if defined(HAVE_WCSWIDTH) && !defined(__CYGWIN32__)
int byte2width2(const char *str, int n)
{
int width;
@@ -408,7 +412,7 @@
* width2byte("¤¢¤¢", 3) = [3, 2] (utf8)
* width2byte("¤¢¤¢", 4) = [6, 4] (utf8)
*/
-#ifdef HAVE_WCSWIDTH
+#if defined(HAVE_WCSWIDTH) && !defined(__CYGWIN32__)
int *width2byte(const char *str, int n)
{
int width = 0;
@@ -506,7 +510,7 @@
* width2byte2("¤¢¤¢", 1) = [3, 2] (utf8)
* width2byte2("¤¢¤¢", 4) = [6, 4] (utf8)
*/
-#ifdef HAVE_WCSWIDTH
+#if defined(HAVE_WCSWIDTH) && !defined(__CYGWIN32__)
int *width2byte2(const char *str, int n)
{
int width = 0;
Modified: trunk/fep/uim-fep.c
===================================================================
--- trunk/fep/uim-fep.c 2005-05-11 22:56:48 UTC (rev 838)
+++ trunk/fep/uim-fep.c 2005-05-15 05:22:21 UTC (rev 839)
@@ -63,6 +63,9 @@
#ifdef HAVE_CURSES_H
#include <curses.h>
#endif
+#ifdef HAVE_NCURSES_TERM_H
+#include <ncurses/term.h>
+#endif
#ifdef HAVE_TERM_H
#include <term.h>
#endif
@@ -113,18 +116,26 @@
#include "key.h"
#include "read.h"
+#define DEFAULT_STATUS LASTLINE
+
/* global variables */
+struct opt_tag g_opt = {
+ DEFAULT_STATUS, /* status_type */
+ FALSE, /* ddskk */
+ FALSE, /* cursor_no_reverse */
+ FALSE, /* use_civis */
+ FALSE, /* on_the_spot */
+ UNDEFINED, /* statusline_width */
+ 0, /* timeout */
+ FALSE /* no_report_cursor */
+};
+int g_win_in = STDIN_FILENO;
+int g_win_out = STDOUT_FILENO;
struct winsize *g_win;
-#define DEFAULT_STATUS LASTLINE
-#define DEFAULT_BACKTICK_WIDTH 70
static uim_context s_context;
-/* ¥¹¥Æ¡¼¥¿¥¹¥é¥¤¥ó¤Î¼ïÎà */
-static int s_status_type = DEFAULT_STATUS;
/* µ¿»÷üËö¤Îmaster¤Î¥Õ¥¡¥¤¥ëµ½Ò»Ò */
static int s_master;
-int g_win_in = STDIN_FILENO;
-int g_win_out = STDOUT_FILENO;
/* µ¯Æ°»þ¤ÎüËö¾õÂÖ */
static struct termios s_save_tios;
#ifndef MAXPATHLEN
@@ -133,7 +144,6 @@
static char s_path_setmode[MAXPATHLEN];
static char s_path_getmode[MAXPATHLEN];
static int s_setmode_fd = -1;
-static int s_timeout = 0;
static void init_agent(const char *engine);
static const char *get_default_im_name(void);
@@ -201,12 +211,7 @@
const char *engine;
char *sock_path = NULL; /* Socket for backtick */
pid_t child;
- int use_civis = FALSE;
- int cursor_no_reverse = FALSE;
- int statusline_width = UNDEFINED;
- int on_the_spot = FALSE;
int gnu_screen = FALSE;
- int no_report_cursor = FALSE;
char *env_buf;
struct attribute_tag attr_uim = {
FALSE, /* underline */
@@ -236,7 +241,7 @@
init_str();
engine = get_default_im_name();
- while ((op = getopt(argc, argv, "e:s:u:b:w:t:C:ScioDvh")) != -1) {
+ while ((op = getopt(argc, argv, "e:s:u:b:w:t:C:Sciodvh")) != -1) {
int i;
switch (op) {
case 'e':
@@ -251,13 +256,13 @@
case 's':
if (strncmp(optarg, "none", strlen(optarg)) == 0) {
- s_status_type = NONE;
+ g_opt.status_type = NONE;
}
else if (strncmp(optarg, "backtick", strlen(optarg)) == 0) {
- s_status_type = BACKTICK;
+ g_opt.status_type = BACKTICK;
}
else if (strncmp(optarg, "lastline", strlen(optarg)) == 0) {
- s_status_type = LASTLINE;
+ g_opt.status_type = LASTLINE;
}
else {
usage();
@@ -267,11 +272,11 @@
case 'S':
gnu_screen = TRUE;
- no_report_cursor = TRUE;
+ g_opt.no_report_cursor = TRUE;
break;
- case 'D':
- no_report_cursor = TRUE;
+ case 'd':
+ g_opt.ddskk = TRUE;
break;
case 'u':
@@ -279,15 +284,15 @@
break;
case 'c':
- cursor_no_reverse = TRUE;
+ g_opt.cursor_no_reverse = TRUE;
break;
case 'i':
- use_civis = TRUE;
+ g_opt.use_civis = TRUE;
break;
case 'o':
- on_the_spot = TRUE;
+ g_opt.on_the_spot = TRUE;
break;
case 'b':
@@ -295,16 +300,16 @@
break;
case 'w':
- statusline_width = atoi(optarg);
- if (statusline_width <= 0) {
+ g_opt.statusline_width = atoi(optarg);
+ if (g_opt.statusline_width <= 0) {
usage();
return EXIT_FAILURE;
}
break;
case 't':
- s_timeout = atof(optarg) * 1000000;
- if (s_timeout <= 0) {
+ g_opt.timeout = atof(optarg) * 1000000;
+ if (g_opt.timeout <= 0) {
usage();
return EXIT_FAILURE;
}
@@ -345,7 +350,7 @@
}
if (gnu_screen) {
- s_status_type = BACKTICK;
+ g_opt.status_type = BACKTICK;
s_master = PROC_FILENO;
g_win_in = WIN_IN_FILENO;
g_win_out = WIN_OUT_FILENO;
@@ -421,24 +426,27 @@
free(command);
- if (s_status_type == BACKTICK && statusline_width > CANDSIZE / 2) {
- statusline_width = CANDSIZE / 2;
+ if (g_opt.status_type == BACKTICK && g_opt.statusline_width > CANDSIZE / 2) {
+ g_opt.statusline_width = CANDSIZE / 2;
}
- if (s_status_type == BACKTICK) {
+ if (g_opt.status_type == BACKTICK) {
init_sendsocket(sock_path);
}
init_agent(engine);
if (gnu_screen) {
uim_set_mode(s_context, 1);
}
- init_callbacks(s_context, s_status_type, cursor_no_reverse, statusline_width);
- init_draw(on_the_spot, s_status_type, no_report_cursor, s_master, s_path_getmode);
- init_escseq(use_civis, on_the_spot, s_status_type, no_report_cursor, &attr_uim);
+ init_callbacks(s_context);
+ init_draw(s_master, s_path_getmode);
+ init_escseq(&attr_uim);
set_signal_handler();
if (s_path_setmode[0] != '\0' && mkfifo(s_path_setmode, 0600) != -1) {
s_setmode_fd = open(s_path_setmode, O_RDONLY | O_NONBLOCK);
+#ifndef __CYGWIN32__
+ open(s_path_setmode, O_WRONLY);
+#endif
} else {
s_path_setmode[0] = '\0';
s_setmode_fd = -1;
@@ -641,11 +649,15 @@
/* ¥â¡¼¥É¤òÊѹ¹¤¹¤ë */
if (s_setmode_fd > 0 && FD_ISSET(s_setmode_fd, &fds)) {
int start, end;
+#ifdef __CYGWIN32__
if ((len = read(s_setmode_fd, buf, sizeof(buf) - 1)) <= 0) {
debug2(("pipe closed\n"));
close(s_setmode_fd);
s_setmode_fd = open(s_path_setmode, O_RDONLY | O_NONBLOCK);
}
+#else
+ len = read(s_setmode_fd, buf, sizeof(buf) - 1);
+#endif
for (end = len - 1; end >= 0 && !isdigit((unsigned char)buf[end]); --end);
/* ¥×¥ê¥¨¥Ç¥£¥Ã¥È¤òÊÔ½¸Ãæ¤Ç¤Ê¤±¤ì¤Ð¥â¡¼¥É¤òÊѹ¹¤¹¤ë */
if (end >= 0 && !g_start_preedit) {
@@ -697,12 +709,12 @@
key_state = UMod_Alt;
continue;
}
- } else if (s_timeout > 0) {
+ } else if (g_opt.timeout > 0) {
struct timeval t;
FD_ZERO(&fds);
FD_SET(g_win_in, &fds);
t.tv_sec = 0;
- t.tv_usec = s_timeout;
+ t.tv_usec = g_opt.timeout;
if (my_select(nfd, &fds, &t) > 0) {
len += read_stdin(buf + len, sizeof(buf) - len - 1);
buf[len] = '\0';
@@ -742,7 +754,7 @@
buf[len] = '\0';
/* ¥¯¥ê¥¢¤µ¤ì¤¿»þ¤Ë¥â¡¼¥É¤òºÆÉÁ²è¤¹¤ë */
- if (s_status_type == LASTLINE) {
+ if (g_opt.status_type == LASTLINE) {
char *str1 = rstrstr_len(buf, _clear_screen, len);
char *str2 = rstrstr_len(buf, _clr_eos, len);
if (str1 != NULL || str2 != NULL) {
@@ -807,7 +819,7 @@
{
struct winsize *win = malloc(sizeof(struct winsize));
ioctl(g_win_in, TIOCGWINSZ, win);
- if (s_status_type == LASTLINE) {
+ if (g_opt.status_type == LASTLINE) {
win->ws_row--;
}
return win;
@@ -866,7 +878,7 @@
escseq_winch();
callbacks_winch();
draw_winch();
- if (s_status_type == LASTLINE) {
+ if (g_opt.status_type == LASTLINE) {
put_save_cursor();
put_cursor_invisible();
if (g_win->ws_row > prev_win->ws_row) {
@@ -888,7 +900,7 @@
{
uim_quit();
quit_escseq();
- if (s_status_type == BACKTICK) {
+ if (g_opt.status_type == BACKTICK) {
clear_backtick();
}
tcsetattr(g_win_in, TCSAFLUSH, &s_save_tios);
@@ -935,7 +947,7 @@
"-u <input method> input method [default=%s]\n"
"-s <lastline/backtick/none> statusline type [default=%s]\n"
"-b <file> socket file [default=%s]\n"
- "-w <width> statusline width [default=%d]\n"
+ "-w <width> statusline width\n"
"%s"
"-e command arg1 arg2 ... executed command [default=%s]\n"
"%s",
@@ -943,14 +955,13 @@
DEFAULT_STATUS == LASTLINE ? "lastline" :
DEFAULT_STATUS == BACKTICK ? "backtick" : "none",
usersockname(NULL),
- DEFAULT_BACKTICK_WIDTH,
"-t <sec> key timeout\n"
"-C [<foreground color>]:[<background color>]\n"
"-c reverse cursor\n"
"-i use cursor_invisible(civis)\n"
"-o on the spot\n"
"-S GNU screen mode\n"
- "-D for DOS prompt\n",
+ "-d ddskk like candidate style\n",
getenv("SHELL") != NULL ? getenv("SHELL") : "/bin/sh",
"-h display this help\n"
"-v display version\n"
Modified: trunk/fep/uim-fep.h
===================================================================
--- trunk/fep/uim-fep.h 2005-05-11 22:56:48 UTC (rev 838)
+++ trunk/fep/uim-fep.h 2005-05-15 05:22:21 UTC (rev 839)
@@ -52,9 +52,30 @@
#define WIN_IN_FILENO STDOUT_FILENO
#define PROC_FILENO STDIN_FILENO
+struct opt_tag {
+ /* ¥¹¥Æ¡¼¥¿¥¹¥é¥¤¥ó¤Î¼ïÎà */
+ int status_type;
+ /* ddskk¤Ë»÷¤¿¸õÊä¤Îɽ¼¨ */
+ int ddskk;
+ /* TRUE¤Ê¤é¥«¡¼¥½¥ë°ÌÃÖ¤òȿž¤·¤Ê¤¤ */
+ int cursor_no_reverse;
+ /* ¥«¡¼¥½¥ë¤ò¾Ã¤¹¤« */
+ int use_civis;
+ /* ¥×¥ê¥¨¥Ç¥£¥Ã¥È¤òÁÞÆþ¤¹¤ë¤« */
+ int on_the_spot;
+ /* ¥¹¥Æ¡¼¥¿¥¹¥é¥¤¥ó¤ÎÉý */
+ int statusline_width;
+ /* ESC¤Î¸å¤Ë²¿ÉÃÂԤĤ« */
+ int timeout;
+ /* ¥ì¥Ý¡¼¥È¥«¡¼¥½¥ëµ¡Ç½¤¬¤Ê¤¤¤« */
+ int no_report_cursor;
+};
+
+extern struct opt_tag g_opt;
extern int g_win_in;
extern int g_win_out;
extern struct winsize *g_win;
+
void done(int exit_value);
#ifdef DEBUG
More information about the Uim-commit
mailing list