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()
|
||||
|
||||
Dim hView As TextEditor
|
||||
Dim aViews As TextEditor[]
|
||||
|
||||
Lines = New String[1]
|
||||
LinesInfo = New CLineInfo[1]
|
||||
LineLength = New Integer[1]
|
||||
|
@ -67,6 +70,13 @@ Public Sub Clear()
|
|||
$cBreakpoint = New Collection
|
||||
$cBookmark = New Collection
|
||||
|
||||
Try aViews = GetAllViews()
|
||||
If aViews Then
|
||||
For Each hView In aViews
|
||||
hView.Goto(0, 0)
|
||||
Next
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
Private Function Text_Read() As String
|
||||
|
|
|
@ -372,7 +372,6 @@ End
|
|||
|
||||
Private Sub Text_Write(Value As String)
|
||||
|
||||
Goto(0, 0)
|
||||
$hDoc.Text = Value
|
||||
Init
|
||||
If $bShowPreview Then $hTimerSideBarRefresh.Trigger
|
||||
|
@ -2809,6 +2808,7 @@ Public Sub View_Draw()
|
|||
Dim W, NL As Integer
|
||||
'Dim hImage As Image
|
||||
Dim hPict As Picture
|
||||
Dim iCount As Integer
|
||||
|
||||
If Not $bUpdateHeightAllowed Then
|
||||
$bUpdateHeightAllowed = True
|
||||
|
@ -2829,10 +2829,11 @@ Public Sub View_Draw()
|
|||
|
||||
'Debug Me.Font.ToString();; Draw.Font.ToString()
|
||||
|
||||
iCount = $hDoc.Count
|
||||
NL = $hView.ClientH \ $hRows.H + 1
|
||||
|
||||
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)
|
||||
If iRow < 0 Then Return
|
||||
|
@ -2871,6 +2872,8 @@ Public Sub View_Draw()
|
|||
Y = YY
|
||||
For I = 0 To iMaxRow
|
||||
iRow = aRow[I]
|
||||
If iRow >= iCount Then Break
|
||||
|
||||
H = $hRows._GetRowHeight(iRow)
|
||||
|
||||
If H >= $hView.ClientH Or If $bRemoteDisplay Then
|
||||
|
@ -2915,9 +2918,11 @@ Public Sub View_Draw()
|
|||
|
||||
Y = YY
|
||||
For I = 0 To iMaxRow
|
||||
iRow = aRow[I]
|
||||
If iRow >= iCount Then Break
|
||||
Paint.Save
|
||||
H = $hRows._GetRowHeight(aRow[I])
|
||||
DrawMargin(XX, Y, $iWidth, H, aRow[I])
|
||||
H = $hRows._GetRowHeight(iRow)
|
||||
DrawMargin(XX, Y, $iWidth, H, iRow)
|
||||
Paint.Restore
|
||||
Y += H
|
||||
Next
|
||||
|
|
Loading…
Reference in a new issue