Skip to content

Commit a3496a9

Browse files
committed
fix: virtual space not include (#364)
1 parent ed7465d commit a3496a9

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/Views/TextDiffView.axaml.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -183,31 +183,25 @@ public void Draw(TextView textView, DrawingContext drawingContext)
183183
var processingIdxEnd = 0;
184184
var nextHightlight = 0;
185185

186-
var cloned = new List<Models.TextInlineRange>();
187-
cloned.AddRange(info.Highlights);
188-
189186
foreach (var tl in line.TextLines)
190187
{
191188
processingIdxEnd += tl.Length;
192189

193190
var y = line.GetTextLineVisualYPosition(tl, VisualYPosition.LineTop) - textView.VerticalOffset;
194-
var height = line.GetTextLineVisualYPosition(tl, VisualYPosition.LineBottom) - textView.VerticalOffset - y;
191+
var h = line.GetTextLineVisualYPosition(tl, VisualYPosition.LineBottom) - textView.VerticalOffset - y;
195192

196-
while (nextHightlight < cloned.Count)
193+
while (nextHightlight < info.Highlights.Count)
197194
{
198-
var highlight = cloned[nextHightlight];
195+
var highlight = info.Highlights[nextHightlight];
199196
if (highlight.Start >= processingIdxEnd)
200-
{
201-
processingIdxStart = processingIdxEnd;
202197
break;
203-
}
204198

205-
var start = highlight.Start < processingIdxStart ? processingIdxStart : highlight.Start;
206-
var end = highlight.End >= processingIdxEnd ? processingIdxEnd : highlight.End + 1;
199+
var start = line.GetVisualColumn(highlight.Start < processingIdxStart ? processingIdxStart : highlight.Start);
200+
var end = line.GetVisualColumn(highlight.End >= processingIdxEnd ? processingIdxEnd : highlight.End + 1);
207201

208202
var x = line.GetTextLineVisualXPosition(tl, start) - textView.HorizontalOffset;
209203
var w = line.GetTextLineVisualXPosition(tl, end) - textView.HorizontalOffset - x;
210-
var rect = new Rect(x, y, w, height);
204+
var rect = new Rect(x, y, w, h);
211205
drawingContext.DrawRectangle(highlightBG, null, rect);
212206

213207
if (highlight.End >= processingIdxEnd)

0 commit comments

Comments
 (0)