private void showDocumentation(final Function<String, String> docHelper) { final String buffer = in.getCursorBuffer().buffer.toString(); final int cursor = in.getCursorBuffer().cursor; final String doc = docHelper.apply(buffer.substring(0, cursor)); try { if (doc != null) { in.println(); in.println(doc); in.redrawLine(); in.flush(); } else { in.beep(); } } catch (IOException ex) { throw new IllegalStateException(ex); } }