2013-10-01 16:43 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* src/rtl/gttrm/gttrm.c
    ! fixed terminal ISO mode auto detection (broken in previous patch)
    % use position from UTF8/ISO mode detection instead of double asking
      terminal cursor position. With the minor cost of unknown initial
      column position we have faster start on slow connections.
This commit is contained in:
Przemysław Czerpak
2013-10-01 16:43:38 +02:00
parent 344bedfe68
commit a13480fa59
2 changed files with 20 additions and 7 deletions

View File

@@ -10,6 +10,13 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2013-10-01 16:43 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/rtl/gttrm/gttrm.c
! fixed terminal ISO mode auto detection (broken in previous patch)
% use position from UTF8/ISO mode detection instead of double asking
terminal cursor position. With the minor cost of unknown initial
column position we have faster start on slow connections.
2013-09-24 16:59 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/hbvm.h
* src/vm/hvm.c

View File

@@ -2130,20 +2130,20 @@ static HB_BOOL hb_trm_isUTF8( PHB_GTTRM pTerm )
if( pTerm->fPosAnswer )
{
int iRow = 0, iCol = 0;
hb_gt_trm_termOut( pTerm, "\005\r\303\255", 4 );
fUTF8 = pTerm->GetCursorPos( pTerm, &iRow, &iCol, "\r \r" ) &&
iCol == 1;
pTerm->iCol = 0;
if( pTerm->GetCursorPos( pTerm, &pTerm->iRow, &pTerm->iCol, "\r \r" ) )
{
fUTF8 = pTerm->iCol == 1;
pTerm->iCol = 0;
}
}
if( hb_trm_Param( "UTF8" ) || hb_trm_Param( "UTF-8" ) )
return HB_TRUE;
else if( hb_trm_Param( "ISO" ) )
return HB_FALSE;
else if( fUTF8 )
return HB_TRUE;
else if( pTerm->fPosAnswer )
return fUTF8;
szLang = getenv( "LANG" );
return szLang && strstr( szLang, "UTF-8" ) != NULL;
@@ -3117,9 +3117,15 @@ static void hb_gt_trm_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil
HB_GTSELF_SETFLAG( pGT, HB_GTI_STDERRCON, pTerm->fStderrTTY && pTerm->fOutTTY );
pTerm->Init( pTerm );
pTerm->SetTermMode( pTerm, 0 );
#ifdef HB_GTTRM_CHK_EXACT_POS
if( pTerm->GetCursorPos( pTerm, &pTerm->iRow, &pTerm->iCol, NULL ) )
HB_GTSELF_SETPOS( pGT, pTerm->iRow, pTerm->iCol );
pTerm->fUTF8 = hb_trm_isUTF8( pTerm );
#else
pTerm->fUTF8 = hb_trm_isUTF8( pTerm );
if( pTerm->fPosAnswer )
HB_GTSELF_SETPOS( pGT, pTerm->iRow, pTerm->iCol );
#endif
if( ! pTerm->fUTF8 )
{
#ifndef HB_GT_UNICODE_BUF