• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/WebInspectorUI-7600.1.17/Tools/PrettyPrinting/

Lines Matching +refs:diff +refs:find +refs:text

7 // You can find some technical background for some of the code below
154 // A visibility: hidden element used to find the size of things.
292 return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th;
352 var len = line.text.length, merged, cur = line;
354 var found = merged.find(0, true);
360 var found = merged.find(0, true);
361 len -= cur.text.length - found.from.ch;
363 len += cur.text.length - found.to.ch;
540 // information in display.view to find out which nodes are no longer
656 var width = measureChar(cm, display.maxLine, display.maxLine.text.length).left;
695 var diff = cur.line.height - height;
697 if (diff > .001 || diff < -.001) {
780 if (type == "text") updateLineText(cm, lineView);
791 if (lineView.node == lineView.text) {
793 if (lineView.text.parentNode)
794 lineView.text.parentNode.replaceChild(lineView.node, lineView.text);
795 lineView.node.appendChild(lineView.text);
825 // Redraw the line's text. Interacts with the background and text
829 var cls = lineView.text.className;
831 if (lineView.text == lineView.node) lineView.node = built.pre;
832 lineView.text.parentNode.replaceChild(built.pre, lineView.text);
833 lineView.text = built.pre;
839 lineView.text.className = cls;
847 else if (lineView.node != lineView.text)
850 lineView.text.className = textClass || "";
864 lineView.text);
893 lineView.text = lineView.node = built.pre;
919 wrap.insertBefore(node, lineView.gutter || lineView.text);
946 // A Pos instance represents a position within the text.
1045 if (pos.line > last) return Pos(last, getLine(doc, last).text.length);
1046 return clipToLen(pos, getLine(doc, pos.line).text.length);
1214 var newPos = m.find(dir < 0 ? -1 : 1);
1220 } else if (newPos.ch > line.text.length) {
1288 // Secondary cursor, shown when on a 'jump' in bi-directional text
1314 var lineLen = lineObj.text.length;
1354 var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
1408 if (ischange) regLineChange(cm, doc.frontier, "text");
1411 processLine(cm, line.text, state);
1424 // find a line with a stateAfter, so that it can start with a
1435 var indented = countColumn(line.text, null, cm.options.tabSize);
1451 processLine(cm, line.text, state);
1484 var rects = lineView.text.firstChild.getClientRects();
1495 // Find a line map (mapping character offsets to text nodes) and a
1517 view.text = built.pre;
1545 if (view && !view.text)
1569 prepared.rect = prepared.view.text.getBoundingClientRect();
1586 // First, search the line map for the text node corresponding to,
1620 if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
1621 while (start && isExtendingChar(prepared.line.text.charAt(mStart + start))) --start;
1622 while (mStart + end < mEnd && isExtendingChar(prepared.line.text.charAt(mStart + end))) ++end;
1799 return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, true, 1);
1806 var mergedPos = merged && merged.find(0, true);
1828 var bidi = getOrder(lineObj), dist = lineObj.text.length;
1838 while (isExtendingChar(lineObj.text.charAt(ch))) ++ch;
1855 // Compute the default text height.
1902 typing: false, // Whether this reset should be careful to leave existing text (for compositing)
2029 this.node = this.text = null;
2113 // Register a change to a single line. Type must be one of "text",
2149 var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
2157 diff = (n + view[index].size) - oldN;
2160 diff = n - oldN;
2162 oldN += diff; newN += diff;
2234 // seen text (can be empty), which is stored in prevInput (we must
2240 // will be the case when there is a lot of text in the textarea,
2249 var text = input.value;
2251 if (text == prevInput && !cm.somethingSelected()) return false;
2253 if (ie && !ie_upto8 && cm.display.inputHasSelection === text) {
2262 if (text.charCodeAt(0) == 0x200b && doc.sel == cm.display.selForContextMenu && !prevInput)
2265 var same = 0, l = Math.min(prevInput.length, text.length);
2266 while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) ++same;
2267 var inserted = text.slice(same), textLines = splitLines(inserted);
2272 // Normal behavior is to insert the new text into every selection
2281 to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length));
2283 var changeEvent = {from: from, to: to, text: multiPaste ? [textLines[i]] : textLines,
2300 if (mode.electricInput.test(getLine(doc, end.line).text.slice(0, end.ch)))
2309 // Don't leave long text in the textarea, since it makes further polling slow
2310 if (text.length > 1000 || text.indexOf("\n") > -1) input.value = cm.display.prevInput = "";
2311 else cm.display.prevInput = text;
2453 var text = "", ranges = [];
2458 text += cm.getRange(lineRange.anchor, lineRange.head);
2464 d.input.value = text;
2482 // Might be a text scaling operation, clear size caches.
2497 // Given a mouse event, find the corresponding position. If liberal
2501 // coordinates beyond the right of the text.
2514 if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
2522 // start of selection drag, start of text drag, new cursor
2586 // Start a text drag. When it ends, see if any dragging actually
2614 // Normal selection, as opposed to text dragging.
2670 var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
2671 var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
2675 var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
2678 else if (text.length > leftPos)
2679 ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));
2793 // Might be a file drop, in which case we simply extract the text
2796 var n = files.length, text = Array(n), read = 0;
2800 text[i] = reader.result;
2803 var change = {from: pos, to: pos, text: splitLines(text.join("\n")), origin: "paste"};
2812 // Don't do a replace if the drop happened inside of the selected text.
2820 var text = e.dataTransfer.getData("Text");
2821 if (text) {
2827 cm.replaceSelection(text, "around", "paste");
3151 // Reset the current text selection only if the click is done outside of the selection
3226 if (!change.text) return change.to;
3227 return Pos(change.from.line + change.text.length - 1,
3228 lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0));
3232 // same text, or the end of the change if the change covers it.
3237 var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
3286 text: change.text,
3290 if (update) obj.update = function(from, to, text, origin) {
3293 if (text) this.text = text;
3300 return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin};
3321 makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text});
3328 if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) return;
3409 // Sub-views need their line numbers shifted when text is added
3432 shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
3439 var shift = change.text.length - 1 - (doc.first - change.from.line);
3442 text: [lst(change.text)], origin: change.origin};
3446 change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
3447 text: [change.text[0]], origin: change.origin};
3480 doc.iter(checkWidthStart, from.line + change.text.length, function(line) {
3496 var lendiff = change.text.length - (to.line - from.line) - 1;
3498 if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
3499 regLineChange(cm, from.line, "text");
3507 text: change.text,
3521 makeChange(doc, {from: from, to: to, text: code, origin: origin});
3664 var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
3666 var curSpaceString = line.text.match(/^\s*/)[0], indentation;
3667 if (!aggressive && !/\S/.test(line.text)) {
3671 indentation = cm.doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
3678 if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);
3723 // Helper for deleting text near the selection(s), used to implement
3753 // text, direction 1 means to move towards the next index in the
3772 else ch = dir < 0 ? lineObj.text.length : 0;
3785 var cur = lineObj.text.charAt(ch) || "\n";
3827 var doc = cm.doc, line = getLine(doc, pos.line).text;
3932 var stream = new StringStream(line.text, this.options.tabSize);
4056 var prop = where == "text" ? "textClass" : where == "background" ? "bgClass" : "wrapClass";
4066 var prop = where == "text" ? "textClass" : where == "background" ? "bgClass" : "wrapClass";
4096 return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
4439 // Given a mode spec (anything that resolveMode accepts), find and
4444 if (!mfactory) return CodeMirror.getMode(options, "text/plain");
4466 CodeMirror.defineMIME("text/plain", "null");
4520 // Given a mode and a state (for that mode), find the inner mode and
4544 var len = getLine(cm.doc, range.head.line).text.length;
4580 var firstNonWS = Math.max(0, line.text.search(/\S/));
4641 var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;
4649 var prev = getLine(cm.doc, cur.line - 1).text;
4685 // Note that the save and find-related commands aren't defined by
4692 "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
4702 "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
4905 // handle that can be used to clear or find a marked position in the
4927 var found = this.find();
4934 if (cm && !this.collapsed) regLineChange(cm, lineNo(line), "text");
4969 TextMarker.prototype.find = function(side, lineObj) {
4990 var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
5040 var marker = new TextMarker(doc, type), diff = cmp(from, to);
5043 if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
5046 // Showing up as a widget implies collapsed (widget replaces text)
5094 for (var i = from.line; i <= to.line; i++) regLineChange(cm, i, "text");
5121 SharedTextMarker.prototype.find = function(side, lineObj) {
5122 return this.primary.find(side, lineObj);
5147 var marker = markers[i], pos = marker.find();
5243 var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
5279 var gap = change.text.length - 2, gapMarkers;
5342 var mk = markers[i], m = mk.find(0);
5384 var aPos = a.find(), bPos = b.find();
5416 var found = sp.marker.find(0);
5433 line = merged.find(-1, true).line;
5442 line = merged.find(1, true).line;
5462 line = merged.find(1, true).line;
5482 var end = span.marker.find(1, true);
5485 if (span.marker.inclusiveRight && span.to == line.text.length)
5508 function adjustScrollWhenAboveVisible(cm, line, diff) {
5510 addToScrollPos(cm, null, diff);
5528 var diff = widgetHeight(this) - oldH;
5529 if (!diff) return;
5532 adjustScrollWhenAboveVisible(cm, line, diff);
5533 updateLineHeight(line, line.height + diff);
5567 var Line = CodeMirror.Line = function(text, markedSpans, estimateHeight) {
5568 this.text = text;
5575 // Change the content (text, markers) of a line. Automatically
5578 function updateLine(line, text, markedSpans, estimateHeight) {
5579 line.text = text;
5625 function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) {
5629 var stream = new StringStream(text, cm.options.tabSize), style;
5630 if (text == "") extractLineClasses(callBlankLine(mode, state), lineClasses);
5634 if (forceToEnd) processLine(cm, text, state, stream.pos);
5635 stream.pos = text.length;
5651 // Webkit seems to refuse to render text nodes longer than 57444 characters
5667 runMode(cm, line.text, cm.doc.mode, state, function(end, style) {
5674 runMode(cm, line.text, overlay.mode, true, function(end, style) {
5713 function processLine(cm, text, state, startAt) {
5715 var stream = new StringStream(text, cm.options.tabSize);
5717 if (text == "") callBlankLine(mode, state);
5735 // Render the DOM representation of the text of a line. Also builds
5737 // specific stretches of text, and is used by the measuring code.
5796 function buildToken(builder, text, style, startStyle, endStyle, title) {
5797 if (!text) return;
5799 if (!special.test(text)) {
5800 builder.col += text.length;
5801 var content = document.createTextNode(text);
5802 builder.map.push(builder.pos, builder.pos + text.length, content);
5804 builder.pos += text.length;
5809 var m = special.exec(text);
5810 var skipped = m ? m.index - pos : text.length - pos;
5812 var txt = document.createTextNode(text.slice(pos, pos + skipped));
5853 return function(builder, text, style, startStyle, endStyle, title) {
5854 inner(builder, text.replace(/ {3,}/g, split), style, startStyle, endStyle, title);
5859 // right-to-left text.
5861 return function(builder, text, style, startStyle, endStyle, title) {
5863 var start = builder.pos, end = start + text.length;
5865 // Find the part that overlaps with the start of this text
5870 if (part.to >= end) return inner(builder, text, style, startStyle, endStyle, title);
5871 inner(builder, text.slice(0, part.to - start), style, startStyle, null, title);
5873 text = text.slice(part.to - start);
5889 // and marked text into account.
5891 var spans = line.markedSpans, allText = line.text, at = 0;
5898 var len = allText.length, pos = 0, i = 1, text = "", style;
5932 if (text) {
5933 var end = pos + text.length;
5935 var tokenText = end > upto ? text.slice(0, upto - pos) : text;
5939 if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}
5943 text = allText.slice(at, at = styles[i++]);
5953 // widgets and marker elements with the text behave more intuitive.
5955 return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
5962 function update(line, text, spans) {
5963 updateLine(line, text, spans, estimateHeight);
5967 var from = change.from, to = change.to, text = change.text;
5969 var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
5975 for (var i = 0, added = []; i < text.length - 1; ++i)
5976 added.push(new Line(text[i], spansFor(i), estimateHeight));
5977 update(lastLine, lastLine.text, lastSpans);
5981 if (text.length == 1) {
5982 update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
5984 for (var added = [], i = 1; i < text.length - 1; ++i)
5985 added.push(new Line(text[i], spansFor(i), estimateHeight));
5986 added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));
5987 update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
5990 } else if (text.length == 1) {
5991 update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
5994 update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
5995 update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
5996 for (var i = 1, added = []; i < text.length - 1; ++i)
5997 added.push(new Line(text[i], spansFor(i), estimateHeight));
6014 // and line object, and to find the total height of the document.
6157 var Doc = CodeMirror.Doc = function(text, mode, firstLine) {
6158 if (!(this instanceof Doc)) return new Doc(text, mode, firstLine);
6173 if (typeof text == "string") text = splitLines(text);
6174 updateDoc(this, {from: start, to: start, text: text});
6207 makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
6208 text: splitLines(code), origin: "setValue"}, true);
6222 getLine: function(line) {var l = this.getLineHandle(line); return l && l.text;},
6306 changes[i] = {from: range.from(), to: range.to(), text: splitLines(code[i]), origin: origin};
6403 var sz = line.text.length + 1;
6415 index += line.text.length + 1;
6529 var text = line.text;
6530 if (n == end.line) text = text.slice(0, end.ch);
6531 if (n == start.line) text = text.slice(start.ch);
6532 out.push(text);
6540 doc.iter(from, to, function(line) { out.push(line.text); });
6547 var diff = height - line.height;
6548 if (diff) for (var n = line; n; n = n.parent) n.height += diff;
6551 // Given a line object, find its line number by walking up through
6612 if (order == null) order = line.order = bidiOrdering(line.text);
6636 var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
6762 // When un/re-doing restores text containing marked spans, those
6777 for (var i = 0, nw = []; i < change.text.length; ++i)
6795 newChanges.push({from: change.from, to: change.to, text: change.text});
6809 function rebaseHistSelSingle(pos, from, to, diff) {
6811 pos.line += diff;
6825 function rebaseHistArray(array, from, to, diff) {
6831 rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
6832 rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
6839 cur.from = Pos(cur.from.line + diff, cur.from.ch);
6840 cur.to = Pos(cur.to.line + diff, cur.to.ch);
6854 var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
6855 rebaseHistArray(hist.done, from, to, diff);
6856 rebaseHistArray(hist.undone, from, to, diff);
7002 // Used mostly to find indentation.
7018 // The inverse of countColumn -- find the offset that corresponds to
7249 // Feature-detect IE's crummy client rect reporting for bidi text
7337 if (!order) return line.text.length;
7352 line = merged.find(1, true).line;
7356 var ch = !order ? line.text.length : order[0].level % 2 ? lineLeft(line) : lineRight(line);
7390 while (pos > 0 && isExtendingChar(line.text.charAt(pos)));
7395 // text -- i.e., pressing left should make the cursor go left, even
7396 // when in RTL text. The tricky part is the 'jumps', where RTL and
7397 // LTR text touch each other. This often requires the cursor offset
7424 if (byUnit) while (target > 0 && isExtendingChar(line.text.charAt(target))) target += dir;
7425 return target < 0 || target > line.text.length ? null : target;
7539 // surrounding strong text if the text on both sides has the same