Browse Source

Fixed line selection calculation. Fixes #36.

woollybah 6 years ago
parent
commit
c06bdaf8f2
1 changed files with 2 additions and 2 deletions
  1. 2 2
      maxguitextareascintilla.mod/glue.c

+ 2 - 2
maxguitextareascintilla.mod/glue.c

@@ -320,8 +320,8 @@ int bmx_mgta_scintilla_getselectionlength(SCI_HANDLE sci, int units) {
 	if (units == 2) {
 		/* lines */
 		int startPos = scintilla_send_message(sci, SCI_LINEFROMPOSITION, scintilla_send_message(sci, SCI_GETSELECTIONSTART, 0, 0), 0);
-		int endPos = scintilla_send_message(sci, SCI_LINEFROMPOSITION, scintilla_send_message(sci, SCI_GETSELECTIONEND, 0, 0), 0);
-		return endPos - startPos;
+		int endPos = scintilla_send_message(sci, SCI_LINEFROMPOSITION, scintilla_send_message(sci, SCI_GETSELECTIONEND, 0, 0) - 1, 0);
+		return (endPos - startPos) + 1;
 	} else {
 		/* chars */
 		int startPos = scintilla_send_message(sci, SCI_GETSELECTIONSTART, 0, 0);