Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 8376d12

Browse files
authored
Merge branch 'master' into fixes/1777-single-line-description
2 parents 466017f + 47b4a44 commit 8376d12

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/GitHub.VisualStudio/Helpers/ActiveDocumentSnapshot.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using Microsoft.VisualStudio.TextManager.Interop;
44
using System;
55
using System.ComponentModel.Composition;
6-
using System.Diagnostics;
76
using GitHub.Logging;
87

98
namespace GitHub.VisualStudio
@@ -32,6 +31,17 @@ public ActiveDocumentSnapshot([Import(typeof(SVsServiceProvider))] IServiceProvi
3231
if (ErrorHandler.Succeeded(textManager.GetActiveView(0, null, out view)) &&
3332
ErrorHandler.Succeeded(view.GetSelection(out anchorLine, out anchorCol, out endLine, out endCol)))
3433
{
34+
// Ignore the bottom anchor or end line if it has zero width (starts on column 0)
35+
// This prevents non-visible parts of the selection from being inclused in the range
36+
if (anchorLine < endLine && endCol == 0)
37+
{
38+
endLine--;
39+
}
40+
else if (anchorLine > endLine && anchorCol == 0)
41+
{
42+
anchorLine--;
43+
}
44+
3545
StartLine = anchorLine + 1;
3646
EndLine = endLine + 1;
3747
}

0 commit comments

Comments
 (0)