multuline text-overflow: ellipsis
357205
function Dotdotdot() {
  if(!(this instanceof Dotdotdot)) {
    throw new TypeError("Cannot call a class as a function");
  }
  this.update = this.update.bind(this);
  this.getContainerRef = function (container) {
    this.container = container;
  }.bind(this);
}
913945
@SuppressWarnings("fallthrough")
    private void inlineContent() {

        skipWhitespace();
        int pos = bp;
        int depth = 1;

        loop:
        while (bp < buflen) {

            switch (ch) {
                case '\n': case '\r': case '\f':
                    newline = true;
                    // fall through

                case ' ': case '\t':
                    nextChar();
                    break;

                case '&':
                    entity(null);
                    break;

                case '<':
                    newline = false;
                    html();
                    break;

                case '{':
                    newline = false;
                    depth++;
                    nextChar();
                    break;

                case '}':
                    newline = false;
                    if (--depth == 0) {
                        nextChar();
                        return;
                    }
                    nextChar();
                    break;

                case '@':
                    if (newline)
                        break loop;
                    // fallthrough

                default:
                    nextChar();
                    break;
            }
        }

    }
1080287
def _fill_text(self, text, width, indent):
        
        parts = text.split('\n\n')
        for i, part in enumerate(parts):
            # Check to see if it's a bulleted list--if so, then fill each line
            if part.startswith('* '):
                subparts = part.split('\n')
                for j, subpart in enumerate(subparts):
                    subparts[j] = super(WrappedTextHelpFormatter, self)._fill_text(
                        subpart, width, indent
                    )
                parts[i] = '\n'.join(subparts)
            else:
                parts[i] = super(WrappedTextHelpFormatter, self)._fill_text(part, width, indent)

        return '\n\n'.join(parts)
919278
public function truncate($str, $length, $ellipsis = '...')
    {
        $result = '';
        foreach (preg_split('/\b/U', $str) as $part) {
            if (strlen($result . $part) > $length) {
                $result = rtrim($result) . $ellipsis;
                break;
            } else {
                $result .= $part;
            }
        }

        return $result;
    }
791449
def shorten_text(self, text):
        """"""
        if len(text) > self.width:
            return text[:self.width - 3] + '...'
        return text
464324
def animate_ellipsis(self):
        """"""
        ellipsis = self.ellipsis.pop(0)
        text = ' '*len(ellipsis) + self.splash_text + ellipsis
        self.ellipsis.append(ellipsis)
        self._show_message(text)
301767
function textify(elems, filter, sep) {
  sep = sep || "";
  let ret = "";
  elems = filter(elems);
  const len = elems.length;

  for (let i = 0; i < len; i++) {
    let elem = elems[i];
    if (elem.type === "text") {
      ret += elem.data + sep;
    } else if (elem.children && elem.type !== "comment") {
      if (elem.name === "img" && elem.attribs.alt && elem.attribs.alt.length < 3) {
        // Javascript strings are UCS-2 or whatever, so it counts one emoji as 2ish chars
        ret += elem.attribs.alt;
      } else {
        ret += textify(elem.children, filter, sep);
      }
    }
  }

  return ret;
}
443178
def fill(text, delimiter="", width=70):
    
    texts = []
    for i in xrange(0, len(text), width):
        t = delimiter.join(text[i:i + width])
        texts.append(t)
    return "\n".join(texts)
1147675
def normalize_text(self, text):
        
        if not self.editor.free_format:
            text = ' ' * 6 + text[6:]
        return text.upper()
225506
function textLength($t, $mxl, $text) {
    	$taille_c = $t;
    	$len      = mb_strlen($text);
    	while (($taille_c - 2) * $len > $mxl) {
    		$taille_c--;
    		if ($taille_c == 2) {
    			break;
    		}
    	}
    
    	return $taille_c;
    }
187707
def normalize_multiline(line):
    
    if line.startswith('def ') and line.rstrip().endswith(':'):
        return line + ' pass'
    elif line.startswith('return '):
        return 'def _(): ' + line
    elif line.startswith('@'):
        return line + 'def _(): pass'
    elif line.startswith('class '):
        return line + ' pass'
    elif line.startswith(('if ', 'elif ', 'for ', 'while ')):
        return line + ' pass'
    else:
        return line
1145870
def _input_as_multiline_string(self, data):
        
        if data:
            self.Parameters['--in']\
                .on(super(Clearcut,self)._input_as_multiline_string(data))
        return ''
904172
function isMultiline(node, contentFirstLoc, contentLastLoc) {
    if (
        node.startTag.loc.start.line !== node.startTag.loc.end.line ||
        node.endTag.loc.start.line !== node.endTag.loc.end.line
    ) {
        // multiline tag
        return true
    }
    if (contentFirstLoc.line < contentLastLoc.line) {
        // multiline contents
        return true
    }
    return false
}
1012515
def balancedSlicer(text, openDelim='[', closeDelim=']'):
    
    openbr = 0
    cur = 0
    for char in text:
        cur +=1
        if char == openDelim:
            openbr += 1
        if char == closeDelim:
            openbr -= 1
        if openbr == 0:
            break
    return text[:cur], cur
295110
def _indent(text, amount):
    
    indentation = amount * ' '
    return indentation + ('\n' + indentation).join(text.split('\n'))
1181731
function shouldCommitValueSemicolon(text, cursorPosition)
        {
            // FIXME: should this account for semicolons inside comments?
            var openQuote = "";
            for (var i = 0; i < cursorPosition; ++i) {
                var ch = text[i];
                if (ch === "\\" && openQuote !== "")
                    ++i; // skip next character inside string
                else if (!openQuote && (ch === "\"" || ch === "'"))
                    openQuote = ch;
                else if (openQuote === ch)
                    openQuote = "";
            }
            return !openQuote;
        }
326947
function mult(x, y) {
  var ans=expand(x, x.length+y.length);
  mult_(ans, y);
  return trim(ans, 1);
}