Handles double clicking of the kinks in trimmed timeline
by extending back the timeline
and also handles coming back to trimmed timeline
336949
function clickHandlerKink() {
    timeline.pluginSetOrGetState("trimClinicalTimeline", false);
    //create a bounding box to ease the clicking of axis
    xAxisBBox = d3.select(timeline.divId()+" > svg > g > g.axis")[0][0].getBBox()
    d3.select(timeline.divId()+"> svg > g")
      .insert("rect")
      .attr("x", xAxisBBox.x)
      .attr("y", 4)
      .attr("width", xAxisBBox.width)
      .attr("height", xAxisBBox.height)
      .attr("fill", "rgba(0,0,0,0)")
      .style("cursor", "pointer")
      .on("click", function () {
        timeline.pluginSetOrGetState("trimClinicalTimeline", true);
      })
      .append("svg:title")
      .text("Click to trim the timeline");
  }
501634
def _onShortcutDuplicateLine(self):
        
        cursor = self.textCursor()
        if cursor.hasSelection():  # duplicate selection
            text = cursor.selectedText()
            selectionStart, selectionEnd = cursor.selectionStart(), cursor.selectionEnd()
            cursor.setPosition(selectionEnd)
            cursor.insertText(text)
            # restore selection
            cursor.setPosition(selectionStart)
            cursor.setPosition(selectionEnd, QTextCursor.KeepAnchor)
            self.setTextCursor(cursor)
        else:
            line = cursor.blockNumber()
            self.lines.insert(line + 1, self.lines[line])
            self.ensureCursorVisible()

        self._updateExtraSelections()
156863
def _restore_clipboard_selection(self, backup: str):
        """"""
        # Pasting takes some time, so wait a bit before restoring the content. Otherwise the restore is done before
        # the pasting happens, causing the backup to be pasted instead of the desired clipboard content.

        # Programmatically pressing the middle mouse button seems VERY slow, so wait rather long.
        # It might be a good idea to make this delay configurable. There might be systems that need even longer.
        time.sleep(1)
        self.clipboard.selection = backup if backup is not None else ""
217485
function doubletap(position, element, done) {
                touchTypes.tap(position, element, function() {
                    setTimeout(function() {
                        touchTypes.tap(position, element, done);
                    }, 30);
                });
            }
1160668
function ()
	{
		/* Remove the old buttons */
		for ( var i=this.dom.buttons.length-1 ; i>=0 ; i-- ) {
			this.dom.collection.removeChild( this.dom.buttons[i] );
		}
		this.dom.buttons.splice( 0, this.dom.buttons.length );
		this.dom.groupButtons.splice(0, this.dom.groupButtons.length);

		if ( this.dom.restore ) {
			this.dom.restore.parentNode( this.dom.restore );
		}

		/* Re-add them (this is not the optimal way of doing this, it is fast and effective) */
		this._fnAddGroups();
		this._fnAddButtons();

		/* Update the checkboxes */
		this._fnDrawCallback();
	}
623256
function() {
		if (typeof(this.events) == "undefined" || typeof(this.events.length) == "undefined" || this.events.length == 0) {
			this.logError("Timeline configuration has no events.")
		}

		// make sure all eras have start and end dates
		for (var i = 0; i < this.eras.length; i++) {
			if (typeof(this.eras[i].start_date) == 'undefined' || typeof(this.eras[i].end_date) == 'undefined') {
				var era_identifier;
				if (this.eras[i].text && this.eras[i].text.headline) {
					era_identifier = this.eras[i].text.headline
				} else {
					era_identifier = "era " + (i+1);
				}
				this.logError("All eras must have start and end dates. [" + era_identifier + "]") // add internationalization (I18N) and context
			}
		};
	}
834332
def reverseCommit(self):
        
        if self.selectionPosOld is None:
            return

        # Shorthand.
        wid = self.qteWidget

        # Select, backup, and delete the selection.
        wid.setSelection(*self.selectionPosNew)
        self.baseClass.replaceSelectedText(self.oldText)

        # Add the styling information.
        line, col = self.selectionPosNew[0:2]
        wid.SCISetStylingEx(line, col, self.oldStyle)
        wid.setCursorPosition(line, col)
