Commit 204fc529 authored by Benoît Minisini's avatar Benoît Minisini
Browse files

Search dialog: Fix search inside form files whose text contents would be different if saved.

[DEVELOPMENT ENVIRONMENT]
* BUG: Search dialog: Fix search inside form files whose text contents would be different if saved.
parent 5f8a8861
Pipeline #327957830 passed with stage
in 24 minutes and 7 seconds
......@@ -4506,16 +4506,20 @@ Private Sub FindLocation(hResult As CSearchResult)
Dim sText As String
Dim iPos2 As Integer
sText = GetText()
If hResult.OnDisk Then
sText = File.Load(Path)
Else
sText = GetText()
Endif
iPos = RInStr(sText, "\n", hResult.Pos) + 1
iPos = RInStr(sText, "\n", hResult.Pos + 1) + 1
iPos2 = InStr(sText, "\n", iPos + 1)
If iPos2 = 0 Then iPos2 = Len(sText) + 1
sLine = Mid$(sText, iPos, iPos2 - iPos)
hResult.Column = hResult.Pos - iPos + 1
hResult.Column = String.Len(Left$(sLine, hResult.Pos - iPos)) + 1 'hResult.Pos - iPos + 1
hResult.Text = sLine
sLine = Trim(sLine)
......
......@@ -8,12 +8,13 @@ Public Column As Integer
Public Text As String
Public Bytes As Integer
Public Length As Integer
Public Dark As Boolean
Public Control As String
Public {Property} As String
Public (Highlight) As String
Public RichText As String
Public Location As String
Public Dark As Boolean
Public OnDisk As Boolean
Public Sub InitFromLine(sLine As String) As Boolean
......
......@@ -37,6 +37,7 @@ Private Enum SEARCH_STRING, SEARCH_REPLACE, SEARCH_AFTER_REPLACE, SEARCH_UPDATE
Private $hTask As CSearchTask
Private $sTaskBuffer As String
Private $sTaskPath As String
Private $bTaskOnDisk As Boolean
Private $aResult As New CSearchResult[]
Private $iTaskIndex As Integer
Private $sTaskFullPath As String
......@@ -1426,6 +1427,12 @@ Public Sub timFillList_Timer()
Else
$iTaskIndex = -1
Endif
hFile = Project.Files[$sTaskFullPath]
If hFile And If hFile.IsModified() Then
$bTaskOnDisk = False
Else
$bTaskOnDisk = True
Endif
hFile = Null
Else
......@@ -1436,6 +1443,7 @@ Public Sub timFillList_Timer()
hResult = New CSearchResult
hResult.Path = $sTaskPath
hResult.File = hFile.Name
hResult.OnDisk = $bTaskOnDisk
If hResult.InitFromLine(sLine) Then
Error "gambas3: warning: incorrect search result: "; sLine
......@@ -1507,6 +1515,7 @@ Private Sub Search(iMode As Integer, Optional aPath As String[])
$sTaskBuffer = ""
$sTaskPath = ""
$bTaskOnDisk = False
$iTaskIndex = -1
$bTaskUpdate = iMode = SEARCH_UPDATE
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment