TextEditor: Setting the editor text does not crash anymore if the cursor of one of its view is out of bounds.
[GB.FORM.EDITOR] * BUG: TextEditor: Setting the editor text does not crash anymore if the cursor of one of its view is out of bounds. Finally fixed it!
This commit is contained in:
parent
4d4918e349
commit
88c89d0d7e
3 changed files with 19 additions and 4 deletions
Binary file not shown.
Before Width: | Height: | Size: 272 B After Width: | Height: | Size: 256 B |
|
@ -56,6 +56,9 @@ End
|
||||||
|
|
||||||
Public Sub Clear()
|
Public Sub Clear()
|
||||||
|
|
||||||
|
Dim hView As TextEditor
|
||||||
|
Dim aViews As TextEditor[]
|
||||||
|
|
||||||
Lines = New String[1]
|
Lines = New String[1]
|
||||||
LinesInfo = New CLineInfo[1]
|
LinesInfo = New CLineInfo[1]
|
||||||
LineLength = New Integer[1]
|
LineLength = New Integer[1]
|
||||||
|
@ -67,6 +70,13 @@ Public Sub Clear()
|
||||||
$cBreakpoint = New Collection
|
$cBreakpoint = New Collection
|
||||||
$cBookmark = New Collection
|
$cBookmark = New Collection
|
||||||
|
|
||||||
|
Try aViews = GetAllViews()
|
||||||
|
If aViews Then
|
||||||
|
For Each hView In aViews
|
||||||
|
hView.Goto(0, 0)
|
||||||
|
Next
|
||||||
|
Endif
|
||||||
|
|
||||||
End
|
End
|
||||||
|
|
||||||
Private Function Text_Read() As String
|
Private Function Text_Read() As String
|
||||||
|
|
|
@ -372,7 +372,6 @@ End
|
||||||
|
|
||||||
Private Sub Text_Write(Value As String)
|
Private Sub Text_Write(Value As String)
|
||||||
|
|
||||||
Goto(0, 0)
|
|
||||||
$hDoc.Text = Value
|
$hDoc.Text = Value
|
||||||
Init
|
Init
|
||||||
If $bShowPreview Then $hTimerSideBarRefresh.Trigger
|
If $bShowPreview Then $hTimerSideBarRefresh.Trigger
|
||||||
|
@ -2809,6 +2808,7 @@ Public Sub View_Draw()
|
||||||
Dim W, NL As Integer
|
Dim W, NL As Integer
|
||||||
'Dim hImage As Image
|
'Dim hImage As Image
|
||||||
Dim hPict As Picture
|
Dim hPict As Picture
|
||||||
|
Dim iCount As Integer
|
||||||
|
|
||||||
If Not $bUpdateHeightAllowed Then
|
If Not $bUpdateHeightAllowed Then
|
||||||
$bUpdateHeightAllowed = True
|
$bUpdateHeightAllowed = True
|
||||||
|
@ -2829,10 +2829,11 @@ Public Sub View_Draw()
|
||||||
|
|
||||||
'Debug Me.Font.ToString();; Draw.Font.ToString()
|
'Debug Me.Font.ToString();; Draw.Font.ToString()
|
||||||
|
|
||||||
|
iCount = $hDoc.Count
|
||||||
NL = $hView.ClientH \ $hRows.H + 1
|
NL = $hView.ClientH \ $hRows.H + 1
|
||||||
|
|
||||||
hClip = Paint.ClipRect
|
hClip = Paint.ClipRect
|
||||||
If $hDoc.Count < NL Then Paint.FillRect(hClip.X, hClip.Y, hClip.W, hClip.H, $iBackground)
|
If iCount < NL Then Paint.FillRect(hClip.X, hClip.Y, hClip.W, hClip.H, $iBackground)
|
||||||
|
|
||||||
iRow = $hRows._FindRowFromPos($hView.ScrollY + hClip.Y)
|
iRow = $hRows._FindRowFromPos($hView.ScrollY + hClip.Y)
|
||||||
If iRow < 0 Then Return
|
If iRow < 0 Then Return
|
||||||
|
@ -2871,6 +2872,8 @@ Public Sub View_Draw()
|
||||||
Y = YY
|
Y = YY
|
||||||
For I = 0 To iMaxRow
|
For I = 0 To iMaxRow
|
||||||
iRow = aRow[I]
|
iRow = aRow[I]
|
||||||
|
If iRow >= iCount Then Break
|
||||||
|
|
||||||
H = $hRows._GetRowHeight(iRow)
|
H = $hRows._GetRowHeight(iRow)
|
||||||
|
|
||||||
If H >= $hView.ClientH Or If $bRemoteDisplay Then
|
If H >= $hView.ClientH Or If $bRemoteDisplay Then
|
||||||
|
@ -2915,9 +2918,11 @@ Public Sub View_Draw()
|
||||||
|
|
||||||
Y = YY
|
Y = YY
|
||||||
For I = 0 To iMaxRow
|
For I = 0 To iMaxRow
|
||||||
|
iRow = aRow[I]
|
||||||
|
If iRow >= iCount Then Break
|
||||||
Paint.Save
|
Paint.Save
|
||||||
H = $hRows._GetRowHeight(aRow[I])
|
H = $hRows._GetRowHeight(iRow)
|
||||||
DrawMargin(XX, Y, $iWidth, H, aRow[I])
|
DrawMargin(XX, Y, $iWidth, H, iRow)
|
||||||
Paint.Restore
|
Paint.Restore
|
||||||
Y += H
|
Y += H
|
||||||
Next
|
Next
|
||||||
|
|
Loading…
Reference in a new issue