Both selection edges is on emphasis, delete all internal markers

@param change
@param focusKey
@param characters
@param text
@param accent
@param startOffset
@param endOffset
@param markerLength
435937
function unionEmphasis({ change, focusKey, characters, accent, text, startOffset, endOffset, markerLength }) {
  const leftEmphEdge = getLeftEmphEdge(accent, characters, startOffset);
  const rightEmphEdge = getRightEmphEdge(accent, characters, endOffset - 1, text.length);
  const leftMarker = text.substr(leftEmphEdge, markerLength);
  let rightMarkerPos = rightEmphEdge - markerLength;
  const rightMarker = text.substr(rightMarkerPos, markerLength);
  const delCount = delInternalMarkers({
    change,
    focusKey,
    characters,
    accent,
    startPos: leftEmphEdge + markerLength,
    endPos: rightEmphEdge - markerLength
  });
  rightMarkerPos -= delCount * markerLength - 1;
  if (leftMarker !== rightMarker) {
    change.removeTextByKey(focusKey, rightMarkerPos, markerLength).
      insertTextByKey(focusKey, rightMarkerPos, leftMarker);
  }
  return change;
}
97416
public void markAnnotation(String annotation, int lineno, int charno) {
    JSDocInfo.Marker marker = currentInfo.addMarker();

    if (marker != null) {
      JSDocInfo.TrimmedStringPosition position =
          new JSDocInfo.TrimmedStringPosition();
      position.setItem(annotation);
      position.setPositionInformation(lineno, charno, lineno,
          charno + annotation.length());
      marker.setAnnotation(position);
      populated = true;
    }

    currentMarker = marker;
  }
84571
public MultiChangeBuilder<PS, SEG, S> deleteText(int start, int end) {
        return replaceText(start, end, "");
    }
784639
function markText(doc, from, to, options, type) {
    // Shared markers (across linked documents) are handled separately
    // (markTextShared will call out to this again, once per
    // document).
    if (options && options.shared) return markTextShared(doc, from, to, options, type);
    // Ensure we are in an operation.
    if (doc.cm && !doc.cm.curOp) return operation(doc.cm, markText)(doc, from, to, options, type);

    var marker = new TextMarker(doc, type), diff = cmp(from, to);
    if (options) copyObj(options, marker, false);
    // Don't connect empty markers unless clearWhenEmpty is false
    if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
      return marker;
    if (marker.replacedWith) {
      // Showing up as a widget implies collapsed (widget replaces text)
      marker.collapsed = true;
      marker.widgetNode = elt("span", [marker.replacedWith], "CodeMirror-widget");
      if (!options.handleMouseEvents) marker.widgetNode.setAttribute("cm-ignore-events", "true");
      if (options.insertLeft) marker.widgetNode.insertLeft = true;
    }
    if (marker.collapsed) {
      if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
          from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
        throw new Error("Inserting collapsed marker partially overlapping an existing one");
      sawCollapsedSpans = true;
    }

    if (marker.addToHistory)
      addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN);

    var curLine = from.line, cm = doc.cm, updateMaxLine;
    doc.iter(curLine, to.line + 1, function(line) {
      if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
        updateMaxLine = true;
      if (marker.collapsed && curLine != from.line) updateLineHeight(line, 0);
      addMarkedSpan(line, new MarkedSpan(marker,
                                         curLine == from.line ? from.ch : null,
                                         curLine == to.line ? to.ch : null));
      ++curLine;
    });
    // lineIsHidden depends on the presence of the spans, so needs a second pass
    if (marker.collapsed) doc.iter(from.line, to.line + 1, function(line) {
      if (lineIsHidden(doc, line)) updateLineHeight(line, 0);
    });

    if (marker.clearOnEnter) on(marker, "beforeCursorEnter", function() { marker.clear(); });

    if (marker.readOnly) {
      sawReadOnlySpans = true;
      if (doc.history.done.length || doc.history.undone.length)
        doc.clearHistory();
    }
    if (marker.collapsed) {
      marker.id = ++nextMarkerId;
      marker.atomic = true;
    }
    if (cm) {
      // Sync editor state
      if (updateMaxLine) cm.curOp.updateMaxLine = true;
      if (marker.collapsed)
        regChange(cm, from.line, to.line + 1);
      else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)
        for (var i = from.line; i <= to.line; i++) regLineChange(cm, i, "text");
      if (marker.atomic) reCheckSelection(cm.doc);
      signalLater(cm, "markerAdded", cm, marker);
    }
    return marker;
  }
