Skip to content

Commit

Permalink
Handle space in sendbox KeyDown
Browse files Browse the repository at this point in the history
Fixes the ability to lose typed input with /r and /rw if space is not lifted before pressing more keys
  • Loading branch information
nmbook committed Apr 5, 2016
1 parent 5a30b49 commit 1b7eb92
Showing 1 changed file with 43 additions and 45 deletions.
88 changes: 43 additions & 45 deletions trunk/frmChat.frm
Expand Up @@ -5145,51 +5145,6 @@ End Sub

Private Sub cboSend_KeyUp(KeyCode As Integer, Shift As Integer)
RecordcboSendSelInfo

Select Case (KeyCode)
Case KEY_SPACE
With cboSend
If (LenB(LastWhisper) > 0) Then
If (Len(.Text) >= 3) Then
If StrComp(Left$(.Text, 3), "/r ", vbTextCompare) = 0 Then
.selStart = 0
.selLength = Len(.Text)
.SelText = _
"/w " & CleanUsername(LastWhisper, True) & " "
.selStart = Len(.Text)
End If
End If

If (Len(.Text) >= 7) Then
If StrComp(Left$(.Text, 7), "/reply ", vbTextCompare) = 0 Then
.selStart = 0
.selLength = Len(.Text)
.SelText = _
"/w " & CleanUsername(LastWhisper, True) & " "
.selStart = Len(.Text)
End If
End If
End If

If (LenB(LastWhisperTo) > 0) Then
If (Len(.Text) >= 4) Then
If StrComp(Left$(.Text, 4), "/rw ", vbTextCompare) = 0 Then
.selStart = 0
.selLength = Len(.Text)

If StrComp(LastWhisperTo, "%f%") = 0 Then
.SelText = "/f m "
Else
.SelText = _
"/w " & CleanUsername(LastWhisperTo, True) & " "
End If

.selStart = Len(.Text)
End If
End If
End If
End With
End Select
End Sub

Private Sub cboSend_KeyDown(KeyCode As Integer, Shift As Integer)
Expand Down Expand Up @@ -5236,6 +5191,49 @@ Private Sub cboSend_KeyDown(KeyCode As Integer, Shift As Integer)
'MsgBox KeyCode

Select Case (KeyCode)
Case KEY_SPACE
With cboSend
If (LenB(LastWhisper) > 0) Then
If (Len(.Text) >= 3) Then
If StrComp(Left$(.Text, 3), "/r ", vbTextCompare) = 0 Then
.selStart = 0
.selLength = Len(.Text)
.SelText = _
"/w " & CleanUsername(LastWhisper, True) & " "
.selStart = Len(.Text)
End If
End If

If (Len(.Text) >= 7) Then
If StrComp(Left$(.Text, 7), "/reply ", vbTextCompare) = 0 Then
.selStart = 0
.selLength = Len(.Text)
.SelText = _
"/w " & CleanUsername(LastWhisper, True) & " "
.selStart = Len(.Text)
End If
End If
End If

If (LenB(LastWhisperTo) > 0) Then
If (Len(.Text) >= 4) Then
If StrComp(Left$(.Text, 4), "/rw ", vbTextCompare) = 0 Then
.selStart = 0
.selLength = Len(.Text)

If StrComp(LastWhisperTo, "%f%") = 0 Then
.SelText = "/f m "
Else
.SelText = _
"/w " & CleanUsername(LastWhisperTo, True) & " "
End If

.selStart = Len(.Text)
End If
End If
End If
End With

Case KEY_PGDN 'ALT + PAGEDOWN
If Shift = S_ALT Then
If i < .ListItems.Count Then
Expand Down

0 comments on commit 1b7eb92

Please sign in to comment.