From 8cb5b1f0e9fa4292113848aead5bf1fd8c06b877 Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 30 Aug 2013 15:25:38 +0400 Subject: [PATCH] fix #1580 Mouse SelectByLines does not select ending char --- lib/ace/autocomplete.js | 4 +--- lib/ace/selection.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/ace/autocomplete.js b/lib/ace/autocomplete.js index 8800cab2..16707595 100644 --- a/lib/ace/autocomplete.js +++ b/lib/ace/autocomplete.js @@ -171,14 +171,12 @@ var Autocomplete = function() { var lower = needle.toLowerCase(); loop: for (var i = 0, item; item = items[i]; i++) { var caption = item.value || item.caption; + if (!caption) continue; var lastIndex = -1; var matchMask = 0; var penalty = 0; var index, distance; // caption char iteration is faster in Chrome but slower in Firefox, so lets use indexOf - if (!caption) { - continue loop - } for (var j = 0; j < needle.length; j++) { // TODO add penalty on case mismatch var i1 = caption.indexOf(lower[j], lastIndex + 1); diff --git a/lib/ace/selection.js b/lib/ace/selection.js index ad1163a4..d3dab831 100644 --- a/lib/ace/selection.js +++ b/lib/ace/selection.js @@ -421,7 +421,7 @@ var Selection = function(session) { } else { rowEnd = rowStart; } - if (excludeLastChar) + if (excludeLastChar === true) return new Range(rowStart, 0, rowEnd, this.session.getLine(rowEnd).length); else return new Range(rowStart, 0, rowEnd + 1, 0);