Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnlaan committed Jun 17, 2024
1 parent ffdfa87 commit 98349cd
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 95 deletions.
7 changes: 4 additions & 3 deletions Components/ScintEdit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ function ScintRawStringIsBlank(const S: TScintRawString): Boolean;
implementation

uses
ShellAPI, RTLConsts, UITypes, GraphUtil, ScintStylerInnoSetup;
ShellAPI, RTLConsts, UITypes, GraphUtil;

function ScintRawStringIsBlank(const S: TScintRawString): Boolean;
begin
Expand Down Expand Up @@ -760,6 +760,7 @@ procedure TScintEdit.EndUndoAction;

procedure TScintEdit.EnsureLineVisible(const Line: Integer);
begin
FLines.CheckIndexRange(Line);
Call(SCI_ENSUREVISIBLE, Line, 0);
end;

Expand Down Expand Up @@ -1328,7 +1329,7 @@ procedure TScintEdit.SelectAndEnsureVisible(const Range: TScintRange);
begin
CheckPosRange(Range.StartPos, Range.EndPos);

{ If the range is in a collapsed section, expand it }
{ If the range is in a contracted section, expand it }
var StartLine := GetLineFromPosition(Range.StartPos);
var EndLine := GetLineFromPosition(Range.EndPos);
for var Line := StartLine to EndLine do
Expand Down Expand Up @@ -1827,7 +1828,7 @@ procedure TScintEdit.StyleNeeded(const EndPos: Integer);
if FoldHeader then
FoldLevel := FoldLevel or SC_FOLDLEVELHEADERFLAG;
{ Setting SC_FOLDLEVELWHITEFLAG on empty lines causes a problem: when
Scintilla auto expands a collapsed section (for example after removing ']'
Scintilla auto expands a contracted section (for example after removing ']'
from a section header) all the empty lines stay invisible, even any which
are in the middle of the section. }

Expand Down
4 changes: 2 additions & 2 deletions Components/ScintStylerInnoSetup.pas
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface

type
TInnoSetupStylerSection = (
scNone, { Not inside a section (start of file, or previous section was closed with )
scNone, { Not inside a section (start of file, or previous section was closed )
Section tags themselves are not associated with any section! }
scUnknown, { Inside an unrecognized section }
scThirdParty, { Inside a '_' section (reserved for third-party tools) }
Expand Down Expand Up @@ -950,7 +950,7 @@ procedure TInnoSetupStyler.GetFoldLevel(const LineState: TScintLineState;
followed by a section line.
Did notice an issue (Scintilla automatic folding bug?): Add a section with
some lines. Collapse it. Break the section header for example by removing ']'.
some lines. Contract it. Break the section header for example by removing ']'.
Scintialla now auto expands the section and removes the fold mark.
Retype the ']'. Scintilla now displays the old fold mark to expand the
section but it's already expanded. }
Expand Down
48 changes: 24 additions & 24 deletions Projects/Src/CompForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1983,7 +1983,7 @@ procedure TCompileForm.SyncEditorOptions;
begin
for Memo in FMemos do begin
Memo.UseStyleAttributes := FOptions.UseSyntaxHighlighting;
Memo.Call(SCI_INDICSETSTYLE, inSquiggly, SquigglyStyles[FOptions.UnderlineErrors]);
Memo.Call(SCI_INDICSETSTYLE, minSquiggly, SquigglyStyles[FOptions.UnderlineErrors]);

if FOptions.CursorPastEOL then
Memo.VirtualSpaceOptions := [svsRectangularSelection, svsUserAccessible, svsNoWrapLineStart]
Expand Down Expand Up @@ -3326,7 +3326,7 @@ procedure TCompileForm.UpdateOccurrenceIndicators(const AMemo: TCompScintEdit);
{ Don't add indicators on lines which have a line marker }
var Line := AMemo.GetLineFromPosition(FoundRange.StartPos);
var Markers := AMemo.GetMarkers(Line);
if Markers * [mmLineError, mmLineBreakpointBad, mmLineStep] <> [] then
if Markers * [mlmError, mlmBreakpointBad, mlmStep] <> [] then
Continue;

{ Add indicator while making sure it does not overlap any regular selection
Expand Down Expand Up @@ -3368,7 +3368,7 @@ procedure TCompileForm.UpdateOccurrenceIndicators(const AMemo: TCompScintEdit);
FindTextAndAddRanges(AMemo, TextToIndicate, GetWordOccurrenceFindOptions, SelectionRanges, IndicatorRanges);
end;
end;
AMemo.UpdateIndicators(IndicatorRanges, inWordAtCursorOccurrence);
AMemo.UpdateIndicators(IndicatorRanges, minWordAtCursorOccurrence);

IndicatorRanges.Clear;
if FOptions.HighlightSelTextOccurrences and MainSelNotEmpty and MainSelSingleLine then begin
Expand All @@ -3377,7 +3377,7 @@ procedure TCompileForm.UpdateOccurrenceIndicators(const AMemo: TCompScintEdit);
AMemo.GetSelections(SelectionRanges);
FindTextAndAddRanges(AMemo, TextToIndicate, GetSelTextOccurrenceFindOptions,SelectionRanges, IndicatorRanges);
end;
AMemo.UpdateIndicators(IndicatorRanges, inSelTextOccurrence);
AMemo.UpdateIndicators(IndicatorRanges, minSelTextOccurrence);
finally
SelectionRanges.Free;
IndicatorRanges.Free;
Expand Down Expand Up @@ -3484,13 +3484,13 @@ procedure TCompileForm.UpdateMarginsIcons;
var BitmapInfo := CreateBitmapInfo(ImageList.Width, -ImageList.Height, 32);

var NamedMarkers := [
NM(mmIconHasEntry, 'debug-stop-filled'),
NM(mmIconEntryProcessed, 'debug-stop-filled_2'),
NM(mmIconBreakpoint, 'debug-breakpoint-filled'),
NM(mmIconBreakpointBad, 'debug-breakpoint-filled-cancel-2'),
NM(mmIconBreakpointGood, 'debug-breakpoint-filled-ok-2'),
NM(mmIconStep, 'symbol-arrow-right'),
NM(mmIconBreakpointStep, 'debug-breakpoint-filled-ok2-symbol-arrow-right'),
NM(mimHasEntry, 'debug-stop-filled'),
NM(mimEntryProcessed, 'debug-stop-filled_2'),
NM(mimBreakpoint, 'debug-breakpoint-filled'),
NM(mimBreakpointBad, 'debug-breakpoint-filled-cancel-2'),
NM(mimBreakpointGood, 'debug-breakpoint-filled-ok-2'),
NM(mimStep, 'symbol-arrow-right'),
NM(mimBreakpointStep, 'debug-breakpoint-filled-ok2-symbol-arrow-right'),
NM(SC_MARKNUM_FOLDER, 'symbol-add'),
NM(SC_MARKNUM_FOLDEROPEN, 'symbol-remove')];

Expand Down Expand Up @@ -3855,7 +3855,7 @@ procedure TCompileForm.MoveCaretAndActivateMemo(AMemo: TCompScintEdit; const Lin
else
Pos := AMemo.CaretPosition; { Not actually moving caret - it's already were we want it}

{ If the line is in a collapsed section, expand it }
{ If the line is in a contracted section, expand it }
AMemo.EnsureLineVisible(AMemo.GetLineFromPosition(Pos));

{ If the line isn't in view, scroll so that it's in the center }
Expand Down Expand Up @@ -4241,9 +4241,9 @@ procedure TCompileForm.MemoUpdateUI(Sender: TObject; Updated: TScintEditUpdates)
Pos := AMemo.CaretPosition;
Value := False;
if AMemo.CaretVirtualSpace = 0 then begin
Value := AMemo.GetIndicatorAtPosition(inPendingSquiggly, Pos);
Value := AMemo.GetIndicatorAtPosition(minPendingSquiggly, Pos);
if not Value and (Pos > 0) then
Value := AMemo.GetIndicatorAtPosition(inPendingSquiggly, Pos-1);
Value := AMemo.GetIndicatorAtPosition(minPendingSquiggly, Pos-1);
end;
if FOnPendingSquiggly <> Value then begin
FOnPendingSquiggly := Value;
Expand Down Expand Up @@ -6710,18 +6710,18 @@ procedure TCompileForm.UpdateLineMarkers(const AMemo: TCompScintFileEdit; const
NewMarker := -1;
if AMemo.BreakPoints.IndexOf(Line) <> -1 then begin
if AMemo.LineState = nil then
NewMarker := mmIconBreakpoint
NewMarker := mimBreakpoint
else if (Line < AMemo.LineStateCount) and (AMemo.LineState[Line] <> lnUnknown) then
NewMarker := IfThen(StepLine, mmIconBreakpointStep, mmIconBreakpointGood)
NewMarker := IfThen(StepLine, mimBreakpointStep, mimBreakpointGood)
else
NewMarker := mmIconBreakpointBad;
NewMarker := mimBreakpointBad;
end else if StepLine then
NewMarker := mmIconStep
NewMarker := mimStep
else begin
if Line < AMemo.LineStateCount then begin
case AMemo.LineState[Line] of
lnHasEntry: NewMarker := mmIconHasEntry;
lnEntryProcessed: NewMarker := mmIconEntryProcessed;
lnHasEntry: NewMarker := mimHasEntry;
lnEntryProcessed: NewMarker := mimEntryProcessed;
end;
end;
end;
Expand All @@ -6735,11 +6735,11 @@ procedure TCompileForm.UpdateLineMarkers(const AMemo: TCompScintFileEdit; const
AMemo.AddMarker(Line, NewMarker);

if StepLine then
AMemo.AddMarker(Line, mmLineStep)
AMemo.AddMarker(Line, mlmStep)
else if AMemo.ErrorLine = Line then
AMemo.AddMarker(Line, mmLineError)
else if NewMarker = mmIconBreakpointBad then
AMemo.AddMarker(Line, mmLineBreakpointBad);
AMemo.AddMarker(Line, mlmError)
else if NewMarker = mimBreakpointBad then
AMemo.AddMarker(Line, mlmBreakpointBad);
end;

procedure TCompileForm.UpdateAllMemoLineMarkers(const AMemo: TCompScintFileEdit);
Expand Down
Loading

0 comments on commit 98349cd

Please sign in to comment.