private boolean onAltRight(KeyboardEvent event) { if (noContent()) return true; final Object item = selected(); if (item == null) { environment.hint(Hints.EMPTY_LINE); return true; } final String line = appearance.getScreenAppearance(item, NONE_APPEARANCE_FLAGS); NullCheck.notNull(line, "line"); if (line.isEmpty()) { environment.hint(Hints.EMPTY_LINE); return true; } final int leftBound = appearance.getObservableLeftBound(item); final int rightBound = appearance.getObservableRightBound(item); if (hotPointX >= rightBound) { environment.hint(Hints.END_OF_LINE); return true; } final String subline = line.substring(leftBound, rightBound); final WordIterator it = new WordIterator(subline, hotPointX - leftBound); if (!it.stepForward()) { environment.hint(Hints.END_OF_LINE); return true; } hotPointX = it.pos() + leftBound; if (it.announce().length() > 0) environment.say(it.announce()); else environment.hint(Hints.END_OF_LINE); environment.onAreaNewHotPoint(this); return true; }
private boolean onAltRight(KeyboardEvent event) { if (noContentCheck()) return true; if (hotPointY <= 0 || hotPointY > items.length || items[hotPointY - 1] == null) { luwrain.hint(Hints.EMPTY_LINE); return true; } final Object item = items[hotPointY - 1]; final String line = appearance.getScreenAppearance(item, 0); int leftBound = appearance.getObservableLeftBound(item); if (leftBound < 0) leftBound = 0; if (leftBound > line.length()) leftBound = line.length(); int rightBound = appearance.getObservableRightBound(item); if (rightBound < 0) rightBound = 0; if (rightBound >= line.length()) rightBound = line.length(); if (leftBound >= rightBound) { luwrain.hint(Hints.EMPTY_LINE); return true; } if (hotPointX >= rightBound) { luwrain.hint(Hints.END_OF_LINE); return true; } final String subline = line.substring(leftBound, rightBound); WordIterator it = new WordIterator(subline, hotPointX - leftBound); if (!it.stepForward()) { luwrain.hint(Hints.END_OF_LINE); return true; } hotPointX = it.pos() + leftBound; if (it.announce().length() > 0) luwrain.say(it.announce()); else luwrain.hint(Hints.END_OF_LINE); luwrain.onAreaNewHotPoint(this); return true; }