From 44873cf088da0101fcc2a0336a6715cd6b3a13c6 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 29 Jul 2021 17:09:07 +0800 Subject: [PATCH] fix: fix compile error on .NET 4.8 --- src/Commands/Diff.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Commands/Diff.cs b/src/Commands/Diff.cs index da5681d2..263bde30 100644 --- a/src/Commands/Diff.cs +++ b/src/Commands/Diff.cs @@ -24,12 +24,21 @@ namespace SourceGit.Commands { var chunks = new List(); for (int i = 0; i < size; i++) { +#if NET48 + var ch = text.Substring(i, 1); + if (WORD_SEPS.Contains(ch)) { + if (start != i) chunks.Add(text.Substring(start, i - start)); + chunks.Add(ch); + start = i + 1; + } +#else var ch = text[i]; if (WORD_SEPS.Contains(ch)) { if (start != i) chunks.Add(text.Substring(start, i - start)); chunks.Add(text.Substring(i, 1)); start = i + 1; } +#endif } if (start < size) chunks.Add(text.Substring(start));