MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / isInRange

Function isInRange

static/js/codemirror/keymap/vim.js:2168–2182  ·  view source on GitHub ↗

* Check if pos is in the specified range, INCLUSIVE. * Range can be specified with 1 or 2 arguments. * If the first range argument is an array, treat it as an array of line * numbers. Match pos against any of the lines. * If the first range argument is a number, * if there

(pos, start, end)

Source from the content-addressed store, hash-verified

2166 * range arguments.
2167 */
2168 function isInRange(pos, start, end) {
2169 if (typeof pos != 'number') {
2170 // Assume it is a cursor position. Get the line number.
2171 pos = pos.line;
2172 }
2173 if (start instanceof Array) {
2174 return inArray(pos, start);
2175 } else {
2176 if (end) {
2177 return (pos >= start && pos <= end);
2178 } else {
2179 return pos == start;
2180 }
2181 }
2182 }
2183
2184 // Ex command handling
2185 // Care must be taken when adding to the default Ex command map. For any

Callers 1

doReplaceFunction · 0.85

Calls 1

inArrayFunction · 0.85

Tested by

no test coverage detected