Correggi visualizzazione a capo editor Okuma
This commit is contained in:
@@ -443,24 +443,26 @@ Public Class Form1
|
||||
|
||||
Private Shared Function ToVisibleControlText(content As String) As String
|
||||
Dim builder As New StringBuilder(content.Length)
|
||||
For Each ch In content
|
||||
Dim i = 0
|
||||
While i < content.Length
|
||||
Dim ch = content(i)
|
||||
Select Case AscW(ch)
|
||||
Case &H0
|
||||
builder.Append("[NUL]")
|
||||
Case &HA
|
||||
builder.Append("[LF]")
|
||||
builder.Append(Environment.NewLine)
|
||||
Case &HD
|
||||
builder.Append("[CR]")
|
||||
If i + 1 < content.Length AndAlso content(i + 1) = ControlChars.Lf Then
|
||||
i += 1
|
||||
End If
|
||||
builder.Append(Environment.NewLine)
|
||||
Case &H12
|
||||
builder.Append("[DC2]")
|
||||
Case &H14
|
||||
builder.Append("[DC4]")
|
||||
Case 1 To 8, 11, 12, 14 To 17, 19, 21 To 31
|
||||
builder.Append($"[0x{AscW(ch):X2}]")
|
||||
Case Else
|
||||
builder.Append(ch)
|
||||
End Select
|
||||
Next
|
||||
i += 1
|
||||
End While
|
||||
Return builder.ToString()
|
||||
End Function
|
||||
|
||||
@@ -489,15 +491,6 @@ Public Class Form1
|
||||
|
||||
Private Shared Function TryParseControlToken(token As String, ByRef controlChar As Char) As Boolean
|
||||
Select Case token.Trim().ToUpperInvariant()
|
||||
Case "NUL"
|
||||
controlChar = ChrW(&H0)
|
||||
Return True
|
||||
Case "LF"
|
||||
controlChar = ControlChars.Lf
|
||||
Return True
|
||||
Case "CR"
|
||||
controlChar = ControlChars.Cr
|
||||
Return True
|
||||
Case "DC2"
|
||||
controlChar = ChrW(&H12)
|
||||
Return True
|
||||
@@ -506,14 +499,6 @@ Public Class Form1
|
||||
Return True
|
||||
End Select
|
||||
|
||||
If token.StartsWith("0x", StringComparison.OrdinalIgnoreCase) Then
|
||||
Dim value As Integer
|
||||
If Integer.TryParse(token.Substring(2), Globalization.NumberStyles.HexNumber, Globalization.CultureInfo.InvariantCulture, value) AndAlso value >= 0 AndAlso value <= 31 Then
|
||||
controlChar = ChrW(value)
|
||||
Return True
|
||||
End If
|
||||
End If
|
||||
|
||||
controlChar = ControlChars.NullChar
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user