986641
function(_event){
                var _code = _event.keyCode;
                if (_code === 65 && _event[SELECT_ALL_MODIFIER] && !_event.shiftKey && !_event.altKey || // Ctrl-A or Cmd-A
                    _code >= 37 && _code <= 40 || // arrow key
                    _event.ctrlKey && MAC && MAC_MOVE_KEYS.indexOf(_code) >= 0) {
                  if (!HAS_OWN_SELECTION[_event.target.tagName]) {
                    setTimeout(_dispatchIfChanged.bind(null, this), 0);
                  }
                }
            }
446093
@Override
  public void remove( int offset, int length ) throws BadLocationException
  {
    super.remove( offset, length );
    processChangedLines( offset, 0 );
  }
726831
function deleteSelection(flags) {
	if (flags === undefined) {
		flags = {};
	}

	var blockMerging = "blockMerging" in flags ? Boolean(flags.blockMerging) : true;
	var stripWrappers = "stripWrappers" in flags ? Boolean(flags.stripWrappers) : true;
	var direction = "direction" in flags ? flags.direction : "forward";

	// "If the active range is null, abort these steps and do nothing."
	if (!getActiveRange()) {
		return;
	}

	// "Canonicalize whitespace at the active range's start."
	canonicalizeWhitespace(getActiveRange().startContainer, getActiveRange().startOffset);

	// "Canonicalize whitespace at the active range's end."
	canonicalizeWhitespace(getActiveRange().endContainer, getActiveRange().endOffset);

	// "Let (start node, start offset) be the last equivalent point for the
	// active range's start."
	var start = getLastEquivalentPoint(getActiveRange().startContainer, getActiveRange().startOffset);
	var startNode = start[0];
	var startOffset = start[1];

	// "Let (end node, end offset) be the first equivalent point for the active
	// range's end."
	var end = getFirstEquivalentPoint(getActiveRange().endContainer, getActiveRange().endOffset);
	var endNode = end[0];
	var endOffset = end[1];

	// "If (end node, end offset) is not after (start node, start offset):"
	if (getPosition(endNode, endOffset, startNode, startOffset) !== "after") {
		// "If direction is "forward", call collapseToStart() on the context
		// object's Selection."
		//
		// Here and in a few other places, we check rangeCount to work around a
		// WebKit bug: it will sometimes incorrectly remove ranges from the
		// selection if nodes are removed, so collapseToStart() will throw.
		// This will break everything if we're using an actual selection, but
		// if getActiveRange() is really just returning globalRange and that's
		// all we care about, it will work fine.  I only add the extra check
		// for errors I actually hit in testing.
		if (direction == "forward") {
			if (getSelection().rangeCount) {
				getSelection().collapseToStart();
			}
			getActiveRange().collapse(true);

		// "Otherwise, call collapseToEnd() on the context object's Selection."
		} else {
			getSelection().collapseToEnd();
			getActiveRange().collapse(false);
		}

		// "Abort these steps."
		return;
	}

	// "If start node is a Text node and start offset is 0, set start offset to
	// the index of start node, then set start node to its parent."
	if (startNode.nodeType == Node.TEXT_NODE
	&& startOffset == 0) {
		startOffset = getNodeIndex(startNode);
		startNode = startNode.parentNode;
	}

	// "If end node is a Text node and end offset is its length, set end offset
	// to one plus the index of end node, then set end node to its parent."
	if (endNode.nodeType == Node.TEXT_NODE
	&& endOffset == getNodeLength(endNode)) {
		endOffset = 1 + getNodeIndex(endNode);
		endNode = endNode.parentNode;
	}

	// "Call collapse(start node, start offset) on the context object's
	// Selection."
	getSelection().collapse(startNode, startOffset);
	getActiveRange().setStart(startNode, startOffset);

	// "Call extend(end node, end offset) on the context object's Selection."
	getSelection().extend(endNode, endOffset);
	getActiveRange().setEnd(endNode, endOffset);

	// "Let start block be the active range's start node."
	var startBlock = getActiveRange().startContainer;

	// "While start block's parent is in the same editing host and start block
	// is an inline node, set start block to its parent."
	while (inSameEditingHost(startBlock, startBlock.parentNode)
	&& isInlineNode(startBlock)) {
		startBlock = startBlock.parentNode;
	}

	// "If start block is neither a block node nor an editing host, or "span"
	// is not an allowed child of start block, or start block is a td or th,
	// set start block to null."
	if ((!isBlockNode(startBlock) && !isEditingHost(startBlock))
	|| !isAllowedChild("span", startBlock)
	|| isHtmlElement(startBlock, ["td", "th"])) {
		startBlock = null;
	}

	// "Let end block be the active range's end node."
	var endBlock = getActiveRange().endContainer;

	// "While end block's parent is in the same editing host and end block is
	// an inline node, set end block to its parent."
	while (inSameEditingHost(endBlock, endBlock.parentNode)
	&& isInlineNode(endBlock)) {
		endBlock = endBlock.parentNode;
	}

	// "If end block is neither a block node nor an editing host, or "span" is
	// not an allowed child of end block, or end block is a td or th, set end
	// block to null."
	if ((!isBlockNode(endBlock) && !isEditingHost(endBlock))
	|| !isAllowedChild("span", endBlock)
	|| isHtmlElement(endBlock, ["td", "th"])) {
		endBlock = null;
	}

	// "Record current states and values, and let overrides be the result."
	var overrides = recordCurrentStatesAndValues();

	// "If start node and end node are the same, and start node is an editable
	// Text node:"
	if (startNode == endNode
	&& isEditable(startNode)
	&& startNode.nodeType == Node.TEXT_NODE) {
		// "Call deleteData(start offset, end offset âˆ’ start offset) on start
		// node."
		startNode.deleteData(startOffset, endOffset - startOffset);

		// "Canonicalize whitespace at (start node, start offset), with fix
		// collapsed space false."
		canonicalizeWhitespace(startNode, startOffset, false);

		// "If direction is "forward", call collapseToStart() on the context
		// object's Selection."
		if (direction == "forward") {
			if (getSelection().rangeCount) {
				getSelection().collapseToStart();
			}
			getActiveRange().collapse(true);

		// "Otherwise, call collapseToEnd() on the context object's Selection."
		} else {
			getSelection().collapseToEnd();
			getActiveRange().collapse(false);
		}

		// "Restore states and values from overrides."
		restoreStatesAndValues(overrides);

		// "Abort these steps."
		return;
	}

	// "If start node is an editable Text node, call deleteData() on it, with
	// start offset as the first argument and (length of start node âˆ’ start
	// offset) as the second argument."
	if (isEditable(startNode)
	&& startNode.nodeType == Node.TEXT_NODE) {
		startNode.deleteData(startOffset, getNodeLength(startNode) - startOffset);
	}

	// "Let node list be a list of nodes, initially empty."
	//
	// "For each node contained in the active range, append node to node list
	// if the last member of node list (if any) is not an ancestor of node;
	// node is editable; and node is not a thead, tbody, tfoot, tr, th, or td."
	var nodeList = getContainedNodes(getActiveRange(),
		function(node) {
			return isEditable(node)
				&& !isHtmlElement(node, ["thead", "tbody", "tfoot", "tr", "th", "td"]);
		}
	);

	// "For each node in node list:"
	for (var i = 0; i < nodeList.length; i++) {
		var node = nodeList[i];

		// "Let parent be the parent of node."
		var parent_ = node.parentNode;

		// "Remove node from parent."
		parent_.removeChild(node);

		// "If the block node of parent has no visible children, and parent is
		// editable or an editing host, call createElement("br") on the context
		// object and append the result as the last child of parent."
		if (![].some.call(getBlockNodeOf(parent_).childNodes, isVisible)
		&& (isEditable(parent_) || isEditingHost(parent_))) {
			parent_.appendChild(document.createElement("br"));
		}

		// "If strip wrappers is true or parent is not an ancestor container of
		// start node, while parent is an editable inline node with length 0,
		// let grandparent be the parent of parent, then remove parent from
		// grandparent, then set parent to grandparent."
		if (stripWrappers
		|| (!isAncestor(parent_, startNode) && parent_ != startNode)) {
			while (isEditable(parent_)
			&& isInlineNode(parent_)
			&& getNodeLength(parent_) == 0) {
				var grandparent = parent_.parentNode;
				grandparent.removeChild(parent_);
				parent_ = grandparent;
			}
		}
	}

	// "If end node is an editable Text node, call deleteData(0, end offset) on
	// it."
	if (isEditable(endNode)
	&& endNode.nodeType == Node.TEXT_NODE) {
		endNode.deleteData(0, endOffset);
	}

	// "Canonicalize whitespace at the active range's start, with fix collapsed
	// space false."
	canonicalizeWhitespace(getActiveRange().startContainer, getActiveRange().startOffset, false);

	// "Canonicalize whitespace at the active range's end, with fix collapsed
	// space false."
	canonicalizeWhitespace(getActiveRange().endContainer, getActiveRange().endOffset, false);

	// "If block merging is false, or start block or end block is null, or
	// start block is not in the same editing host as end block, or start block
	// and end block are the same:"
	if (!blockMerging
	|| !startBlock
	|| !endBlock
	|| !inSameEditingHost(startBlock, endBlock)
	|| startBlock == endBlock) {
		// "If direction is "forward", call collapseToStart() on the context
		// object's Selection."
		if (direction == "forward") {
			if (getSelection().rangeCount) {
				getSelection().collapseToStart();
			}
			getActiveRange().collapse(true);

		// "Otherwise, call collapseToEnd() on the context object's Selection."
		} else {
			if (getSelection().rangeCount) {
				getSelection().collapseToEnd();
			}
			getActiveRange().collapse(false);
		}

		// "Restore states and values from overrides."
		restoreStatesAndValues(overrides);

		// "Abort these steps."
		return;
	}

	// "If start block has one child, which is a collapsed block prop, remove
	// its child from it."
	if (startBlock.children.length == 1
	&& isCollapsedBlockProp(startBlock.firstChild)) {
		startBlock.removeChild(startBlock.firstChild);
	}

	// "If start block is an ancestor of end block:"
	if (isAncestor(startBlock, endBlock)) {
		// "Let reference node be end block."
		var referenceNode = endBlock;

		// "While reference node is not a child of start block, set reference
		// node to its parent."
		while (referenceNode.parentNode != startBlock) {
			referenceNode = referenceNode.parentNode;
		}

		// "Call collapse() on the context object's Selection, with first
		// argument start block and second argument the index of reference
		// node."
		getSelection().collapse(startBlock, getNodeIndex(referenceNode));
		getActiveRange().setStart(startBlock, getNodeIndex(referenceNode));
		getActiveRange().collapse(true);

		// "If end block has no children:"
		if (!endBlock.hasChildNodes()) {
			// "While end block is editable and is the only child of its parent
			// and is not a child of start block, let parent equal end block,
			// then remove end block from parent, then set end block to
			// parent."
			while (isEditable(endBlock)
			&& endBlock.parentNode.childNodes.length == 1
			&& endBlock.parentNode != startBlock) {
				var parent_ = endBlock;
				parent_.removeChild(endBlock);
				endBlock = parent_;
			}

			// "If end block is editable and is not an inline node, and its
			// previousSibling and nextSibling are both inline nodes, call
			// createElement("br") on the context object and insert it into end
			// block's parent immediately after end block."
			if (isEditable(endBlock)
			&& !isInlineNode(endBlock)
			&& isInlineNode(endBlock.previousSibling)
			&& isInlineNode(endBlock.nextSibling)) {
				endBlock.parentNode.insertBefore(document.createElement("br"), endBlock.nextSibling);
			}

			// "If end block is editable, remove it from its parent."
			if (isEditable(endBlock)) {
				endBlock.parentNode.removeChild(endBlock);
			}

			// "Restore states and values from overrides."
			restoreStatesAndValues(overrides);

			// "Abort these steps."
			return;
		}

		// "If end block's firstChild is not an inline node, restore states and
		// values from overrides, then abort these steps."
		if (!isInlineNode(endBlock.firstChild)) {
			restoreStatesAndValues(overrides);
			return;
		}

		// "Let children be a list of nodes, initially empty."
		var children = [];

		// "Append the first child of end block to children."
		children.push(endBlock.firstChild);

		// "While children's last member is not a br, and children's last
		// member's nextSibling is an inline node, append children's last
		// member's nextSibling to children."
		while (!isHtmlElement(children[children.length - 1], "br")
		&& isInlineNode(children[children.length - 1].nextSibling)) {
			children.push(children[children.length - 1].nextSibling);
		}

		// "Record the values of children, and let values be the result."
		var values = recordValues(children);

		// "While children's first member's parent is not start block, split
		// the parent of children."
		while (children[0].parentNode != startBlock) {
			splitParent(children);
		}

		// "If children's first member's previousSibling is an editable br,
		// remove that br from its parent."
		if (isEditable(children[0].previousSibling)
		&& isHtmlElement(children[0].previousSibling, "br")) {
			children[0].parentNode.removeChild(children[0].previousSibling);
		}

	// "Otherwise, if start block is a descendant of end block:"
	} else if (isDescendant(startBlock, endBlock)) {
		// "Call collapse() on the context object's Selection, with first
		// argument start block and second argument start block's length."
		getSelection().collapse(startBlock, getNodeLength(startBlock));
		getActiveRange().setStart(startBlock, getNodeLength(startBlock));
		getActiveRange().collapse(true);

		// "Let reference node be start block."
		var referenceNode = startBlock;

		// "While reference node is not a child of end block, set reference
		// node to its parent."
		while (referenceNode.parentNode != endBlock) {
			referenceNode = referenceNode.parentNode;
		}

		// "If reference node's nextSibling is an inline node and start block's
		// lastChild is a br, remove start block's lastChild from it."
		if (isInlineNode(referenceNode.nextSibling)
		&& isHtmlElement(startBlock.lastChild, "br")) {
			startBlock.removeChild(startBlock.lastChild);
		}

		// "Let nodes to move be a list of nodes, initially empty."
		var nodesToMove = [];

		// "If reference node's nextSibling is neither null nor a block node,
		// append it to nodes to move."
		if (referenceNode.nextSibling
		&& !isBlockNode(referenceNode.nextSibling)) {
			nodesToMove.push(referenceNode.nextSibling);
		}

		// "While nodes to move is nonempty and its last member isn't a br and
		// its last member's nextSibling is neither null nor a block node,
		// append its last member's nextSibling to nodes to move."
		if (nodesToMove.length
		&& !isHtmlElement(nodesToMove[nodesToMove.length - 1], "br")
		&& nodesToMove[nodesToMove.length - 1].nextSibling
		&& !isBlockNode(nodesToMove[nodesToMove.length - 1].nextSibling)) {
			nodesToMove.push(nodesToMove[nodesToMove.length - 1].nextSibling);
		}

		// "Record the values of nodes to move, and let values be the result."
		var values = recordValues(nodesToMove);

		// "For each node in nodes to move, append node as the last child of
		// start block, preserving ranges."
		nodesToMove.forEach(function(node) {
			movePreservingRanges(node, startBlock, -1);
		});

	// "Otherwise:"
	} else {
		// "Call collapse() on the context object's Selection, with first
		// argument start block and second argument start block's length."
		getSelection().collapse(startBlock, getNodeLength(startBlock));
		getActiveRange().setStart(startBlock, getNodeLength(startBlock));
		getActiveRange().collapse(true);

		// "If end block's firstChild is an inline node and start block's
		// lastChild is a br, remove start block's lastChild from it."
		if (isInlineNode(endBlock.firstChild)
		&& isHtmlElement(startBlock.lastChild, "br")) {
			startBlock.removeChild(startBlock.lastChild);
		}

		// "Record the values of end block's children, and let values be the
		// result."
		var values = recordValues([].slice.call(endBlock.childNodes));

		// "While end block has children, append the first child of end block
		// to start block, preserving ranges."
		while (endBlock.hasChildNodes()) {
			movePreservingRanges(endBlock.firstChild, startBlock, -1);
		}

		// "While end block has no children, let parent be the parent of end
		// block, then remove end block from parent, then set end block to
		// parent."
		while (!endBlock.hasChildNodes()) {
			var parent_ = endBlock.parentNode;
			parent_.removeChild(endBlock);
			endBlock = parent_;
		}
	}

	// "Let ancestor be start block."
	var ancestor = startBlock;

	// "While ancestor has an inclusive ancestor ol in the same editing host
	// whose nextSibling is also an ol in the same editing host, or an
	// inclusive ancestor ul in the same editing host whose nextSibling is also
	// a ul in the same editing host:"
	while (getInclusiveAncestors(ancestor).some(function(node) {
		return inSameEditingHost(ancestor, node)
			&& (
				(isHtmlElement(node, "ol") && isHtmlElement(node.nextSibling, "ol"))
				|| (isHtmlElement(node, "ul") && isHtmlElement(node.nextSibling, "ul"))
			) && inSameEditingHost(ancestor, node.nextSibling);
	})) {
		// "While ancestor and its nextSibling are not both ols in the same
		// editing host, and are also not both uls in the same editing host,
		// set ancestor to its parent."
		while (!(
			isHtmlElement(ancestor, "ol")
			&& isHtmlElement(ancestor.nextSibling, "ol")
			&& inSameEditingHost(ancestor, ancestor.nextSibling)
		) && !(
			isHtmlElement(ancestor, "ul")
			&& isHtmlElement(ancestor.nextSibling, "ul")
			&& inSameEditingHost(ancestor, ancestor.nextSibling)
		)) {
			ancestor = ancestor.parentNode;
		}

		// "While ancestor's nextSibling has children, append ancestor's
		// nextSibling's firstChild as the last child of ancestor, preserving
		// ranges."
		while (ancestor.nextSibling.hasChildNodes()) {
			movePreservingRanges(ancestor.nextSibling.firstChild, ancestor, -1);
		}

		// "Remove ancestor's nextSibling from its parent."
		ancestor.parentNode.removeChild(ancestor.nextSibling);
	}

	// "Restore the values from values."
	restoreValues(values);

	// "If start block has no children, call createElement("br") on the context
	// object and append the result as the last child of start block."
	if (!startBlock.hasChildNodes()) {
		startBlock.appendChild(document.createElement("br"));
	}

	// "Remove extraneous line breaks at the end of start block."
	removeExtraneousLineBreaksAtTheEndOf(startBlock);

	// "Restore states and values from overrides."
	restoreStatesAndValues(overrides);
}
386672
@Override
	protected void keyTyped(char keyChar, int keyCode)
	{
		try
		{
			boolean ret = false;
			for (IKeyListener listener : keyListeners)
				ret |= listener.onKeyTyped(keyChar, keyCode);

			if (ret)
				return;

			if (focusedComponent != null && !keyListeners.contains(focusedComponent) && focusedComponent.onKeyTyped(keyChar, keyCode))
				return;

			if (hoveredComponent != null && !keyListeners.contains(hoveredComponent) && hoveredComponent.onKeyTyped(keyChar, keyCode))
				return;

			if (isGuiCloseKey(keyCode) && mc.currentScreen == this)
				close();

			if (!MalisisCore.isObfEnv && isCtrlKeyDown() && (current() != null || isOverlay))
			{
				if (keyCode == Keyboard.KEY_R)
				{
					clearScreen();
					setResolution();
					setHoveredComponent(null, true);
					setFocusedComponent(null, true);
					constructed = false;
					doConstruct();
				}
				if (keyCode == Keyboard.KEY_D)
				{
					debug = !debug;
					debugComponent.setEnabled(debug);
				}
				if (keyCode == Keyboard.KEY_P)
				{
					Position.CACHED = !Position.CACHED;
				}
				if (keyCode == Keyboard.KEY_S)
				{
					Size.CACHED = !Size.CACHED;
				}
			}
		}
		catch (Exception e)
		{
			MalisisCore.message("A problem occured while handling key typed for " + e.getClass().getSimpleName() + ": " + e.getMessage());
			e.printStackTrace(new PrintStream(new FileOutputStream(FileDescriptor.out)));
		}

	}
