Return position of the next (in row) letter that is unwrittable
320730
def next_unwrittable_on_row(view, coords):
    """"""
    x, y = coords
    maxx = max(view.keys(), key=itemgetter(0))[0]
    for offset in range(x + 1, maxx):
        letter = view[offset, y]
        if letter not in REWRITABLE_LETTERS:
            return offset
    return None
729375
function getGettextPluralPosition(ext, suffix) {
  if (ext) {
    for (let i = 0; i < ext.nplurals; i += 1) {
      if (i === suffix) {
        return i;
      }
    }
  }

  return -1;
}
821932
def unindent(buffer, from_row, to_row, count=1):
    
    current_row = buffer.document.cursor_position_row
    line_range = range(from_row, to_row)

    def transform(text):
        remove = '    ' * count
        if text.startswith(remove):
            return text[len(remove):]
        else:
            return text.lstrip()

    # Apply transformation.
    new_text = buffer.transform_lines(line_range, transform)
    buffer.document = Document(
        new_text,
        Document(new_text).translate_row_col_to_index(current_row, 0))

    # Go to the start of the line.
    buffer.cursor_position += buffer.document.get_start_of_line_position(after_whitespace=True)
15808
def get_prev_letter(self):
        
        prev = self._prev_letter()
        while True:
            if not prev:
                return prev
            if prev.letter in prev.marks:
                prev = prev._prev_letter()
                continue
            return prev
767212
def computeIndent(self, block, char):
        
        prevBlockText = block.previous().text()  # invalid block returns empty text
        if char == '\n' and \
           prevBlockText.strip() == '':  # continue indentation, if no text
            return self._prevBlockIndent(block)
        else:  # be smart
            return self.computeSmartIndent(block, char)
338392
function updatePosition(str) {
    var lines = str.match(/\n/g);
    if (lines) lineno += lines.length;
    var i = str.lastIndexOf('\n');
    column = ~i ? str.length - i : column + str.length;
  }
129554
def get_row_sep(self):
        """"""
        if self.eol_btn.isChecked():
            return u"\n"
        return to_text_string(self.line_edt_row.text())
991777
function ( text ){
		   var out = [text],
			   chars = ['-','+','z','Z'],
			   i = chars.length;

			while (i--) {
			  if(text.indexOf(chars[i]) > -1){
				  out[0] = text.slice( 0, text.indexOf(chars[i]) );
				  out.push( text.slice( text.indexOf(chars[i]) ) );
				  break;
			   }
			}
		   return out;
		}
85420
function toPrint(s,isRaw) {
  var ctrl=/[\x00-\x1F\x7F-\x9F]/,unicode=/[\u009F-\uFFFF]/;
  s=s.split('').map(function (c) {
    if (!isRaw && printEscapeMap.hasOwnProperty(c)) return printEscapeMap[c];
    else if (unicode.test(c)) return '\\u'+('00'+ord(c).toString(16).toUpperCase()).slice(-4);
    else if (ctrl.test(c)) return '\\x'+("0"+ord(c).toString(16).toUpperCase()).slice(-2);
    return c;
  }).join('');
  return s;
}
403269
def next_match char
      start = @current_index
      start.upto(@list.length-1) do |ix|
        if @list[ix][0,1].casecmp(char) == 0
          return @list[ix] unless @list[ix] == @buffer
        end
        @current_index += 1
      end
      ## could not find, start from zero
      @current_index = 0
      start = [@list.length()-1, start].min
      0.upto(start) do |ix|
        if @list[ix][0,1].casecmp(char) == 0
          return @list[ix] unless @list[ix] == @buffer
        end
        @current_index += 1
      end
      @current_index = [@list.length()-1, @current_index].min
      return nil
    end
