mirror of
https://github.com/slap-editor/slap.git
synced 2024-09-19 16:57:26 +03:00
Fixes double clicking on first character of word
This commit is contained in:
parent
593ffa2834
commit
96f55c4fc3
@ -630,16 +630,14 @@ Editor.prototype._initHandlers = function () {
|
||||
var startX = mouse.x;
|
||||
var endX = mouse.x + 1;
|
||||
var prev = word.prev(line, mouse.x);
|
||||
if (prev) {
|
||||
if (prev.index < mouse.x && mouse.x < prev.index + prev[0].length) {
|
||||
var current = word.current(line, mouse.x);
|
||||
if (current) {
|
||||
if (prev && current.index < prev.index + prev[0].length) {
|
||||
startX = prev.index;
|
||||
endX = prev.index + prev[0].length;
|
||||
} else {
|
||||
var current = word.current(line, mouse.x);
|
||||
if (current && current.index === mouse.x) {
|
||||
startX = current.index;
|
||||
endX = current.index + current[0].length;
|
||||
}
|
||||
} else if (current.index <= mouse.x && mouse.x < current.index + current[0].length) {
|
||||
startX = current.index;
|
||||
endX = current.index + current[0].length;
|
||||
}
|
||||
}
|
||||
self.select({x: startX, y: mouse.y}, {x: endX, y: mouse.y});
|
||||
|
Loading…
Reference in New Issue
Block a user