diff --git a/comp/src/gb.form.terminal/.src/TerminalView/TerminalView.class b/comp/src/gb.form.terminal/.src/TerminalView/TerminalView.class index b39ceb4cd..f562ee45c 100644 --- a/comp/src/gb.form.terminal/.src/TerminalView/TerminalView.class +++ b/comp/src/gb.form.terminal/.src/TerminalView/TerminalView.class @@ -181,6 +181,7 @@ Public Sub _new() $hView.Focus = True $hView.Tracking = True $hView.Mouse = Mouse.Text + $hView.Drop = True '$hView.NoBackground = True Me.Background = Color.TextForeground @@ -1450,17 +1451,20 @@ Public Sub Copy() End +Private Sub PasteText(sText As String) + + If Not sText Then Return + If $hFilter.BracketedPasteActive Then sText = "\e[200~" & sText & "\e[200~" + Input(sText) + +End + + '' Paste the clipboard contents into the terminal, as if it has been entered through the keyboard. Public Sub Paste() - Dim sText As String - - sText = Clipboard.Paste("text/plain;charset=utf-8") - If Not sText Then Return - - If $hFilter.BracketedPasteActive Then sText = "\e[200~" & sText & "\e[200~" - Input(sText) + PasteText(Clipboard.Paste("text/plain;charset=utf-8")) End @@ -1762,3 +1766,45 @@ Private Function Link_Read() As TerminalLink Return $hTerminalLink End + +Private Sub UrlUnquote(Path As String) As String + + Dim iInd As Integer + Dim sRes As String + Dim sCar As String + + For iInd = 1 To Len(Path) + sCar = Mid$(Path, iInd, 1) + If sCar = "%" Then + sCar = Chr$(Val("&H" & Mid$(Path, iInd + 1, 2))) + iInd += 2 + Else If sCar = "+" Then + sCar = " " + Endif + sRes &= sCar + Next + + Return sRes + +End + +Public Sub View_Drop() + + Dim sText As String + Dim aText As String[] + Dim I As Integer + + If Drag.Formats.Exist("text/uri-list") Then + sText = Trim(Drag.Paste("text/uri-list")) + If sText Then + aText = Split(sText, "\r\n", "", True) + For I = 0 To aText.Max + sText = aText[I] + If sText Begins "file://" Then aText[I] = UrlUnquote(Mid$(sText, 8)) + aText[I] = Shell$(aText[I]) + Next + PasteText(aText.Join(" ") & " ") + Endif + Endif + +End