722635
function () {
		var chart = this.chart,
			sharedClipKey = this.sharedClipKey,
			group = this.group;
			
		if (group && this.options.clip !== false) {
			group.clip(chart.clipRect);
			this.markerGroup.clip(); // no clip
		}
		
		// Remove the shared clipping rectancgle when all series are shown		
		setTimeout(function () {
			if (sharedClipKey && chart[sharedClipKey]) {
				chart[sharedClipKey] = chart[sharedClipKey].destroy();
				chart[sharedClipKey + 'm'] = chart[sharedClipKey + 'm'].destroy();
			}
		}, 100);
	}
758879
function handleDeleteInCaption() {
        var ZWSP = '\uFEFF';

        var isEmptyNode = function (node) {
          return editor.dom.isEmpty(node) || node.firstChild === node.lastChild && isCaretContainer(node.firstChild);
        };

        var isTableCaption = function (node) {
          return node && node.nodeName == 'CAPTION' && node.parentNode.nodeName == 'TABLE';
        };

        var isTheHeirOf = function (heir, ancestor) {
          var node = ancestor.firstChild;
          do {
            if (node === heir) {
              return true;
            }
          } while ((node = node.firstChild));
          return false;
        };

        var isCaretContainer = function (node) {
          if (node.nodeType === 3) {
            if (node.data === ZWSP) {
              return true;
            }
            node = node.parentNode;
          }
          return node.nodeType === 1 && node.hasAttribute('data-mce-caret');
        };

        var caretIsAtTheLeftEdgeOf = function (node) {
          var rng = editor.selection.getRng();
          return !rng.startOffset && !rng.startContainer.previousSibling && isTheHeirOf(rng.startContainer, node);
        };

        var appendCaretContainer = function (node, isBlock) {
          var caretNode;
          if (!isBlock) {
            caretNode = node.ownerDocument.createTextNode(ZWSP);
          } else {
            caretNode = editor.dom.create('p', {
              'data-mce-caret': 'after',
              'data-mce-bogus': 'all'
            },
            '<br data-mce-bogus="1">');
          }
          node.appendChild(caretNode);
        };

        var restoreCaretPlaceholder = function (container, insertCaret) {
          var lastChild = container.lastChild;
          var rng = editor.selection.getRng();

          // save the current position of the caret to restore it later (IE requires this)
          var caretContainer = rng.startContainer;
          var caretOffset = rng.startOffset;

          // if container contains only debris, we replace the contents with inline caret placeholder, to avoid
          // vertical stretching of the caption
          if (isEmptyNode(container)) {
            container.innerHTML = ZWSP;
            // in IE caret springs off from the caption (to the first td), we need to bring it back
            caretContainer = container.lastChild;
            caretOffset = 0;
          } else if (!isCaretContainer(lastChild)) {
            appendCaretContainer(container, editor.dom.isBlock(lastChild));
          }

          // in IE caret is off after restoration
          editor.selection.setCursorLocation(caretContainer, caretOffset);
        };

        var contractSelectionTo = function (caption) {
          var rng = editor.selection.getRng();
          var newRng = editor.dom.createRng();
          var firstChild = caption.firstChild;

          if (rng.commonAncestorContainer === caption.parentNode && isTheHeirOf(rng.startContainer, caption)) { // ignore backward selections
            // rng.selectNodeContents() didn't work in IE
            newRng.setStart(caption, 0);
            if (firstChild.nodeType === 1) {
              newRng.setEnd(caption, caption.childNodes.length);
            } else {
              newRng.setEnd(firstChild, firstChild.nodeValue.length);
            }
            editor.selection.setRng(newRng);
          }
        };

        editor.on('keydown', function (e) {
          if (e.keyCode !== VK.DELETE && e.keyCode !== VK.BACKSPACE || e.isDefaultPrevented()) {
            return;
          }

          var container = editor.dom.getParent(editor.selection.getStart(), 'caption');
          if (!isTableCaption(container)) {
            return;
          }

          // in IE caption collapses if caret placeholder is deleted (and it is very much possible)
          if (!editor.selection.isCollapsed()) {

            // in Chrome triple click selects beyond the boundaries of the caption, if then delete is pressed,
            // contents are being removed with the whole caption, so make sure we stay in caption
            contractSelectionTo(container);

            // if the whole contents are selected, caret placeholder will be deleted too and we take
            // over delete operation here to do it manually and restore the placeholder if required
            editor.undoManager.transact(function () {
              editor.execCommand('Delete');
              restoreCaretPlaceholder(container);
            });
            e.preventDefault();
          } else {
            restoreCaretPlaceholder(container);

            if (isEmptyNode(container) || e.keyCode === VK.BACKSPACE && caretIsAtTheLeftEdgeOf(container)) { // see TINY-979
              e.preventDefault();
            }
          }
        });
      }