20628
@Override
    protected void onFocusChanged(boolean focused, int direction,
                                  Rect previouslyFocusedRect) {
        super.onFocusChanged(focused, direction, previouslyFocusedRect);
        showErrorIconHax(lastErrorIcon);
    }
738326
public void onSelectionChanged(SelectionEvent event) {
		int count = event.getSelection().length;
		if (count == 0) {
			focusButton.setDisabled(true);
			showButton.setDisabled(true);
		} else if (count == 1) {
			focusButton.setDisabled(false);
			showButton.setDisabled(false);
		} else {
			focusButton.setDisabled(false);
			showButton.setDisabled(true);
		}
		for (ToolStripButton button : extraButtons) {
			button.setDisabled(count == 0);
		}
	}
1253000
public void select(int start, int end) {
        int docEnd = textArea.getDocument().getLength();
        textArea.select(docEnd, docEnd);
        textArea.select(start, end);
    }
1002959
function erase_selection(input, selection)
{
	let text = input.value
	text = text.slice(0, selection.start) + text.slice(selection.end)

	input.value = text
	setCaretPosition(input, selection.start)
}
1147899
public void remove() {
        if (polyline != null) {
            polyline.remove();
            polyline = null;
        }
        for (Marker marker : markers) {
            marker.remove();
        }
    }
