Highlight inline changes in both lines.
7030
def _highlight_line_udiff(self, line, next):
        
        start = 0
        limit = min(len(line['line']), len(next['line']))
        while start < limit and line['line'][start] == next['line'][start]:
            start += 1
        end = -1
        limit -= start
        while -end <= limit and line['line'][end] == next['line'][end]:
            end -= 1
        end += 1
        if start or end:
            def do(l):
                last = end + len(l['line'])
                if l['action'] == 'add':
                    tag = 'ins'
                else:
                    tag = 'del'
                l['line'] = '%s<%s>%s</%s>%s' % (
                    l['line'][:start],
                    tag,
                    l['line'][start:last],
                    tag,
                    l['line'][last:]
                )
            do(line)
            do(next)
1292297
function(lineIndex, lineNumber, code)
        {
            var classes = [
                'line',
                'number' + lineNumber,
                'index' + lineIndex,
                'alt' + (lineNumber % 2 == 0 ? 1 : 2).toString()
            ];

            if (this.isLineHighlighted(lineNumber))
                classes.push('highlighted');

            if (lineNumber == 0)
                classes.push('break');

            return '<div class="' + classes.join(' ') + '">' + code + '</div>';
        }
1026361
def highlight_current_line(self):
        """"""
        selection = TextDecoration(self.textCursor())
        selection.format.setProperty(QTextFormat.FullWidthSelection,
                                     to_qvariant(True))
        selection.format.setBackground(self.currentline_color)
        selection.cursor.clearSelection()
        self.set_extra_selections('current_line', [selection])
        self.update_extra_selections()
410642
def underline(self, msg):
        """"""
        return click.style(msg, underline=True) if self.colorize else msg
480126
def match(self, context, line):
		""""""
		
		return line.kind == 'code' and line.partitioned[0] in self._both
516389
def highlightBlock(self, text):
        
        # Do other syntax formatting
        for expression, nth, format in self.rules:
            index = expression.indexIn(text, 0)

            while index >= 0:
                # We actually want the index of the nth match
                index = expression.pos(nth)
                length = len(expression.cap(nth))
                self.setFormat(index, length, format)
                index = expression.indexIn(text, index + length)

        self.setCurrentBlockState(0)

        # Do multi-line strings
        in_multiline = self.match_multiline(text, *self.tri_single)
        if not in_multiline:
            in_multiline = self.match_multiline(text, *self.tri_double)
691062
def get_line_style(line):
    """"""
    style = {}
    style['alpha'] = line.get_alpha()
    if style['alpha'] is None:
        style['alpha'] = 1
    style['color'] = color_to_hex(line.get_color())
    style['linewidth'] = line.get_linewidth()
    style['dasharray'] = get_dasharray(line)
    style['zorder'] = line.get_zorder()
    return style
1287844
def _replace_lines(fn, startswith, new_line):
  """"""
  new_lines = []
  for line in open(fn):
    if line.startswith(startswith):
      new_lines.append(new_line)
    else:
      new_lines.append(line)
  with open(fn, 'w') as f:
    f.write('\n'.join(new_lines))
853049
def highlight_block(self, text):
        """"""
        text = to_text_string(text)
        if text.startswith("+++"):
            self.setFormat(0, len(text), self.formats["keyword"])
        elif text.startswith("---"):
            self.setFormat(0, len(text), self.formats["keyword"])
        elif text.startswith("+"):
            self.setFormat(0, len(text), self.formats["string"])
        elif text.startswith("-"):
            self.setFormat(0, len(text), self.formats["number"])
        elif text.startswith("@"):
            self.setFormat(0, len(text), self.formats["builtin"])
        
        self.highlight_spaces(text)
84782
function InlineColorEditor(color, marker) {
        this._color = color;
        this._marker = marker;
        this._isOwnChange = false;
        this._isHostChange = false;
        this._origin = "+InlineColorEditor_" + (lastOriginId++);

        this._handleColorChange = this._handleColorChange.bind(this);
        this._handleHostDocumentChange = this._handleHostDocumentChange.bind(this);

        InlineWidget.call(this);
    }