610252
function nextSeparator( str , runtime ) {
	var i = runtime.i ,
		eol = runtime.iEndOfLine ;

	for ( ; i < eol ; i ++ ) {

		switch ( str.charCodeAt( i ) ) {
			case 0x20 :	//     space
			case 0x28 :	// (   open parenthesis
			case 0x29 :	// )   close parenthesis
			case 0x2c :	// ,   comma
			case 0x3a :	// :   colon
			case 0x22 :	// "   double-quote
			case 0x24 :	// $   dollar
			case 0x5b :	// [   open bracket
			case 0x5d :	// ]   close bracket
			case 0x7b :	// {   open curly brace
			case 0x7d :	// }   close curly brace
				return i ;
		}
	}

	// return i/eol
	return i ;
}
516208
public void gotoPosWritable0(int newIndex) {
        switch (depth - 1) {
            case 5:
                display5 = copyOf(display5);
                display4 = nullSlotAndCopy(display5, (newIndex >> 25) & 31);
                display3 = nullSlotAndCopy(display4, (newIndex >> 20) & 31);
                display2 = nullSlotAndCopy(display3, (newIndex >> 15) & 31);
                display1 = nullSlotAndCopy(display2, (newIndex >> 10) & 31);
                display0 = nullSlotAndCopy(display1, (newIndex >> 5) & 31);
                break;
            case 4:
                display4 = copyOf(display4);
                display3 = nullSlotAndCopy(display4, (newIndex >> 20) & 31);
                display2 = nullSlotAndCopy(display3, (newIndex >> 15) & 31);
                display1 = nullSlotAndCopy(display2, (newIndex >> 10) & 31);
                display0 = nullSlotAndCopy(display1, (newIndex >> 5) & 31);
                break;
            case 3:
                display3 = copyOf(display3);
                display2 = nullSlotAndCopy(display3, (newIndex >> 15) & 31);
                display1 = nullSlotAndCopy(display2, (newIndex >> 10) & 31);
                display0 = nullSlotAndCopy(display1, (newIndex >> 5) & 31);
                break;
            case 2:
                display2 = copyOf(display2);
                display1 = nullSlotAndCopy(display2, (newIndex >> 10) & 31);
                display0 = nullSlotAndCopy(display1, (newIndex >> 5) & 31);
                break;
            case 1:
                display1 = copyOf(display1);
                display0 = nullSlotAndCopy(display1, (newIndex >> 5) & 31);
                break;
            case 0:
                display0 = copyOf(display0);
                break;
            default:
        }
    }
1282668
private JNoteElementAbstract getHighestNoteGlyphBetween(NoteAbstract start, NoteAbstract end, boolean excludeStartAndEnd) {
		Collection jnotes = getNoteGlyphesBetween(start, end);
		JNoteElementAbstract ret = null;
		boolean first = true;
		for (Iterator it = jnotes.iterator(); it.hasNext();) {
			JNoteElementAbstract n = (JNoteElementAbstract) it.next();
			if (first && excludeStartAndEnd) {
				//ignore start ?
				first = false;
				continue;
			}
			if (!it.hasNext() && excludeStartAndEnd) {
				//ignore end ?
				break;
			}
			if (ret == null)
				ret = n;
			else {
				if (n.getBoundingBox().getMinY()
					< ret.getBoundingBox().getMinY())
					ret = n;
			}
		}
		return ret;
	}
878962
def next(self):
        
        if self._cur_row >= len(self._table):
            raise StopIteration
        data = self._table[self._cur_row].copy()
        self._cur_row += 1
        return data
1224940
def next(self):
        """"""
        # Block until a document is returnable.
        while self.alive:
            doc = self._try_next(True)
            if doc is not None:
                return doc

        raise StopIteration
601284
def _line(self, text, indent=0):
        """"""
        leading_space = '  ' * indent
        while len(leading_space) + len(text) > self.width:
            # The text is too wide; wrap if possible.

            # Find the rightmost space that would obey our width constraint and
            # that's not an escaped space.
            available_space = self.width - len(leading_space) - len(' $')
            space = available_space
            while True:
                space = text.rfind(' ', 0, space)
                if (space < 0 or
                    self._count_dollars_before_index(text, space) % 2 == 0):
                    break

            if space < 0:
                # No such space; just use the first unescaped space we can find.
                space = available_space - 1
                while True:
                    space = text.find(' ', space + 1)
                    if (space < 0 or
                        self._count_dollars_before_index(text, space) % 2 == 0):
                        break
            if space < 0:
                # Give up on breaking.
                break

            self.output.write(leading_space + text[0:space] + ' $\n')
            text = text[space+1:]

            # Subsequent lines are continuations, so indent them.
            leading_space = '  ' * (indent+2)

        self.output.write(leading_space + text + '\n')
929627
def unindent(self, lines):
        """"""
        indent = min(
            len(self.re.match(r'^ *', line).group()) for line in lines)
        return [line[indent:].rstrip() for line in lines]