539540
def _select_other_window(history):
    "  "
    current_buffer = history.app.current_buffer
    layout = history.history_layout.layout

    if current_buffer == history.history_buffer:
        layout.current_control = history.history_layout.default_buffer_control

    elif current_buffer == history.default_buffer:
        layout.current_control = history.history_layout.history_buffer_control
462363
function inHistory(file, layout, options) {
  return !options.disableHistory && file.layoutStack.indexOf(layout) !== -1;
}
1159090
void extensionVisited(Date date, Extension extension)
    {
        final Extension oldCurrentExtension = getCurrentExtension();
        final ExtensionHistoryEntry historyEntry;

        historyEntry = new ExtensionHistoryEntry(date, extension);

        synchronized (extensionHistory)
        {
            extensionHistory.add(historyEntry);
        }

        firePropertyChange(PROPERTY_CURRENT_EXTENSION, oldCurrentExtension, extension);
    }
633147
private void handleShowButtonBarIntent(@NonNull final Bundle extras) {
        if (extras.containsKey(EXTRA_SHOW_BUTTON_BAR)) {
            showButtonBar(extras.getBoolean(EXTRA_SHOW_BUTTON_BAR));
        }
    }
601737
protected void prune (long now, List<Entry> history)
    {
        int prunepos = 0;
        for (int ll = history.size(); prunepos < ll; prunepos++) {
            Entry entry = history.get(prunepos);
            if (now - entry.message.timestamp < HISTORY_EXPIRATION) {
                break; // stop when we get to the first valid message
            }
        }
        history.subList(0, prunepos).clear();
    }
796971
def _cursorUp(self):
        
        if self.historyPos > 0:
            self.historyPos -= 1
            clearLen = len(self.inputBuffer)
            self.inputBuffer = list(self.history[self.historyPos])
            self.cursorPos = len(self.inputBuffer)
            self._refreshInputPrompt(clearLen)
61910
function _dynamicEnding() {

  // If the route ends with a dynamic segment, make sure the earlier
  // segments match.
  if(_routeBoom[_routeBoom.length - 1] === '**') {

    dbug('Found dynamic ending on ' + _routeBoom.join('/'));

    var oldLength = _locationBoom.length;   // Save the current length for comparison later

    for(var f = _locationBoom.length - 1; f >= 0; f--) {
      if(_locationBoom[f] === _routeBoom[_routeBoom.length - 2] || _routeBoom[_routeBoom.length - 2] === "*") {
        _locationBoom.splice(f, _locationBoom.length - f);  // Remove the ending segments
        _routeBoom.splice(_routeBoom.length - 1, 1);        // Remove the **
        break;
      } 
    }

    // If location_boom never gets truncated, then this isn't the right route
    if(oldLength === _locationBoom.length) return false;
  }

  return true; 
}
1177899
function (evt) {
        this.mouseDown = false;
        this.stoppedDown = this.stopDown;

        // check keyboard modifiers
        if(!this.checkModifiers(evt)) {
            return true;
        }
        // ignore double-clicks
        if (this.lastUp && this.lastUp.equals(evt.xy)) {
            return true;
        }
        if (this.lastDown && this.passesTolerance(this.lastDown, evt.xy,
                                                  this.pixelTolerance)) {
            if (this.touch) {
                this.modifyFeature(evt.xy);
            }
            if(this.persist) {
                this.destroyPersistedFeature();
            }
            this.lastUp = evt.xy;
            this.finalize();
            return !this.stopUp;
        } else {
            return true;
        }
    }