128219
@Override
  public void removeChange(DiffEntry change) {
    Path path = new Path(change.getOldPath());
    if (path.depth() == NODE_FILE_DEPTH) {
      removeDataNode(change);
    } else if (path.depth() == EDGE_FILE_DEPTH) {
      removeFlowEdge(change);
    }
  }
547283
function (value, strategy, e) {
      this._term = null;
      this.adapter.select(value, strategy, e);
      this.fire('change').fire('textComplete:select', value, strategy);
      this.adapter.focus();
    }
358218
public void focusLost(FocusEvent focusEvent) {
		String text = ((JSpinner.DateEditor) getEditor()).getTextField()
				.getText();
		if (text.length() == 0) {
			setDate(null);
		}
	}
165641
function(marker, type) {
        marker = $(marker);

        // Stop all the unnecessary processing
        if (type === 'activate' && marker.hasClass('is-stalked')) {
            return;
        } else if (type === 'deactivate' && !marker.hasClass('is-stalked')) {
            return;
        }

        var options = this.options,
            targetBy = options.targetBy,
            markBy = options.markBy,
            target = this.targets.filter(function() {
                return $(this).attr(targetBy).replace('#', '') === marker.attr(markBy);
            }),
            before,
            after,
            method;

        if (type === 'activate') {
            before = 'activating';
            after = 'activated';
            method = 'addClass';
        } else {
            before = 'deactivating';
            after = 'deactivated';
            method = 'removeClass';
        }

        this.fireEvent(before, [marker, target]);

        marker[method]('is-stalked');
        target[method]('is-active');

        this.fireEvent(after, [marker, target]);
    }