Add "Ctrl+X" functionality to the chat
This commit is contained in:
parent
fc30cc439c
commit
00c481f5d4
|
@ -110,6 +110,9 @@ Public Class ChatScreen
|
||||||
If KeyBoardHandler.KeyPressed(Keys.C) = True Then
|
If KeyBoardHandler.KeyPressed(Keys.C) = True Then
|
||||||
Me.Copy()
|
Me.Copy()
|
||||||
End If
|
End If
|
||||||
|
If KeyBoardHandler.KeyPressed(Keys.X) = True Then
|
||||||
|
Me.Cut()
|
||||||
|
End If
|
||||||
If KeyBoardHandler.KeyPressed(Keys.V) = True Then
|
If KeyBoardHandler.KeyPressed(Keys.V) = True Then
|
||||||
If System.Windows.Forms.Clipboard.ContainsText() = True Then
|
If System.Windows.Forms.Clipboard.ContainsText() = True Then
|
||||||
Dim t As String = System.Windows.Forms.Clipboard.GetText().Replace(vbNewLine, " ")
|
Dim t As String = System.Windows.Forms.Clipboard.GetText().Replace(vbNewLine, " ")
|
||||||
|
@ -163,6 +166,23 @@ Public Class ChatScreen
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub Cut()
|
||||||
|
If Me.SelectionLength > 0 Then
|
||||||
|
Try
|
||||||
|
Dim DefaultSelection As Integer = Selection
|
||||||
|
System.Windows.Forms.Clipboard.SetText(Me.currentText.Substring(Me.SelectionStart, Me.SelectionLength))
|
||||||
|
currentText = currentText.Remove(SelectionStart, SelectionLength)
|
||||||
|
If Selection = SelectionStart + SelectionLength Then
|
||||||
|
Selection -= SelectionLength
|
||||||
|
End If
|
||||||
|
SelectionStart = 0
|
||||||
|
SelectionLength = 0
|
||||||
|
Catch ex As Exception
|
||||||
|
Logger.Log(Logger.LogTypes.Warning, "ChatScreen.vb: An error occurred while cutting text to the clipboard (""" & Me.currentText.Substring(Me.SelectionStart, Me.SelectionLength) & """).")
|
||||||
|
End Try
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub SelectAll()
|
Private Sub SelectAll()
|
||||||
Me.Selection = Me.currentText.Length
|
Me.Selection = Me.currentText.Length
|
||||||
Me.SelectionStart = 0
|
Me.SelectionStart = 0
|
||||||
|
|
Loading…
Reference in New Issue