aboutsummaryrefslogtreecommitdiffstats
path: root/terms.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:21:03 +0000
committerTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:21:03 +0000
commit2d9ece8bcb1c76c3d6990b83b00019e171c759d7 (patch)
treeb29dca9667fe151b2f01262c5907281ad2c7e3e8 /terms.c
parentReleasing debian version 0.5.1-4 (diff)
downloadw3m-2d9ece8bcb1c76c3d6990b83b00019e171c759d7.tar.gz
w3m-2d9ece8bcb1c76c3d6990b83b00019e171c759d7.zip
Releasing debian version 0.5.1-5debian/0.5.1-5
Diffstat (limited to '')
-rw-r--r--terms.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/terms.c b/terms.c
index 63963ff..b57add2 100644
--- a/terms.c
+++ b/terms.c
@@ -1,4 +1,4 @@
-/* $Id: terms.c,v 1.51 2003/12/08 16:06:34 ukai Exp $ */
+/* $Id: terms.c,v 1.55 2006/04/07 13:21:12 inu Exp $ */
/*
* An original curses library for EUC-kanji by Akinori ITO, December 1989
* revised by Akinori ITO, January 1995
@@ -56,8 +56,11 @@ static int tty;
#include <windows.h>
#include <sys/cygwin.h>
static int isWinConsole = 0;
+#define TERM_CYGWIN 1
+#define TERM_CYGWIN_RESERVE_IME 2
static int isLocalConsole = 0;
-#ifdef USE_MOUSE
+
+#if CYGWIN_VERSION_DLL_MAJOR < 1005 && defined(USE_MOUSE)
int cygwin_mouse_btn_swapped = 0;
#endif
@@ -79,9 +82,6 @@ check_win9x(void)
}
if (winVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
isWin95 = 1;
- if (ttyslot() != -1) {
- isLocalConsole = 0;
- }
}
else {
isWin95 = 0;
@@ -200,7 +200,7 @@ GetConsoleHwnd(void)
return (hwndFound);
}
-#ifdef USE_MOUSE
+#if CYGWIN_VERSION_DLL_MAJOR < 1005 && defined(USE_MOUSE)
static unsigned long
cygwin_version(void)
{
@@ -223,7 +223,7 @@ check_cygwin_console(void)
if (term == NULL)
term = DEFAULT_TERM;
if (term && strncmp(term, "cygwin", 6) == 0) {
- isWinConsole = 1;
+ isWinConsole = TERM_CYGWIN;
}
if (isWinConsole) {
hWnd = GetConsoleHwnd();
@@ -232,11 +232,17 @@ check_cygwin_console(void)
isLocalConsole = 1;
}
}
+ if (strncmp(getenv("LANG"), "ja", 2) == 0) {
+ isWinConsole = TERM_CYGWIN_RESERVE_IME;
+ }
#ifdef SUPPORT_WIN9X_CONSOLE_MBCS
check_win9x();
+ if (isWin95 && ttyslot() != -1) {
+ isLocalConsole = 0;
+ }
#endif
}
-#ifdef USE_MOUSE
+#if CYGWIN_VERSION_DLL_MAJOR < 1005 && defined(USE_MOUSE)
if (cygwin_version() <= 1003015) {
/* cygwin DLL 1.3.15 or earler */
cygwin_mouse_btn_swapped = 1;
@@ -382,9 +388,10 @@ char *T_cd, *T_ce, *T_kr, *T_kl, *T_cr, *T_bt, *T_ta, *T_sc, *T_rc,
*T_ti, *T_te, *T_nd, *T_as, *T_ae, *T_eA, *T_ac, *T_op;
int LINES, COLS;
-#if defined(__CYGWIN__) && LANG == JA
+#if defined(__CYGWIN__)
int LASTLINE;
-#endif /* defined(__CYGWIN__) && LANG == JA */
+#endif /* defined(__CYGWIN__) */
+
static int max_LINES = 0, max_COLS = 0;
static int tab_step = 8;
static int CurLine, CurColumn;
@@ -589,11 +596,11 @@ reset_tty(void)
MySignalHandler
reset_exit(SIGNAL_ARG)
{
- reset_tty();
#ifdef USE_MOUSE
if (mouseActive)
mouse_end();
#endif /* USE_MOUSE */
+ reset_tty();
w3m_exit(0);
SIGNAL_RETURN;
}
@@ -763,9 +770,9 @@ setlinescols(void)
COLS = MAX_COLUMN;
if (LINES > MAX_LINE)
LINES = MAX_LINE;
-#if defined(__CYGWIN__) && LANG == JA
- LASTLINE = LINES - (isWinConsole ? 2 : 1);
-#endif /* defined(__CYGWIN__) && LANG == JA */
+#if defined(__CYGWIN__)
+ LASTLINE = LINES - (isWinConsole == TERM_CYGWIN_RESERVE_IME ? 2 : 1);
+#endif /* defined(__CYGWIN__) */
}
void
@@ -1285,9 +1292,7 @@ refresh(void)
* (COLS-1,LINES-1).
*/
#if !defined(USE_BG_COLOR) || defined(__CYGWIN__)
-#if defined(__CYGWIN__) && LANG == JA
if (isWinConsole)
-#endif /* defined(__CYGWIN__) && LANG == JA */
if (line == LINES - 1 && col == COLS - 1)
break;
#endif /* !defined(USE_BG_COLOR) || defined(__CYGWIN__) */