diff --git a/components/synedit/synedithighlighter.pp b/components/synedit/synedithighlighter.pp index 6deaec3681..d4d691b871 100644 --- a/components/synedit/synedithighlighter.pp +++ b/components/synedit/synedithighlighter.pp @@ -1252,9 +1252,7 @@ begin ResetRange else SetRange(FCurrentRanges[LineNumber - 1]); - // Keep a copy of the line text, since some highlighters just use a PChar pointer to it. - FLineText := CurrentLines[LineNumber]; - SetLine(FLineText, LineNumber); + SetLine(CurrentLines[LineNumber], LineNumber); end; procedure TSynCustomHighlighter.ResetRange; @@ -1263,6 +1261,8 @@ end; procedure TSynCustomHighlighter.SetLine(const NewValue: String; LineNumber: Integer); begin + // Keep a copy of the line text, since some highlighters just use a PChar pointer to it. + FLineText := NewValue; FIsInNextToEOL := False; FLineIndex := LineNumber; end; diff --git a/components/synedit/synhighlighterany.pas b/components/synedit/synhighlighterany.pas index ab6cfc6bb4..4476a2a570 100644 --- a/components/synedit/synhighlighterany.pas +++ b/components/synedit/synhighlighterany.pas @@ -468,6 +468,7 @@ end; { Destroy } procedure TSynAnySyn.SetLine(const NewValue: String; LineNumber:Integer); begin + inherited; fLine := PChar(NewValue); Run := 0; fLineNumber := LineNumber; diff --git a/components/synedit/synhighlighterbat.pas b/components/synedit/synhighlighterbat.pas index ae660b6f74..a3371674bc 100644 --- a/components/synedit/synhighlighterbat.pas +++ b/components/synedit/synhighlighterbat.pas @@ -417,6 +417,7 @@ end; procedure TSynBatSyn.SetLine({$IFDEF FPC}const {$ENDIF}NewValue: String; LineNumber: Integer); begin + inherited; fLine := PChar(NewValue); Run := 0; fEcho := False; diff --git a/components/synedit/synhighlightercpp.pp b/components/synedit/synhighlightercpp.pp index 048c0c9aa4..84f8edb10b 100644 --- a/components/synedit/synhighlightercpp.pp +++ b/components/synedit/synhighlightercpp.pp @@ -812,6 +812,7 @@ end; { Create } procedure TSynCppSyn.SetLine(const NewValue: String; LineNumber:Integer); begin + inherited; fLine := PChar(NewValue); Run := 0; fLineNumber := LineNumber; diff --git a/components/synedit/synhighlightercss.pas b/components/synedit/synhighlightercss.pas index 5e20af5478..07827e6ca2 100644 --- a/components/synedit/synhighlightercss.pas +++ b/components/synedit/synhighlightercss.pas @@ -1473,6 +1473,7 @@ end; procedure TSynCssSyn.SetLine({$IFDEF FPC}const {$ENDIF}NewValue: String; LineNumber: Integer); begin + inherited; fLine := PChar(NewValue); Run := 0; fLineNumber := LineNumber; diff --git a/components/synedit/synhighlighterini.pas b/components/synedit/synhighlighterini.pas index 4720dd0cd2..ffbfb13943 100644 --- a/components/synedit/synhighlighterini.pas +++ b/components/synedit/synhighlighterini.pas @@ -193,6 +193,7 @@ end; { Create } procedure TSynIniSyn.SetLine({$IFDEF FPC}const {$ENDIF}NewValue: String; LineNumber:Integer); begin + inherited; fLine := PChar(NewValue); Run := 0; fLineNumber := LineNumber; diff --git a/components/synedit/synhighlighterjava.pas b/components/synedit/synhighlighterjava.pas index 7ef627fb0d..41ab07f9d8 100644 --- a/components/synedit/synhighlighterjava.pas +++ b/components/synedit/synhighlighterjava.pas @@ -693,6 +693,7 @@ end; { Create } procedure TSynJavaSyn.SetLine({$IFDEF FPC}const {$ENDIF}NewValue: String; LineNumber:Integer); begin + inherited; fLine := PChar(NewValue); Run := 0; fEol := False; diff --git a/components/synedit/synhighlighterjscript.pas b/components/synedit/synhighlighterjscript.pas index 07419761db..defb64a9ba 100644 --- a/components/synedit/synhighlighterjscript.pas +++ b/components/synedit/synhighlighterjscript.pas @@ -1537,6 +1537,7 @@ end; procedure TSynJScriptSyn.SetLine({$IFDEF FPC}const {$ENDIF}NewValue: String; LineNumber: Integer); begin + inherited; fLine := PChar(NewValue); Run := 0; fLineNumber := LineNumber; diff --git a/components/synedit/synhighlightermulti.pas b/components/synedit/synhighlightermulti.pas index 9355e3f533..b96dcdcfcd 100644 --- a/components/synedit/synhighlightermulti.pas +++ b/components/synedit/synhighlightermulti.pas @@ -1488,6 +1488,7 @@ var i: Integer; begin if IsScanning then exit; + inherited; FCurLineIndex := LineNumber; FLine := NewValue; diff --git a/components/synedit/synhighlighterperl.pas b/components/synedit/synhighlighterperl.pas index 881cff1a0c..7e646dc003 100644 --- a/components/synedit/synhighlighterperl.pas +++ b/components/synedit/synhighlighterperl.pas @@ -2039,6 +2039,7 @@ end; { Create } procedure TSynPerlSyn.SetLine({$IFDEF FPC}const {$ENDIF}NewValue: String; LineNumber:Integer); begin + inherited; fLine := PChar(NewValue); Run := 0; fLineNumber := LineNumber; diff --git a/components/synedit/synhighlighterphp.pas b/components/synedit/synhighlighterphp.pas index a20e59a933..34232ebc3d 100644 --- a/components/synedit/synhighlighterphp.pas +++ b/components/synedit/synhighlighterphp.pas @@ -696,6 +696,7 @@ end; procedure TSynPHPSyn.SetLine({$IFDEF FPC}const {$ENDIF}NewValue: String; LineNumber: Integer); begin + inherited; fLine := PChar(NewValue); {$IFDEF SYN_LAZARUS} fLineLen := length(NewValue); diff --git a/components/synedit/synhighlighterposition.pas b/components/synedit/synhighlighterposition.pas index 5a3d1c4395..f10f0d1a4f 100644 --- a/components/synedit/synhighlighterposition.pas +++ b/components/synedit/synhighlighterposition.pas @@ -263,6 +263,7 @@ procedure TSynPositionHighlighter.SetLine(const NewValue: string; var p: PPositionTokens; begin + inherited; fLine := NewValue; fLineLen := length(fLine); fLineNumber := LineNumber; diff --git a/components/synedit/synhighlighterpython.pas b/components/synedit/synhighlighterpython.pas index a85d641b53..8a9c677b10 100644 --- a/components/synedit/synhighlighterpython.pas +++ b/components/synedit/synhighlighterpython.pas @@ -479,6 +479,7 @@ end; procedure TSynPythonSyn.SetLine({$IFDEF FPC}const {$ENDIF}NewValue: string; LineNumber: Integer); begin + inherited; fLine := PChar(NewValue); Run := 0; fLineNumber := LineNumber; diff --git a/components/synedit/synhighlightersql.pas b/components/synedit/synhighlightersql.pas index e375c79e98..12b210f57e 100644 --- a/components/synedit/synhighlightersql.pas +++ b/components/synedit/synhighlightersql.pas @@ -1110,6 +1110,7 @@ end; procedure TSynSQLSyn.SetLine({$IFDEF FPC}const {$ENDIF}NewValue: string; LineNumber: Integer); begin + inherited; fLine := PChar(NewValue); Run := 0; fLineNumber := LineNumber; diff --git a/components/synedit/synhighlightertex.pas b/components/synedit/synhighlightertex.pas index fffd2b8737..bb60668a71 100644 --- a/components/synedit/synhighlightertex.pas +++ b/components/synedit/synhighlightertex.pas @@ -207,6 +207,7 @@ end; { Create } procedure TSynTeXSyn.SetLine({$IFDEF FPC}const {$ENDIF}NewValue: String; LineNumber:Integer); begin + inherited; fLine := PChar(NewValue); Run := 0; fLineNumber := LineNumber; diff --git a/components/synedit/synhighlighterunixshellscript.pas b/components/synedit/synhighlighterunixshellscript.pas index e529e2fe73..c856dd2700 100644 --- a/components/synedit/synhighlighterunixshellscript.pas +++ b/components/synedit/synhighlighterunixshellscript.pas @@ -354,6 +354,7 @@ procedure TSynUNIXShellScriptSyn.SetLine( {$IFDEF FPC}const {$ENDIF}NewValue: String; LineNumber:Integer); begin + inherited; fLine := PChar(NewValue); Run := 0; fLineNumber := LineNumber; diff --git a/components/synedit/synhighlightervb.pas b/components/synedit/synhighlightervb.pas index 4eb504581b..3bb687fc3d 100644 --- a/components/synedit/synhighlightervb.pas +++ b/components/synedit/synhighlightervb.pas @@ -1053,6 +1053,7 @@ end; procedure TSynVBSyn.SetLine({$IFDEF FPC}const {$ENDIF}NewValue: String; LineNumber: Integer); begin + inherited; fLine := PChar(NewValue); Run := 0; fLineNumber := LineNumber;