From d4183ef72e8751b4bf0c992231df461854a4fc3b Mon Sep 17 00:00:00 2001 From: Li Guanglin <60415467+guanglinn@users.noreply.github.com> Date: Wed, 18 Sep 2024 09:04:45 +0800 Subject: [PATCH] Add Em Space special key for paragraph indent (#2400) --- .../markor/format/ActionButtonBase.java | 18 ++++---- app/src/main/res/values/arrays.xml | 11 ++--- .../res/values/string-not_translatable.xml | 44 +++++++++---------- app/src/main/res/values/strings.xml | 11 +++-- 4 files changed, 44 insertions(+), 40 deletions(-) diff --git a/app/src/main/java/net/gsantner/markor/format/ActionButtonBase.java b/app/src/main/java/net/gsantner/markor/format/ActionButtonBase.java index d81443524a..13802e5164 100644 --- a/app/src/main/java/net/gsantner/markor/format/ActionButtonBase.java +++ b/app/src/main/java/net/gsantner/markor/format/ActionButtonBase.java @@ -966,32 +966,34 @@ public void runSpecialKeyAction() { _hlEditor.simulateKeyPress(KeyEvent.KEYCODE_MOVE_END); } else if (callbackPayload.equals(rstr(R.string.key_pos_1_document))) { _hlEditor.setSelection(0); + } else if (callbackPayload.equals(rstr(R.string.key_pos_end_document))) { + _hlEditor.setSelection(_hlEditor.length()); } else if (callbackPayload.equals(rstr(R.string.move_text_one_line_up))) { ActionButtonBase.moveLineSelectionBy1(_hlEditor, true); } else if (callbackPayload.equals(rstr(R.string.move_text_one_line_down))) { ActionButtonBase.moveLineSelectionBy1(_hlEditor, false); - } else if (callbackPayload.equals(rstr(R.string.key_pos_end_document))) { - _hlEditor.setSelection(_hlEditor.length()); + } else if (callbackPayload.equals(rstr(R.string.select_current_line))) { + selectWholeLines(_hlEditor.getText()); } else if (callbackPayload.equals(rstr(R.string.key_ctrl_a))) { _hlEditor.setSelection(0, _hlEditor.length()); } else if (callbackPayload.equals(rstr(R.string.key_tab))) { _hlEditor.insertOrReplaceTextOnCursor("\u0009"); } else if (callbackPayload.equals(rstr(R.string.zero_width_space))) { _hlEditor.insertOrReplaceTextOnCursor("\u200B"); - } else if (callbackPayload.equals(rstr(R.string.search))) { - onSearch(); + } else if (callbackPayload.equals(rstr(R.string.em_space))) { + _hlEditor.insertOrReplaceTextOnCursor("\u2003"); } else if (callbackPayload.equals(rstr(R.string.break_page_pdf_print))) { _hlEditor.insertOrReplaceTextOnCursor("
"); + } else if (callbackPayload.equals(rstr(R.string.search))) { + onSearch(); } else if (callbackPayload.equals(rstr(R.string.ohm))) { _hlEditor.insertOrReplaceTextOnCursor("Ω"); + } else if (callbackPayload.equals(rstr(R.string.char_punctation_mark_arrows))) { + _hlEditor.insertOrReplaceTextOnCursor("»«"); } else if (callbackPayload.equals(rstr(R.string.continued_overline))) { _hlEditor.insertOrReplaceTextOnCursor("‾‾‾‾‾"); } else if (callbackPayload.equals(rstr(R.string.shrug))) { _hlEditor.insertOrReplaceTextOnCursor("¯\\_(ツ)_/¯"); - } else if (callbackPayload.equals(rstr(R.string.char_punctation_mark_arrows))) { - _hlEditor.insertOrReplaceTextOnCursor("»«"); - } else if (callbackPayload.equals(rstr(R.string.select_current_line))) { - selectWholeLines(_hlEditor.getText()); } }); } diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index f50ee08d0d..5c1941b552 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -52,20 +52,21 @@