Takes the primary selection, expands it to a word range if necessary, then sets the selection to
include all instances of that range. Removes all other selections. Does nothing if the selection
is not a range after expansion.
513834
function _findAllAndSelect(editor) {
        editor = editor || EditorManager.getActiveEditor();
        if (!editor) {
            return;
        }

        var sel = editor.getSelection(),
            newSelections = [];
        if (CodeMirror.cmpPos(sel.start, sel.end) === 0) {
            sel = _getWordAt(editor, sel.start);
        }
        if (CodeMirror.cmpPos(sel.start, sel.end) !== 0) {
            var searchStart = {line: 0, ch: 0},
                state = getSearchState(editor._codeMirror),
                nextMatch;
            setQueryInfo(state, { query: editor.document.getRange(sel.start, sel.end), isCaseSensitive: false, isRegexp: false });

            while ((nextMatch = _getNextMatch(editor, false, searchStart, false)) !== null) {
                if (_selEq(sel, nextMatch)) {
                    nextMatch.primary = true;
                }
                newSelections.push(nextMatch);
                searchStart = nextMatch.end;
            }

            // This should find at least the original selection, but just in case...
            if (newSelections.length) {
                // Don't change the scroll position.
                editor.setSelections(newSelections, false);
            }
        }
    }
591133
function clearSelection () {
                    if ($window.getSelection) {
                        if ($window.getSelection().empty) {  // Chrome
                            $window.getSelection().empty();
                        } else if ($window.getSelection().removeAllRanges) {  // Firefox
                            $window.getSelection().removeAllRanges();
                        }
                    } else if ($document.selection) {  // IE?
                        $document.selection.empty();
                    }
                }
839681
function normalizeSelection(ranges, primIndex) {
    var prim = ranges[primIndex];
    ranges.sort(function(a, b) { return cmp(a.from(), b.from()); });
    primIndex = indexOf(ranges, prim);
    for (var i = 1; i < ranges.length; i++) {
      var cur = ranges[i], prev = ranges[i - 1];
      if (cmp(prev.to(), cur.from()) >= 0) {
        var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
        var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
        if (i <= primIndex) --primIndex;
        ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
      }
    }
    return new Selection(ranges, primIndex);
  }
539795
function () {
            var self = this;
            self.set('expanded', true);
            util.each(self.get('children'), function (c) {
                c.expandAll();
            });
        }
88231
def clear_selection(self):
        """"""
        cursor = self.textCursor()
        cursor.clearSelection()
        self.setTextCursor(cursor)
914828
def _expand(self):
        
        assert not self._free  # free pool is empty
        expand_end = self._expand_start + self._expand_len
        if expand_end > self._range_end:
            # This happens if the size of the value range is not a multiple
            # of the expansion chunk size.
            expand_end = self._range_end
        if self._expand_start == expand_end:
            raise ValueError("Out of capacity in ID pool")
        self._free = set(range(self._expand_start, expand_end))
        self._expand_start = expand_end
429168
public <T extends IItem & IExpandable> void selectRange(int from, int to, boolean select) {
        selectRange(from, to, select, false);
    }
192492
def _bselect(self, selection, start_bindex, end_bindex):
        
        selection.select(self._model.index2qindexb(start_bindex), self._model.index2qindexb(end_bindex))
        selection.select(self._model.index2qindexc(start_bindex), self._model.index2qindexc(end_bindex))
322007
function() {
		// "Let target be the body element of the context object."
		var target = document.body;

		// "If target is null, let target be the context object's
		// documentElement."
		if (!target) {
			target = document.documentElement;
		}

		// "If target is null, call getSelection() on the context object, and
		// call removeAllRanges() on the result."
		if (!target) {
			getSelection().removeAllRanges();

		// "Otherwise, call getSelection() on the context object, and call
		// selectAllChildren(target) on the result."
		} else {
			getSelection().selectAllChildren(target);
		}
	}
505414
public void setRangeList(int i, Annotation v) { 
    if (OntRelationMention_Type.featOkTst && ((OntRelationMention_Type)jcasType).casFeat_rangeList == null)
      jcasType.jcas.throwFeatMissing("rangeList", "de.julielab.jules.types.OntRelationMention");
    jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((OntRelationMention_Type)jcasType).casFeatCode_rangeList), i);
    jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((OntRelationMention_Type)jcasType).casFeatCode_rangeList), i, jcasType.ll_cas.ll_getFSRef(v));}
357673
private void changeReplicas(PrimaryTerm term) {
    threadContext.execute(() -> {
      if (this.term == null || term.term() > this.term.term()) {
        this.term = term;
      }
    });
  }
741874
@Override
  protected void removeRange(int fromIndex, int toIndex) {
    rangeCheck(fromIndex, toIndex);
    for (int i = fromIndex, j = toIndex; j < size; j++) {
      elements[i] = elements[j];
    }
    size -= (toIndex - fromIndex);
  }
55083
function () {
      const range = d.createRange();
      const selection = window.getSelection();

      range.selectNodeContents($sgCodeFill[0]);
      selection.removeAllRanges();
      selection.addRange(range);
    }
284791
function (element, closeAll) {
        var expanded = typeof closeAll !== 'undefined' ? closeAll : childRulesExpanded(element);

        if (expanded) {
            element.textContent = 'close all';
            element.classList.remove('closed');
            element.classList.add('expanded');
        } else {
            element.textContent = 'expand all';
            element.classList.remove('expanded');
            element.classList.add('closed');
        }
    }
1344023
protected void moveSelectionBottom() {
		final IStructuredSelection selection = this.list.getStructuredSelection();
		final int index = this.conversions.indexOf(selection.getFirstElement());
		if (index >= 0 && (index + selection.size()) < this.conversions.size()) {
			for (int i = 0; i < selection.size(); ++i) {
				final ConversionMapping previous = this.conversions.remove(index);
				this.conversions.addLast(previous);
			}
			refreshListUI();
			this.list.refresh(true);
			enableButtons();
			preferenceValueChanged();
		}
	}
1261559
def select_all!(*str_or_rx)
      results = str_or_rx.flatten.map { |v| select_by!(v, :multiple) }
      results.first
    end
788347
function () {
            var t = this,
                documentSelection = t.doc.getSelection();

            t.range = null;

            if (!documentSelection || !documentSelection.rangeCount) {
                return;
            }

            var savedRange = t.range = documentSelection.getRangeAt(0),
                range = t.doc.createRange(),
                rangeStart;
            range.selectNodeContents(t.$ed[0]);
            range.setEnd(savedRange.startContainer, savedRange.startOffset);
            rangeStart = (range + '').length;
            t.metaRange = {
                start: rangeStart,
                end: rangeStart + (savedRange + '').length
            };
        }