mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
feature: add +
/-
in line number to indicate type of change (#593)
This commit is contained in:
parent
06fd49ba92
commit
f6e1e65a53
1 changed files with 27 additions and 1 deletions
|
@ -105,6 +105,32 @@ namespace SourceGit.Views
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var y = line.GetTextLineVisualYPosition(line.TextLines[0], VisualYPosition.LineMiddle) - view.VerticalOffset;
|
var y = line.GetTextLineVisualYPosition(line.TextLines[0], VisualYPosition.LineMiddle) - view.VerticalOffset;
|
||||||
|
|
||||||
|
var prefix = null as FormattedText;
|
||||||
|
if (info.Type == Models.TextDiffLineType.Added)
|
||||||
|
{
|
||||||
|
prefix = new FormattedText(
|
||||||
|
"+",
|
||||||
|
CultureInfo.CurrentCulture,
|
||||||
|
FlowDirection.LeftToRight,
|
||||||
|
typeface,
|
||||||
|
presenter.FontSize,
|
||||||
|
Brushes.Green);
|
||||||
|
}
|
||||||
|
else if (info.Type == Models.TextDiffLineType.Deleted)
|
||||||
|
{
|
||||||
|
prefix = new FormattedText(
|
||||||
|
"-",
|
||||||
|
CultureInfo.CurrentCulture,
|
||||||
|
FlowDirection.LeftToRight,
|
||||||
|
typeface,
|
||||||
|
presenter.FontSize,
|
||||||
|
Brushes.Red);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prefix != null)
|
||||||
|
context.DrawText(prefix, new Point(0, y - prefix.Height * 0.5));
|
||||||
|
|
||||||
var txt = new FormattedText(
|
var txt = new FormattedText(
|
||||||
lineNumber,
|
lineNumber,
|
||||||
CultureInfo.CurrentCulture,
|
CultureInfo.CurrentCulture,
|
||||||
|
@ -126,7 +152,7 @@ namespace SourceGit.Views
|
||||||
var maxLineNumber = presenter.GetMaxLineNumber();
|
var maxLineNumber = presenter.GetMaxLineNumber();
|
||||||
var typeface = TextView.CreateTypeface();
|
var typeface = TextView.CreateTypeface();
|
||||||
var test = new FormattedText(
|
var test = new FormattedText(
|
||||||
$"{maxLineNumber}",
|
$"- {maxLineNumber}",
|
||||||
CultureInfo.CurrentCulture,
|
CultureInfo.CurrentCulture,
|
||||||
FlowDirection.LeftToRight,
|
FlowDirection.LeftToRight,
|
||||||
typeface,
|
typeface,
|
||||||
|
|
Loading…
Reference in a new issue