From 8113476dd7d0fa5c43bb3693aa1774e9e827ba36 Mon Sep 17 00:00:00 2001 From: Linquize Date: Sun, 21 Feb 2016 23:35:41 +0800 Subject: [PATCH] Fix Selected line count is 0 while the selection is on one line fixes #1521, closes #1522 --- .../src/ScitillaComponent/ScintillaEditView.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index 7e930a253..095c4a6c0 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -466,18 +466,18 @@ public: // return false if it's multi-selection or rectangle selection if ((execute(SCI_GETSELECTIONS) > 1) || execute(SCI_SELECTIONISRECTANGLE)) return false; - long start = long(execute(SCI_GETSELECTIONSTART)); - long end = long(execute(SCI_GETSELECTIONEND)); - selByte = end - start; + long pStart = long(execute(SCI_GETSELECTIONSTART)); + long pEnd = long(execute(SCI_GETSELECTIONEND)); + selByte = pEnd - pStart; - start = long(execute(SCI_LINEFROMPOSITION, start)); - end = long(execute(SCI_LINEFROMPOSITION, end)); - selLine = end - start; - if (selLine) + long lStart = long(execute(SCI_LINEFROMPOSITION, pStart)); + long lEnd = long(execute(SCI_LINEFROMPOSITION, pEnd)); + selLine = lEnd - lStart; + if (selLine || selByte) ++selLine; return true; - }; + }; long getSelectedLength() const {