diff --git a/app/src/main/java/net/gsantner/markor/frontend/NewFileDialog.java b/app/src/main/java/net/gsantner/markor/frontend/NewFileDialog.java index 5ca8311cb..3ba502a48 100644 --- a/app/src/main/java/net/gsantner/markor/frontend/NewFileDialog.java +++ b/app/src/main/java/net/gsantner/markor/frontend/NewFileDialog.java @@ -367,11 +367,11 @@ public void setCallback(final GsCallback.a1 callback) { private Pair getTemplateContent(final String template, final String name) { String text = TextViewUtils.interpolateSnippet(template, name, ""); - final int startingIndex = template.indexOf(HighlightingEditor.PLACE_CURSOR_HERE_TOKEN); - text = text.replace(HighlightingEditor.PLACE_CURSOR_HERE_TOKEN, ""); + final int startingIndex = text.indexOf(HighlightingEditor.PLACE_CURSOR_HERE_TOKEN); + text = text.replaceAll(HighlightingEditor.PLACE_CURSOR_HERE_TOKEN, ""); // Has no utility in a new file - text = text.replace(HighlightingEditor.INSERT_SELECTION_HERE_TOKEN, ""); + text = text.replaceAll(HighlightingEditor.INSERT_SELECTION_HERE_TOKEN, ""); return Pair.create(text, startingIndex); }