}
return string;
}
private String processNextChordIterationString(String string, Chord chord) {
Document document = modes.getDocument();
switch (modes.getDocumentState()) {
case GET_LABEL_STRING:
if (string.matches("\\s*")) {
// An empty string removes the label.
getCurrent().getEquation().setLabel(null);
string = "";
// A blank string means clear; a null string would imply failure.
} else {
getCurrent().getEquation().setLabel(string);
}
return string;
case SIFT:
if (string.matches("\\s*")) {
modes.error(" !!! Cannot search for whitespace !!! ");
return null;
}
modes.getSearch().search(string, Search.FORWARDS);
// Restrict the view to those lines that matched the search.
Vector<Equation> eqtns = modes.getSearch().getEquationMatches();
if (eqtns!=null) {
document.getKetPanel().setVisibleEquations(eqtns);
}
return string;
case SEARCH_FORWARDS:
if (string.matches("\\s*")) {
modes.error(" !!! Cannot search for whitespace !!! ");
return null;
}
modes.getSearch().search(string, Search.FORWARDS);
return string;
case SEARCH_BACKWARDS:
if (string.matches("\\s*")) {
modes.error(" !!! Cannot search for whitespace !!! ");
return null;
}
modes.getSearch().search(string, Search.BACKWARDS);
return string;
case COMMAND:
/*-
// TODO: If on processing the command, the responder
// changed, don't return to normal responder.
modes.getCommandMode().processCommand(string, chord);
// TODO: Only return the string if command responder worked as expected.
return string;
*/
//- Ket.out.println(" --- TEST: Normal command --- ");
//- document.getKeyboardEventHandler().normal(string);
CommandListener cl = document.getCommandListener();
if (cl!=null) {
cl.ketCommand(string);
} else {
Ket.out.println("[no command listener: '"+string+"']");
}