MCPcopy
hub / github.com/nwutils/nw-sample-apps / selectWordAt

Function selectWordAt

mini-code-edit/cm/lib/codemirror.js:1301–1307  ·  view source on GitHub ↗
(pos)

Source from the content-addressed store, hash-verified

1299 }
1300
1301 function selectWordAt(pos) {
1302 var line = getLine(pos.line).text;
1303 var start = pos.ch, end = pos.ch;
1304 while (start > 0 && isWordChar(line.charAt(start - 1))) --start;
1305 while (end < line.length && isWordChar(line.charAt(end))) ++end;
1306 setSelectionUser({line: pos.line, ch: start}, {line: pos.line, ch: end});
1307 }
1308 function selectLine(line) {
1309 setSelectionUser({line: line, ch: 0}, clipPos({line: line + 1, ch: 0}));
1310 }

Callers 2

onMouseDownFunction · 0.85
onDoubleClickFunction · 0.85

Calls 3

getLineFunction · 0.85
isWordCharFunction · 0.85
setSelectionUserFunction · 0.85

Tested by

no test coverage detected