Skip to content

Commit

Permalink
Aligned syntax highlighting in statusbar with coloring, depending on …
Browse files Browse the repository at this point in the history
…top/right cursor placement
  • Loading branch information
halvarsson committed Apr 26, 2024
1 parent a59c255 commit 750304f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion EditorContext/JSONEditorContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public override void ParseText(int height, int topRow, int left, int right, stri

if (colError != null)
{
ColumnErrors.TryAdd(new Point(idxCol, row), colError.ErrorMessage);
ColumnErrors.TryAdd(new Point(idxCol, idxRow), colError.ErrorMessage);
}

var jsonParseMatch = tokens[new Point(tokenCol, idxRow + 1)];
Expand Down
2 changes: 1 addition & 1 deletion EditorContext/PowerShellEditorContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public override void ParseText(int height, int topRow, int left, int right, stri

if (colError != null)
{
ColumnErrors.TryAdd(new Point(idxCol, row), colError.ErrorMessage);
ColumnErrors.TryAdd(new Point(idxCol, idxRow), colError.ErrorMessage);
}

if (rune == '\t')
Expand Down
5 changes: 3 additions & 2 deletions EditorTextView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,16 @@ public override void Redraw(Rect bounds)
if (editorContext != null)
{
var point = new Point(idxCol, row);
var errorPoint = new Point(idxCol, idxRow);
var color = editorContext.GetColorByPoint(point);

if (Selecting && PointInSelection(idxCol, idxRow))
{
Driver.SetAttribute(Terminal.Gui.Attribute.Make(color, Color.Blue));
}
else if (ColumnErrors.ContainsKey(point))
else if (ColumnErrors.ContainsKey(errorPoint))
{
Driver.SetAttribute(Terminal.Gui.Attribute.Make(color, Color.Red));
Driver.SetAttribute(Terminal.Gui.Attribute.Make(color, Color.Red));
}
else
{
Expand Down

0 comments on commit 750304f

Please sign in to comment.