699982
def _visible_in_diff(merge_result, context_lines=3):
    """"""
    i = old_line = new_line = 0
    while i < len(merge_result):
        line_or_conflict = merge_result[i]
        if isinstance(line_or_conflict, tuple):
            yield old_line, new_line, line_or_conflict
            old_line += len(line_or_conflict[0])
            new_line += len(line_or_conflict[1])
        else:
            for j in (list(range(max(0, i-context_lines), i                                        )) +  # look behind for nearby conflicts
                      list(range(i+1                    , min(len(merge_result), i+1+context_lines)))):  # look ahead for nearby conflicts
                if isinstance(merge_result[j], tuple):
                    yield old_line, new_line, line_or_conflict
                    break
            else:
                yield None  # sentinel to mark boundaries between diff section groups
            old_line += 1
            new_line += 1
        i += 1
    yield None
449097
def format_line(data, linestyle):
    """"""
    return linestyle.begin + linestyle.sep.join(data) + linestyle.end
909891
def _on_text_changed(self):
        
        if not self._cleaning:
            ln = TextHelper(self).cursor_position()[0]
            self._modified_lines.add(ln)
948489
def highlight_line(self, payload):
        
        index_of_payload = self.target_line.lower().index(payload.lower())
        end_of_payload = index_of_payload + len(payload)

        self.target_line = u'{}{}{}'.format(
            self.target_line[:index_of_payload],
            self.apply_highlight(self.target_line[index_of_payload:end_of_payload]),
            self.target_line[end_of_payload:],
        )

        return self
1011996
def edit_line(self, line):
        """"""
        for code, code_obj in self.code_objs.items():
            line = self.__edit_line(line, code, code_obj)
        return line
130859
def _reflow_lines(parsed_tokens, indentation, max_line_length,
                  start_on_prefix_line):
    """"""

    if unicode(parsed_tokens[0]) == 'def':
        # A function definition gets indented a bit more.
        continued_indent = indentation + ' ' * 2 * DEFAULT_INDENT_SIZE
    else:
        continued_indent = indentation + ' ' * DEFAULT_INDENT_SIZE

    break_after_open_bracket = not start_on_prefix_line

    lines = ReformattedLines(max_line_length)
    lines.add_indent(len(indentation.lstrip('\r\n')))

    if not start_on_prefix_line:
        # If splitting after the opening bracket will cause the first element
        # to be aligned weirdly, don't try it.
        first_token = get_item(parsed_tokens, 0)
        second_token = get_item(parsed_tokens, 1)

        if (
            first_token and second_token and
            unicode(second_token)[0] == '(' and
            len(indentation) + len(first_token) + 1 == len(continued_indent)
        ):
            return None

    for item in parsed_tokens:
        lines.add_space_if_needed(unicode(item), equal=True)

        save_continued_indent = continued_indent
        if start_on_prefix_line and isinstance(item, Container):
            start_on_prefix_line = False
            continued_indent = ' ' * (lines.current_size() + 1)

        item.reflow(lines, continued_indent, break_after_open_bracket)
        continued_indent = save_continued_indent

    return lines.emit()
1170296
def highlightBlock(self, text, prevContextStack):
        
        if prevContextStack is not None:
            contextStack = prevContextStack
        else:
            contextStack = self._defaultContextStack

        highlightedSegments = []
        lineContinue = False
        currentColumnIndex = 0
        textTypeMap = []

        if len(text) > 0:
            while currentColumnIndex < len(text):
                _logger.debug('In context %s', contextStack.currentContext().name)

                length, newContextStack, segments, textTypeMapPart, lineContinue = \
                    contextStack.currentContext().parseBlock(contextStack, currentColumnIndex, text)

                highlightedSegments += segments
                contextStack = newContextStack
                textTypeMap += textTypeMapPart
                currentColumnIndex += length

            if not lineContinue:
                while contextStack.currentContext().lineEndContext is not None:
                    oldStack = contextStack
                    contextStack = contextStack.currentContext().lineEndContext.getNextContextStack(contextStack)
                    if oldStack == contextStack:  # avoid infinite while loop if nothing to switch
                        break

                # this code is not tested, because lineBeginContext is not defined by any xml file
                if contextStack.currentContext().lineBeginContext is not None:
                    contextStack = contextStack.currentContext().lineBeginContext.getNextContextStack(contextStack)
        elif contextStack.currentContext().lineEmptyContext is not None:
            contextStack = contextStack.currentContext().lineEmptyContext.getNextContextStack(contextStack)

        lineData = (contextStack, textTypeMap)
        return lineData, highlightedSegments