Enter pressed.
        Insert properly indented block
436488
def _insertNewBlock(self):
        
        cursor = self.textCursor()
        atStartOfLine = cursor.positionInBlock() == 0
        with self:
            cursor.insertBlock()
            if not atStartOfLine:  # if whole line is moved down - just leave it as is
                self._indenter.autoIndentBlock(cursor.block())
        self.ensureCursorVisible()
1350316
def tab_insert(self, e):  # (M-TAB)
         '''
        cursor = min(self.l_buffer.point, len(self.l_buffer.line_buffer))
        ws = ' ' * (self.tabstop - (cursor % self.tabstop))
        self.insert_text(ws)
        self.finalize()
801568
function indent(str, indent) {
            if (typeof indent === 'number') {
                var indent_str = '';
                while (indent_str.length < indent) indent_str += ' ';
                indent = indent_str;
            }
            var lines = str.split(/\n/);
            for (var i=0; i<lines.length; i++) {
                if (lines[i].trim() !== '')
                    lines[i] = indent + lines[i];
            }
            return lines.join("\n");            
        }
1181084
def unindent(self):
        

        cursor = self.textCursor()
        if not cursor.hasSelection():
            cursor.movePosition(QTextCursor.StartOfBlock)
            line = foundations.strings.to_string(self.document().findBlockByNumber(cursor.blockNumber()).text())
            indent_marker = re.match(r"({0})".format(self.__indent_marker), line)
            if indent_marker:
                foundations.common.repeat(cursor.deleteChar, len(indent_marker.group(1)))
        else:
            block = self.document().findBlock(cursor.selectionStart())
            while True:
                block_cursor = self.textCursor()
                block_cursor.setPosition(block.position())
                indent_marker = re.match(r"({0})".format(self.__indent_marker), block.text())
                if indent_marker:
                    foundations.common.repeat(block_cursor.deleteChar, len(indent_marker.group(1)))
                if block.contains(cursor.selectionEnd()):
                    break
                block = block.next()
        return True
74396
function press(event) {
      if (event.keyCode === 39) {
        Components.Run.make(Components.Direction.resolve('>'));
      }

      if (event.keyCode === 37) {
        Components.Run.make(Components.Direction.resolve('<'));
      }
    }
1258207
def _indentUpTo(self, text, width):
        
        visibleTextWidth = self._realToVisibleColumn(text, len(text))
        diff = width - visibleTextWidth
        if diff <= 0:
            return ''
        elif self._qpart.indentUseTabs and \
           all([char == '\t' for char in text]):  # if using tabs and only tabs in text
            return '\t' * (diff // self._qpart.indentWidth) + \
                   ' ' * (diff % self._qpart.indentWidth)
        else:
            return ' ' * int(diff)
1307750
def tryCppComment(self, block):
        
        if not block.previous().isValid() or \
           not CFG_AUTO_INSERT_SLACHES:
            return None

        prevLineText = block.previous().text()

        indentation = None
        comment = prevLineText.lstrip().startswith('#')

        # allowed are: #, #/, #! #/<, #!< and ##...
        if comment:
            prevLineText = block.previous().text()
            lstrippedText = block.previous().text().lstrip()
            if len(lstrippedText) >= 4:
                char3 = lstrippedText[2]
                char4 = lstrippedText[3]

            indentation = self._lineIndent(prevLineText)

            if CFG_AUTO_INSERT_SLACHES:
                if prevLineText[2:4] == '//':
                    # match ##... and replace by only two: #
                    match = re.match(r'^\s*(\/\/)', prevLineText)
                elif (char3 == '/' or char3 == '!'):
                    # match #/, #!, #/< and #!
                    match = re.match(r'^\s*(\/\/[\/!][<]?\s*)', prevLineText)
                else:
                    # only #, nothing else:
                    match = re.match(r'^\s*(\/\/\s*)', prevLineText)

                if match is not None:
                    self._qpart.insertText((block.blockNumber(), 0), match.group(1))

        if indentation is not None:
            dbg("tryCppComment: success in line %d" % block.previous().blockNumber())

        return indentation
1344715
def indent(self):
        
        blk = IndentBlock(self, self._indent)
        self._indent += 1
        return blk
245800
function indent(str/*: string*/, level/*: number*/ = 1) /*: string*/ {
    if (typeof str === 'number') [ level, str ] = [ str, level ];
    if (typeof level !== 'number') level = 1;
    return (str || '').replace(/^/gm, '  '.repeat(level));
}
68441
def indent(self):
        

        cursor = self.textCursor()
        if not cursor.hasSelection():
            cursor.insertText(self.__indent_marker)
        else:
            block = self.document().findBlock(cursor.selectionStart())
            while True:
                block_cursor = self.textCursor()
                block_cursor.setPosition(block.position())
                block_cursor.insertText(self.__indent_marker)
                if block.contains(cursor.selectionEnd()):
                    break
                block = block.next()
        return True
1052896
function (blockname) {
            this._stack.push(this._curblock);
            this._curblock = this._blocks[blockname];
            if (this.indentUnit && this._curblock) {
                this._updateIndent();
            }
        }
31298
def pre_process_code_block(block):
        
        if 'indent' in block and block['indent']:
            indent = r'^' + block['indent']
            block['content'] = re.sub(indent, '', block['icontent'],
                                      flags=re.MULTILINE)
1325994
def insert(self, button):
        
        if self.inline_keyboard and len(self.inline_keyboard[-1]) < self.row_width:
            self.inline_keyboard[-1].append(button)
        else:
            self.add(button)
        return self
53864
def _fill(self, text = ""):
        ""
        if self._do_indent:
            self._write("\n"+"    "*self._indent + text)
        else:
            self._write(text)
586514
def press_enter(multiple=False, silent=False):
    """"""

    def f():
        try:
            while True:
                if silent:
                    yield input()
                else:
                    sys.stderr.write("<press enter> ")
                    sys.stderr.flush()
                    yield input()
                if not multiple:
                    break
        except (EOFError, KeyboardInterrupt):
            # User Ctrl+D or Ctrl+C'd
            if not silent:
                # Prevents the user's terminal getting clobbered
                sys.stderr.write("\n")
                sys.stderr.flush()
            return

    return f
1166743
private void appendIndentation() {

        if (m_lineLength <= m_indent) {
            int len = (m_marker != null) ? m_indent - (m_marker.length() + 1) : m_indent;
            for (int i = 0; i < len; i++) {
                m_result.append(' ');
            }
            if (m_marker != null) {
                m_result.append(m_marker);
                m_result.append(' ');
                m_marker = null;
            }
        }
    }
188914
def indentation_post_event_input_accelerators(editor, event):
    

    if event.key() in (Qt.Key_Enter, Qt.Key_Return):
        cursor = editor.textCursor()
        block = cursor.block().previous()
        if block.isValid():
            indent = match = re.match(r"(\s*)", foundations.strings.to_string(block.text())).group(1)
            cursor.insertText(indent)

            indentation_symbols = get_editor_capability(editor, "indentation_symbols")
            if not indentation_symbols:
                return True

            if not block.text():
                return True

            if not foundations.strings.to_string(block.text())[-1] in indentation_symbols:
                return True

            symbols_pairs = get_editor_capability(editor, "symbols_pairs")
            if not symbols_pairs:
                return True

            cursor.insertText(editor.indent_marker)

            position = cursor.position()
            cursor.movePosition(QTextCursor.PreviousBlock, QTextCursor.MoveAnchor)
            cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.MoveAnchor)
            cursor.movePosition(QTextCursor.PreviousCharacter, QTextCursor.KeepAnchor)
            previous_character = foundations.strings.to_string(cursor.selectedText())
            cursor.setPosition(position)
            next_character = editor.get_next_character()
            if previous_character in symbols_pairs:
                if next_character in symbols_pairs.values():
                    cursor.insertBlock()
                    cursor.insertText(match)
                    cursor.movePosition(QTextCursor.PreviousBlock, QTextCursor.MoveAnchor)
                    cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.MoveAnchor)
                    editor.setTextCursor(cursor)
    return True