@@ 2769-2778 (lines=10) @@ | ||
2766 | ||
2767 | var dir = ranges[index].head.ch - baseCh; |
|
2768 | var newDir = headCh - baseCh; |
|
2769 | if (dir > 0 && newDir <= 0) { |
|
2770 | baseCh++; |
|
2771 | if (!isClipped) { headCh--; } |
|
2772 | } else if (dir < 0 && newDir >= 0) { |
|
2773 | baseCh--; |
|
2774 | if (!wasClipped) { headCh++; } |
|
2775 | } else if (dir < 0 && newDir == -1) { |
|
2776 | baseCh--; |
|
2777 | headCh++; |
|
2778 | } |
|
2779 | for (var line = firstLine; line <= lastLine; line++) { |
|
2780 | var range = {anchor: new Pos(line, baseCh), head: new Pos(line, headCh)}; |
|
2781 | selections.push(range); |
@@ 33-41 (lines=9) @@ | ||
30 | var next = line.charAt(dir < 0 ? pos - 1 : pos); |
|
31 | var cat = next != "_" && CodeMirror.isWordChar(next) ? "w" : "o"; |
|
32 | if (cat == "w" && next.toUpperCase() == next) cat = "W"; |
|
33 | if (state == "start") { |
|
34 | if (cat != "o") { state = "in"; type = cat; } |
|
35 | } else if (state == "in") { |
|
36 | if (type != cat) { |
|
37 | if (type == "w" && cat == "W" && dir < 0) pos--; |
|
38 | if (type == "W" && cat == "w" && dir > 0) { type = "w"; continue; } |
|
39 | break; |
|
40 | } |
|
41 | } |
|
42 | } |
|
43 | return Pos(start.line, pos); |
|
44 | } |