[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getting TerminalView to update after escape sequences


I worked out i could remove the current command line in a TerminalView like
this...

  TerminalView1.Input("\e[H") ' goto command line start(home)
  Wait 0.1
  TerminalView1.Print("\e[0K\e[0J") ' delete all to the right and below

I had to do it that way because if i used \e[H in the Print line it went
all the way to column 0 but using Input() it goes to the prompt
and Input did not work for \e[0K or \e[0J
(the Wait 0.1 was required too)

But ...
The problem is after doing this the text appears to have been removed but
it's more like it's all been replaced by spaces and not deleted.

How can i make the Terminal update to the removed chars?


This is the rather more complex function i have that works that goes to the
end of the line and Backspace detetes each char till it finds the prompt
string...

Public Sub ClearLine()

  If Not TerminalView1.Text Then Return
  Dim aTxt As String[] = Split(TerminalView1.Text, "\n")
  Dim sLine As String
  Dim iLine As Integer = aTxt.Max
  Dim sPrompt As String = PromtLine()
  Dim iCol As Integer
  Dim iTo As Integer
  Dim sInput As String

  sLine = aTxt[iLine]
  iCol = sLine.Len

  Do
    If sLine Begins sPrompt Then iTo = Me.PromtLen Else iTo = 0
    sInput = String(iCol - iTo, Chr$(127))
    TerminalView1.Input(sInput)
    Dec iLine
    If sLine Begins sPrompt Or If iLine < 0 Then Break
    sLine = aTxt[iLine]
    iCol = sLine.Len
  Loop

End

Cheers
BruceS