From d5cfb38ac5cae33b639e1c3dad622480d4996518 Mon Sep 17 00:00:00 2001 From: stefan-niedermann Date: Thu, 7 Feb 2019 23:19:27 +0100 Subject: [PATCH] #363 Context based formatting - place cursor at the end of the selection after markdown has been added --- .../java/it/niedermann/owncloud/notes/util/StyleCallback.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/it/niedermann/owncloud/notes/util/StyleCallback.java b/app/src/main/java/it/niedermann/owncloud/notes/util/StyleCallback.java index 567e21f46..5a75a0ba1 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/util/StyleCallback.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/util/StyleCallback.java @@ -67,6 +67,7 @@ public boolean onActionItemClicked(ActionMode mode, MenuItem item) { this.addMarkdown(ssb, start, end, markdown, Typeface.BOLD); } editText.setText(ssb); + editText.setSelection(end + markdown.length() * 2); break; case R.id.italic: markdown = "*"; @@ -76,6 +77,7 @@ public boolean onActionItemClicked(ActionMode mode, MenuItem item) { this.addMarkdown(ssb, start, end, markdown, Typeface.ITALIC); } editText.setText(ssb); + editText.setSelection(end + markdown.length() * 2); break; case R.id.link: ssb.insert(end, "]()");