From 83f50b6c2491330b0249737edf2f244107f64e41 Mon Sep 17 00:00:00 2001 From: Tom Willwerth Date: Sun, 19 Apr 2026 15:05:47 -0400 Subject: [PATCH] Fix off by one regression --- README.md | 2 +- SSMSExecutor/Executor.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7eaadfa..8a9bb2f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # SSMS Executor -SQL Server Management Studio (SSMS) extension for executing the current statement based on the cursor position — no need to highlight text first. +SQL Server Management Studio (SSMS) extension for executing the current statement based on the cursor position - no need to highlight text first. ## Features diff --git a/SSMSExecutor/Executor.cs b/SSMSExecutor/Executor.cs index 444c2f3..d468ed7 100644 --- a/SSMSExecutor/Executor.cs +++ b/SSMSExecutor/Executor.cs @@ -126,7 +126,7 @@ private bool IsCaretInsideStatement(TSqlStatement statement, VirtualPoint caret) if (caret.Line >= ft.Line && caret.Line <= lt.Line) { - var isBeforeFirstToken = caret.Line == ft.Line && caret.LineCharOffset < ft.Column + 1; + var isBeforeFirstToken = caret.Line == ft.Line && caret.LineCharOffset < ft.Column; var isAfterLastToken = caret.Line == lt.Line && caret.LineCharOffset > lt.Column + lt.Text.Length; if (!(isBeforeFirstToken || isAfterLastToken)) @@ -148,13 +148,13 @@ private TextBlock GetTextBlockFromStatement(TSqlStatement statement) StartPoint = new VirtualPoint { Line = ft.Line, - LineCharOffset = ft.Column + 1 + LineCharOffset = ft.Column }, EndPoint = new VirtualPoint { Line = lt.Line, - LineCharOffset = lt.Column + lt.Text.Length + 1 + LineCharOffset = lt.Column + lt.Text.Length } }; }