Takes a single line, optionally adds an indent and/or outcome
        character to the beginning of the line.
760631
def formatLine(self, line, indent=0, outcome_char=''):
        
        actual_spaces = (indent * self.indent_spaces) - len(outcome_char)
        return (outcome_char + ' ' * actual_spaces + line)
149103
def append_line(self, new_line):
        """"""
        # TODO: The user still has to write the raw line, this is error prone.
        self._write(('PGM', [Integer, String]), self.idx, new_line)
528812
def indent_block(amount, text, indent_char='\t'):
    
    rst = ""
    for line in text.splitlines():
        if amount > 0:
            rst += indent_char*amount + line + "\n"
        else:
            rst += ''.join([c for i,c in enumerate(line) if (c == indent_char and (i+1) > abs(amount)) or (not c == indent_char)]) + "\n"
    return rst
1187078
def wrap(string, length, indent):
    
    newline = "\n" + " " * indent
    return newline.join((string[i : i + length] for i in range(0, len(string), length)))
71719
public function appendLine($line, $indent = 0)
    {
        $this->content .= ($indent ? $this->makeIndent($indent) : $this->indentCache) . $line . $this->newline;
    }
193820
def newline_text(self, text, indent = False):
        """"""
        self.newline(indent)
        self.text(text)
657900
final void add(String newcode) {
    maybeEndStatement();

    if (newcode.isEmpty()) {
      return;
    }

    char c = newcode.charAt(0);
    if ((isWordChar(c) || c == '\\') && isWordChar(getLastChar())) {
      // need space to separate. This is not pretty printing.
      // For example: "return foo;"
      append(" ");
    } else if (c == '/' && getLastChar() == '/') {
      // Do not allow a forward slash to appear after a DIV.
      // For example,
      // REGEXP DIV REGEXP
      // is valid and should print like
      // / // / /
      append(" ");
    } else if ((c == '"' || c == '\'') && isWordChar(getLastChar())) {
      maybeInsertSpace();
    }

    // Iterate through the new code and add each contained line, followed by a break. Remember that
    // the string may start and end in the middle of a line. We do this rather primitively because
    // this method is called frequently and most invocations have only one line.
    // TODO(nickreid): There are other possible newline characters recognized by the JS spec. We
    // should also be considering them.
    int startOfLine = 0;
    int endOfLine = newcode.indexOf('\n');
    while (endOfLine >= 0) {
      if (endOfLine > startOfLine) {
        // Append line only if it is non-empty.
        append(newcode.substring(startOfLine, endOfLine));
      }
      // Breaking is non-optional. Newlines added this way must be preserved (e.g. newlines in
      // template literals).
      startNewLine();

      startOfLine = endOfLine + 1; // Jump over the newline char.
      endOfLine = newcode.indexOf('\n', startOfLine);
    }
    if (newcode.length() > startOfLine) {
      // Append line only if it is non-empty.
      append(newcode.substring(startOfLine)); // Append the last or only line without breaking.
    }
  }
1191981
function appendLine(num, content, prefix) {
    sb.append(prefix + lineNumbers[num] + ' | ' + content + '\n');
  }
109948
private void appendLinebreak(int count, boolean force) {

        if (m_appendBr) {
            if (m_storedBrCount > count) {
                count = m_storedBrCount;
            }
            m_storedBrCount = 0;
            if (force) {
                m_brCount = 0;
            }
            while (m_brCount < count) {
                m_result.append("\r\n");
                m_brCount++;
            }
            m_lineLength = m_indent;
        } else {
            while (m_storedBrCount < count) {
                m_storedBrCount++;
            }
        }
    }
924672
def puts(s='', newline=True, stream=STDOUT):
    """"""
    max_width_ctx = _get_max_width_context()
    if max_width_ctx:
        cols, separator = max_width_ctx[-1]
        s = max_width(s, cols, separator)

    if newline:
        s = tsplit(s, NEWLINES)
        s = map(str, s)
        indent = ''.join(INDENT_STRINGS)

        s = (str('\n' + indent)).join(s)

    _str = ''.join((
        ''.join(INDENT_STRINGS),
        str(s),
        '\n' if newline else ''
    ))
    stream(_str)
1339271
def indent (text, indent_string="  "):
    """"""
    lines = str(text).splitlines()
    return os.linesep.join("%s%s" % (indent_string, x) for x in lines)
387379
def indent(text: str, num: int = 2) -> str:
    """"""
    lines = text.splitlines()
    return "\n".join(indent_iterable(lines, num=num))
1126984
public static String getIndent(String line) {
        if (line == null || line.length() == 0) {
            return "";
        }
        int i = 0;
        while (i < line.length() && line.charAt(i) == '\t') {
            i++;
        }
        return line.substring(0, i);
    }
740990
function indent(string) {
  let lines = [];
  for (let line of string.split('\n')) {
    lines.push('  ' + line);
  }
  return lines.join('\n');
}
885465
function defineFix(line, actualText, expectedIndent) {
                return fixer => {
                    const start = sourceCode.getIndexFromLoc({
                        line,
                        column: 0,
                    })
                    const indent = expectedIndent.indentText
                    return fixer.replaceTextRange(
                        [start, start + actualText.length],
                        indent
                    )
                }
            }
515683
function indento(input, width, char) {
    char = typeof char !== "string" ? " " : char;
    return String(input).replace(/^/gm, char.repeat(width));
}
1324430
def indent_text(string, indent_level=2):
    """"""
    indented_lines = []

    indent_spaces = ' ' * indent_level

    for line in string.split('\n'):
        indented_lines.append(indent_spaces + line)

    return '\n'.join(indented_lines)