TerminalView: Fix "EraseStartOfLine" VT-100 command and remove "Erase screen" optimization.

[GB.FORM.TERMINAL]
* BUG: TerminalView: Remove "Erase screen" optimization.
* BUG: TerminalView: Fix "EraseStartOfLine" VT-100 command.
This commit is contained in:
gambas 2018-04-21 20:38:57 +02:00
parent 9b52761613
commit 2b3cbd9217
4 changed files with 39 additions and 22 deletions

View file

@ -119,8 +119,8 @@ Public Sub Button6_Click()
End
Public Sub TerminalView1_Resize(W As Integer, H As Integer)
Debug W;; H
End
' Public Sub TerminalView1_Resize(W As Integer, H As Integer)
'
' Debug W;; H
'
' End

View file

@ -9,6 +9,7 @@ Private Enum MODE_AppScreen, MODE_AppCuKeys, MODE_AppKeyPad, MODE_Mouse1000, MOD
Private $aMode As New Boolean[13]
'Private $aSavedMode As New Boolean[13]
Private $sLeft As String
Private $iCpt As Integer
Public Sub Reset()
@ -43,8 +44,10 @@ Public Sub OutputTo(hView As TerminalView, hScreen As TerminalScreen, hOutput As
For iPos = Len(sData) DownTo 1
If Asc(sData, iPos) >= 192 Then Break
Next
'Debug "not valid";; iPos; " / "; Len(sData)
'Debug Quote(Right(sData, 256))
If TerminalScreen.DEBUG_FILTER Then
Debug "not valid";; iPos; " / "; Len(sData)
Debug Quote(Right(sData, 256))
Endif
If iPos = 0 Then Return
$sLeft = Mid$(sData, iPos)
sData = Left(sData, iPos - 1)
@ -55,7 +58,7 @@ Public Sub OutputTo(hView As TerminalView, hScreen As TerminalScreen, hOutput As
'Debug If(hProcess.Term.GetAttr().ONLCR, "+", "-"); "ONLCR"
'If Len(sData) >= 4096 Then
iPosEraseScreen = RInStr(sData, "\e[2J")
'iPosEraseScreen = RInStr(sData, "\e[2J")
'If iPosEraseScreen > 0 Then Debug "erase screen at "; iPosEraseScreen
'Endif
@ -174,12 +177,19 @@ Private Sub Escape(hView As TerminalView, hScreen As TerminalScreen, hOutput As
sStr = Mid$(sData, iPos, iLen)
If hScreen.DEBUG_FILTER Then
Debug "ESC";
Inc $iCpt
Error Format($iCpt, "######0"); " | ";
Error "ESC";
For I = 1 To Len(sStr)
Error " "; Mid$(sStr, I, 1);
Next
Error
hScreen.DebugRefresh
If $iCpt > 5120 Then
hScreen.DebugRefresh
hView.Suspended = True
Stop
hView.Suspended = False
Endif
Endif
Select Case Left(sStr)
@ -477,7 +487,7 @@ Private Sub Escape(hView As TerminalView, hScreen As TerminalScreen, hOutput As
Case "12"
'Ignored
Case "25" ' Hide cursor
hScreen.HideCursor = True
If Not hScreen.DEBUG_FILTER Then hScreen.HideCursor = True
Case "47"
$aMode[MODE_AppScreen] = False
hView.AlternateScreen = False

View file

@ -262,7 +262,7 @@ Public Sub Print(sText As String)
If sElt Then
If DEBUG_FILTER Then
Debug Quote(sElt)
Error Quote(sElt)
DebugRefresh
Endif
@ -276,7 +276,7 @@ Public Sub Print(sText As String)
iCode = Asc(sText, iLen + 1)
If DEBUG_FILTER Then
Debug "^" & Chr$(64 + iCode)
Error "^" & Chr$(64 + iCode)
DebugRefresh
Endif
@ -531,7 +531,7 @@ Public Sub EraseStartOfLine()
If hLine.Length <= $X Then
hLine.Clear()
Else
hLine.Text = Space$($X + 1) & String.Mid$(hLine.Text, $X + 1)
hLine.Text = Space$($X + 1) & String.Mid$(hLine.Text, $X + 2)
Endif
GetView()._RefreshLine($Y)
@ -1168,7 +1168,7 @@ End
Public Sub DebugRefresh()
If DEBUG_FILTER Then
Return
If GetView()._DisableFilter Then Return
GetView().Refresh
Inc GetView()._DisableFilter
Wait

View file

@ -925,10 +925,14 @@ Public Sub Process_Read()
$sBuffer &= sData
Endif
If (Timer - $fStart) >= 0.05 Then
$hOutputTimer.Trigger
If TerminalScreen.DEBUG_FILTER Then
If _DisableFilter = 0 Then $hOutputTimer.Trigger
Else
$hOutputTimer.Restart
If (Timer - $fStart) >= 0.05 Then
$hOutputTimer.Trigger
Else
$hOutputTimer.Restart
Endif
Endif
End
@ -944,14 +948,17 @@ End
Public Sub OutputTimer_Timer()
Dim hOutput As Stream
Dim sBuffer As String
$fStart = Timer
hOutput = GetOutputStream()
If hOutput Then $hFilter.OutputTo(Me, $hScreen, hOutput, $sBuffer)
$sBuffer = ""
$hOutputTimer.Stop
hOutput = GetOutputStream()
sBuffer = $sBuffer
$sBuffer = ""
If hOutput Then $hFilter.OutputTo(Me, $hScreen, hOutput, sBuffer)
EnsureVisible
End