/** * Possible states in which the current readline operation may be in. */ private static enum State { /** * The user is just typing away */ NORMAL, /** * In the middle of a emacs seach */ SEARCH, FORWARD_SEARCH, /** * VI "yank-to" operation ("y" during move mode) */ VI_YANK_TO, /** * VI "delete-to" operation ("d" during move mode) */ VI_DELETE_TO, /** * VI "change-to" operation ("c" during move mode) */ VI_CHANGE_TO }
public int codePointBefore(int index) { return builder.codePointBefore(index); }
public int codePointBefore(int index) { return delegator.codePointBefore(index); }
public int codePointBefore(int index) { return sb.codePointBefore(index); }
@Override @JTranscAsync public synchronized int codePointBefore(int index) { return super.codePointBefore(index); }
/** * Returns {@code true} if the name of the given code is the prefix of a word in the datum name. * We do not test the characters following the prefix because the word may be incomplete * (e.g. {@code "geoid"} versus {@code "geoidal"}). * * <p>This method is public as an implementation side-effect and should be ignored.</p> * * @param code the code to test. * @return {@code true} if the code matches the criterion. */ @Override public boolean accept(final CodeList<?> code) { final int i = datum.indexOf(code.name()); return (i == 0) || (i >= 0 && Character.isWhitespace(datum.codePointBefore(i))); }
/** * Returns {@code true} if the name of the given code is the prefix of a word in the datum name. * We do not test the characters following the prefix because the word may be incomplete * (e.g. {@code "geoid"} versus {@code "geoidal"}). * * <p>This method is public as an implementation side-effect and should be ignored.</p> * * @param code the code to test. * @return {@code true} if the code matches the criterion. */ @Override public boolean accept(final CodeList<?> code) { final int i = datum.indexOf(code.name()); return (i == 0) || (i >= 0 && Character.isWhitespace(datum.codePointBefore(i))); }
/** * Return the previous character in the normalized text and decrement * the iteration position by one. If the beginning * of the text has already been reached, {@link #DONE} is returned. * @return The codepoint as an int * @deprecated ICU 56 */ @Deprecated public int previous() { if(bufferPos>0 || previousNormalize()) { int c=buffer.codePointBefore(bufferPos); bufferPos-=Character.charCount(c); return c; } else { return DONE; } }
private int previousCC() { // Returns 0 if there is no previous character. codePointLimit=codePointStart; if(reorderStart>=codePointStart) { return 0; } int c=str.codePointBefore(codePointStart); codePointStart-=Character.charCount(c); if(c<MIN_CCC_LCCC_CP) { return 0; } return getCCFromYesOrMaybe(impl.getNorm16(c)); }
boolean isPossibleBreakBefore(int pos) { try { // check previous char. Can't split after specified chars. int cp = str.codePointBefore(pos); // U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK // U+201E DOUBLE LOW-9 QUOTATION MARK if (":\\([{<\u00ab\u201e".indexOf(cp) >= 0) { return false; } } catch (StringIndexOutOfBoundsException ex) { } try { // check next char. Can't split before specified chars. int cp = str.codePointAt(pos); // U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK // U+201C LEFT DOUBLE QUOTATION MARK if ("{:)]}>\u00bb\u201c,.".indexOf(cp) >= 0) { return false; } } catch (StringIndexOutOfBoundsException ex) { } return true; }
/** * Apply a processed event. * @param event the event to be applied */ public void applyProcessedEvent(final Event event) { if (null != event) { // TODO: figure out the generic way of doing this if (Constants.CODE_DELETE == event.mKeyCode) { final int length = mCombinedText.length(); if (length > 0) { final int lastCodePoint = mCombinedText.codePointBefore(length); mCombinedText.delete(length - Character.charCount(lastCodePoint), length); } } else { final CharSequence textToCommit = event.getTextToCommit(); if (!TextUtils.isEmpty(textToCommit)) { mCombinedText.append(textToCommit); } } } updateStateFeedback(); }
return; int cp = str.codePointBefore(str.length()); if (cp == '\n' || cp == '\r') { cp = str.codePointBefore(str.length()); if (cp == '\n' || cp == '\r') { eol1 = (char) cp;
@Override public void write(char[] cbuf, int off, int len) throws IOException { for (int cp, i = 0; i < len; i += Character.charCount(cp)) { cp = Character.codePointAt(cbuf, off + i); if (breakChars > 0 && cp == str.codePointBefore(str.length())) { // the same eol char - flush outLine(); } if (cp == '\n' || cp == '\r') { str.appendCodePoint(cp); breakChars++; if (breakChars > 1) { // 2 eol chars - flush outLine(); } } else { if (breakChars > 0) { // was eol char - flush outLine(); } str.appendCodePoint(cp); } } }
final int cp = buffer.codePointBefore(lg); if (isWhitespace(cp) || cp == '_') { buffer.setLength(lg - charCount(cp));
final int cp = buffer.codePointBefore(lg); if (isWhitespace(cp)) { buffer.setLength(lg - charCount(cp));
final int cp = buffer.codePointBefore(lg); if (isWhitespace(cp)) { buffer.setLength(lg - charCount(cp));
if (buffer.codePointBefore(end) == ')') end--; for (int n=0, columnIndex=0; n < indices.length; columnIndex++) { int start = end; for (int c; (c = buffer.codePointBefore(start)) != ',';) { start -= Character.charCount(c); if (c == '\'') { while (true) { c = buffer.codePointBefore(start); start -= Character.charCount(c); if (c == '\'') { if (buffer.codePointBefore(start) != '\'') { break;
if (!Character.isUnicodeIdentifierPart(buffer.codePointBefore(i))) { final int end = i + length; if (!Character.isUnicodeIdentifierPart(buffer.codePointAt(end))) {
/** * Possible states in which the current readline operation may be in. */ private static enum State { /** * The user is just typing away */ NORMAL, /** * In the middle of a emacs seach */ SEARCH, FORWARD_SEARCH, /** * VI "yank-to" operation ("y" during move mode) */ VI_YANK_TO, /** * VI "delete-to" operation ("d" during move mode) */ VI_DELETE_TO, /** * VI "change-to" operation ("c" during move mode) */ VI_CHANGE_TO }
return c; } else if(state.compareTo(State.IN_NORM_ITER_AT_LIMIT) >= 0 && pos != 0) { c = normalized.codePointBefore(pos); pos -= Character.charCount(c); return c;