diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 810ef93a6f..0b3dd5bc5e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,15 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-07-25 18:45 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/rtl/gtchrmap.c + * indenting + + * harbour/source/rtl/gttrm/gttrm.c + * added some key sequences I used in patch for PuTTY/PTerm + CTRL+{INS,DEL,HOME,END,PGUP,PGDN} - they are gnome-terminal + compatible + 2007-07-25 16:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbgtcore.h + added translation for HB_GT_trm diff --git a/harbour/source/rtl/gtchrmap.c b/harbour/source/rtl/gtchrmap.c index 52b6b1f401..3bc4f86c1c 100644 --- a/harbour/source/rtl/gtchrmap.c +++ b/harbour/source/rtl/gtchrmap.c @@ -310,7 +310,7 @@ static int chrmap_parse( FILE *fp, const char *pszTerm, int *nTransTbl, const ch i = strlen( pszTerm ); while( isTerm == 0 && ( s = strstr( s + 1, pszTerm ) ) != NULL ) { - if( *(s-1) == '|' && + if( *(s-1) == '|' && ( s[i] == '|' || s[i] == '\0' ) ) isTerm = 1; } @@ -407,7 +407,7 @@ int hb_gt_chrmapinit( int *piTransTbl, const char *pszTerm, BOOL fSetACSC ) int nRet = -1; chrmap_init( piTransTbl ); - + if( pszTerm == NULL || *pszTerm == '\0' ) pszTerm = getenv("HB_TERM"); if( pszTerm == NULL || *pszTerm == '\0' ) @@ -421,7 +421,7 @@ int hb_gt_chrmapinit( int *piTransTbl, const char *pszTerm, BOOL fSetACSC ) if( nRet == -1 ) { pszFile = getenv( "HB_ROOT" ); - if( pszFile != NULL && sizeof( szFile ) > + if( pszFile != NULL && sizeof( szFile ) > strlen( pszFile ) + strlen( s_szDefaultCharMapFile ) ) { hb_strncpy( szFile, pszFile, _POSIX_PATH_MAX ); @@ -449,7 +449,7 @@ int hb_gt_chrmapinit( int *piTransTbl, const char *pszTerm, BOOL fSetACSC ) int main(int argc, char **argv) { int piTransTbl[256], i; - + if( hb_gt_chrmapinit( piTransTbl, NULL ) == -1 ) { printf("cannot init charmap.\n"); diff --git a/harbour/source/rtl/gttrm/gttrm.c b/harbour/source/rtl/gttrm/gttrm.c index 739cc14077..a38fd8b4ba 100644 --- a/harbour/source/rtl/gttrm/gttrm.c +++ b/harbour/source/rtl/gttrm/gttrm.c @@ -77,17 +77,20 @@ #include #include #include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include + +#if defined( OS_UNIX_COMPATIBLE ) +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#endif #ifdef HAVE_GPM_H # include #endif @@ -613,10 +616,13 @@ static void set_signals( void ) } } +#endif + static int hb_gt_trm_getSize( int * piRows, int * piCols ) { *piRows = *piCols = 0; +#if defined( OS_UNIX_COMPATIBLE ) if( s_termState.fOutTTY ) { struct winsize win; @@ -627,6 +633,7 @@ static int hb_gt_trm_getSize( int * piRows, int * piCols ) *piCols = win.ws_col; } } +#endif if( *piRows <= 0 || *piCols <= 0 ) { @@ -640,8 +647,6 @@ static int hb_gt_trm_getSize( int * piRows, int * piCols ) return *piRows > 0 && *piCols > 0; } -#endif - static void hb_gt_trm_termFlush( void ) { if( s_termState.iOutBufIndex > 0 ) @@ -1266,11 +1271,13 @@ static int wait_key( int milisec ) int nKey, esc, n, i, ch, counter; keyTab *ptr; +#if defined( OS_UNIX_COMPATIBLE ) if( s_termState.fWinSizeChangeFlag ) { s_termState.fWinSizeChangeFlag = FALSE; return K_RESIZE; } +#endif counter = ++( s_termState.key_counter ); restart: @@ -1508,11 +1515,13 @@ static BOOL hb_gt_trm_XtermSetMode( int * piRows, int * piCols ) hb_gt_trm_termOut( ( BYTE * ) escseq, strlen( escseq ) ); hb_gt_trm_termFlush(); +#if defined( OS_UNIX_COMPATIBLE ) /* dirty hack - wait for SIGWINCH */ if( *piRows != iHeight || *piCols != iWidth ) sleep( 3 ); if( s_termState.fWinSizeChangeFlag ) s_termState.fWinSizeChangeFlag = FALSE; +#endif hb_gt_trm_getSize( piRows, piCols ); @@ -2228,7 +2237,10 @@ static void init_keys( void ) { EXKEY_END |KEY_CTRLMASK, "\033[1;5F" }, { EXKEY_HOME |KEY_CTRLMASK, "\033[1;5H" }, + { EXKEY_HOME |KEY_CTRLMASK, "\033[1;5~" }, { EXKEY_INS |KEY_CTRLMASK, "\033[2;5~" }, + { EXKEY_DEL |KEY_CTRLMASK, "\033[3;5~" }, + { EXKEY_END |KEY_CTRLMASK, "\033[4;5~" }, { EXKEY_PGUP |KEY_CTRLMASK, "\033[5;5~" }, { EXKEY_PGDN |KEY_CTRLMASK, "\033[6;5~" }, @@ -2237,7 +2249,6 @@ static void init_keys( void ) /* key added for gnome-terminal and teraterm */ { EXKEY_ENTER |KEY_CTRLMASK, "\033[7;5~" }, - { EXKEY_DEL |KEY_CTRLMASK, "\033[3;5~" }, { EXKEY_TAB |KEY_CTRLMASK, "\033[8;5~" }, { EXKEY_UP |KEY_ALTMASK, "\033[1;3A" }, @@ -2423,12 +2434,25 @@ static void init_keys( void ) { EXKEY_BS, "\177" }, /* kbs */ { EXKEY_TAB | KEY_ALTMASK, "\033[Z" }, /* kcbt */ + /* PuTTY keys */ + { EXKEY_F1, "\033[11~" }, + { EXKEY_F2, "\033[12~" }, + { EXKEY_F3, "\033[13~" }, + { EXKEY_F4, "\033[14~" }, + { EXKEY_F5, "\033[15~" }, { EXKEY_UP |KEY_CTRLMASK, "\033OA" }, { EXKEY_DOWN |KEY_CTRLMASK, "\033OB" }, { EXKEY_RIGHT |KEY_CTRLMASK, "\033OC" }, { EXKEY_LEFT |KEY_CTRLMASK, "\033OD" }, { EXKEY_CENTER|KEY_CTRLMASK, "\033OG" }, + { EXKEY_HOME |KEY_CTRLMASK, "\033[1;5~" }, + { EXKEY_INS |KEY_CTRLMASK, "\033[2;5~" }, + { EXKEY_DEL |KEY_CTRLMASK, "\033[3;5~" }, + { EXKEY_END |KEY_CTRLMASK, "\033[4;5~" }, + { EXKEY_PGUP |KEY_CTRLMASK, "\033[5;5~" }, + { EXKEY_PGDN |KEY_CTRLMASK, "\033[6;5~" }, + { 0, NULL } }; static const keySeq ansiKeySeq[] = {