Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

MarkdownEditorPane: delete current line with Ctrl+D (Cmd+D on Mac)

AuthorKarl Tauber <email>
Date2015-08-04 00:08:50 GMT+0200
Commit51cd0c6956e70a8c060a5427287a95e58c385386
Parenta9d776d
Delta7 lines added, 0 lines removed, 7-line increase
src/main/java/org/markdownwriterfx/editor/MarkdownEditorPane.java
EventHandlerHelper.install(textArea.onKeyPressedProperty(), EventHandlerHelper
.on(keyPressed(ENTER)).act(this::enterPressed)
+ .on(keyPressed(D, KeyCombination.SHORTCUT_DOWN)).act(this::deleteLine)
.on(keyPressed(W, KeyCombination.ALT_DOWN)).act(this::showWhitespace)
.create());
newText = newText.concat(matcher.group(1));
textArea.replaceSelection(newText);
+ }
+
+ private void deleteLine(KeyEvent e) {
+ int start = textArea.getCaretPosition() - textArea.getCaretColumn();
+ int end = start + textArea.getParagraph(textArea.getCurrentParagraph()).fullLength();
+ textArea.deleteText(start, end);
}