Skip to content

Commit

Permalink
Add Em Space special key for paragraph indent (gsantner#2400)
Browse files Browse the repository at this point in the history
  • Loading branch information
guanglinn authored Sep 18, 2024
1 parent ea066b6 commit d4183ef
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 40 deletions.
18 changes: 10 additions & 8 deletions app/src/main/java/net/gsantner/markor/format/ActionButtonBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -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("<div style='page-break-after:always;'></div>");
} 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());
}
});
}
Expand Down
11 changes: 6 additions & 5 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,21 @@
<item translatable="false">@string/key_page_down</item>
<item translatable="false">@string/key_pos_1</item>
<item translatable="false">@string/key_pos_end</item>
<item translatable="false">@string/move_text_one_line_up</item>
<item translatable="false">@string/move_text_one_line_down</item>
<item translatable="false">@string/key_pos_1_document</item>
<item translatable="false">@string/key_pos_end_document</item>
<item translatable="false">@string/move_text_one_line_up</item>
<item translatable="false">@string/move_text_one_line_down</item>
<item translatable="false">@string/select_current_line</item>
<item translatable="false">@string/key_ctrl_a</item>
<item translatable="false">@string/key_tab</item>
<item translatable="false">@string/search</item>
<item translatable="false">@string/zero_width_space</item>
<item translatable="false">@string/em_space</item>
<item translatable="false">@string/break_page_pdf_print</item>
<item translatable="false">@string/search</item>
<item translatable="false">@string/ohm</item>
<item translatable="false">@string/char_punctation_mark_arrows</item>
<item translatable="false">@string/shrug</item>
<item translatable="false">@string/continued_overline</item>
<item translatable="false">@string/select_current_line</item>
<item translatable="false">@string/shrug</item>
</string-array>

<string-array name="asciidoc_textactions_press_key__text" translatable="false">
Expand Down
44 changes: 21 additions & 23 deletions app/src/main/res/values/string-not_translatable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ work. If not, see <https://creativecommons.org/publicdomain/zero/1.0/>.
<string name="front_matter" translatable="false">Front Matter</string>
<string name="mime_type" translatable="false">MIME type</string>

<string name="community" translatable="false">Community</string>
<string name="default_font_family" translatable="false">sans-serif-regular</string>
<string name="start" translatable="false">Start</string>
<string name="quicknote" translatable="false">QuickNote</string>
Expand Down Expand Up @@ -294,38 +293,38 @@ work. If not, see <https://creativecommons.org/publicdomain/zero/1.0/>.
<!-- used in runAsciidocSpecialKeyAction -->

<!-- https://docs.asciidoctor.org/asciidoc/latest/text/text-span-built-in-roles/ -->
<string name="asciidoc_underline" translatable="false">role - underline</string>
<string name="asciidoc_overline" translatable="false">role - overline</string>
<string name="asciidoc_linethrough" translatable="false">role - linethrough</string>
<string name="asciidoc_nobreak" translatable="false">role - nobreak</string>
<string name="asciidoc_nowrap" translatable="false">role - nowrap</string>
<string name="asciidoc_prewrap" translatable="false">role - prewrap</string>
<string name="asciidoc_underline" translatable="false">role - underline</string>
<string name="asciidoc_overline" translatable="false">role - overline</string>
<string name="asciidoc_linethrough" translatable="false">role - linethrough</string>
<string name="asciidoc_nobreak" translatable="false">role - nobreak</string>
<string name="asciidoc_nowrap" translatable="false">role - nowrap</string>
<string name="asciidoc_prewrap" translatable="false">role - prewrap</string>

<!-- https://docs.asciidoctor.org/asciidoc/latest/text/highlight/ -->
<string name="asciidoc_highlight" translatable="false">inline - highlight</string>
<string name="asciidoc_highlight" translatable="false">inline - highlight</string>

<!-- https://docs.asciidoctor.org/asciidoc/latest/text/subscript-and-superscript/ -->
<string name="asciidoc_subscript" translatable="false">inline - subscript</string>
<string name="asciidoc_superscript" translatable="false">inline - superscript</string>
<string name="asciidoc_subscript" translatable="false">inline - subscript</string>
<string name="asciidoc_superscript" translatable="false">inline - superscript</string>


<!-- https://docs.asciidoctor.org/asciidoc/latest/blocks/delimited/ -->
<string name="asciidoc_block_comment" translatable="false">block - comment</string>
<string name="asciidoc_block_example" translatable="false">block - example</string>
<string name="asciidoc_block_listing" translatable="false">block - listing</string>
<string name="asciidoc_block_literal" translatable="false">block - literal</string>
<string name="asciidoc_block_open" translatable="false">block - open</string>
<string name="asciidoc_block_sidebar" translatable="false">block - sidebar</string>
<string name="asciidoc_block_table" translatable="false">block - table</string>
<string name="asciidoc_block_pass" translatable="false">block - pass</string>
<string name="asciidoc_block_quote" translatable="false">block - quote</string>

<string name="asciidoc_block_code" translatable="false">block - code</string>
<string name="asciidoc_block_comment" translatable="false">block - comment</string>
<string name="asciidoc_block_example" translatable="false">block - example</string>
<string name="asciidoc_block_listing" translatable="false">block - listing</string>
<string name="asciidoc_block_literal" translatable="false">block - literal</string>
<string name="asciidoc_block_open" translatable="false">block - open</string>
<string name="asciidoc_block_sidebar" translatable="false">block - sidebar</string>
<string name="asciidoc_block_table" translatable="false">block - table</string>
<string name="asciidoc_block_pass" translatable="false">block - pass</string>
<string name="asciidoc_block_quote" translatable="false">block - quote</string>

<string name="asciidoc_block_code" translatable="false">block - code</string>
<string name="asciidoc_block_collapsible" translatable="false">block - collapsible</string>

<!-- https://docs.asciidoctor.org/asciidoc/latest/blocks/breaks/#page-breaks -->
<string name="asciidoc_break_thematic" translatable="false">break - thematic</string>
<string name="asciidoc_break_page" translatable="false">break - page</string>
<string name="asciidoc_break_page" translatable="false">break - page</string>


<string name="abid_wikitext_h1" translatable="false">abid_wikitext_h1</string>
Expand Down Expand Up @@ -390,7 +389,6 @@ work. If not, see <https://creativecommons.org/publicdomain/zero/1.0/>.
<string name="pref_key__new_file_dialog_lastused_extension" translatable="false">pref_key__new_file_dialog_lastused_extension</string>
<string name="pref_key__new_file_dialog_lastused_type" translatable="false">pref_key__new_file_dialog_lastused_type</string>
<string name="pref_key__file_browser_last_browsed_folder" translatable="false">pref_key__file_browser_last_browsed_folder</string>
<string name="select_current_line" translatable="false">Select current line(s)</string>
<string name="pref_key__file_description_format" translatable="false">pref_key__file_description_format</string>
<string name="pref_key__wikitext_bigger_headings" translatable="false">pref_key__wikitext_bigger_headings</string>
<string name="pref_key__asciidoc_bigger_headings" translatable="false">pref_key__asciidoc_bigger_headings</string>
Expand Down
11 changes: 7 additions & 4 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,18 @@ work. If not, see <https://creativecommons.org/publicdomain/zero/1.0/>.
<string name="asciidoc_special_key">Special AsciiDoc Content</string>
<string name="key_page_up">Page Up (Page Up)</string>
<string name="key_page_down">Page Down (Page Down)</string>
<string name="move_text_one_line_up">Move text one line up</string>
<string name="move_text_one_line_down">Move text one line down</string>
<string name="start_new_line_below">Start new line below</string>
<string name="key_pos_1">Line Start (Pos Home)</string>
<string name="key_pos_end">Line End (Pos End)</string>
<string name="key_pos_1_document">Document Start</string>
<string name="key_pos_end_document">Document End</string>
<string name="move_text_one_line_up">Move line up</string>
<string name="move_text_one_line_down">Move line down</string>
<string name="start_new_line_below">Start new line</string>
<string name="select_current_line">Select current line</string>
<string name="key_ctrl_a">Select all (Ctrl+A)</string>
<string name="key_tab">Tabulator</string>
<string name="zero_width_space">Zero-width space</string>
<string name="em_space">Em space (&amp;emsp;)</string>
<string name="start_on_bottom">Start on bottom</string>
<string name="start_on_bottom_when_loading_document">Upon loading a document, position cursor at its end</string>
<string name="unordered_list_character">Unordered list character</string>
Expand Down Expand Up @@ -243,6 +246,7 @@ work. If not, see <https://creativecommons.org/publicdomain/zero/1.0/>.
<string name="project_license">Project License</string>
<string name="contribute_code_to_this_project_anybody_welcome">Contribute code to the project. Everybody is welcome to do so, including newcomers</string>
<string name="project_team">Project Team</string>
<string name="community">Community</string>
<string name="contributors_public_add_yourself_description">Show contributor info. Provide it to be shown here on an opt-in basis after contributing</string>

<string name="descending">descending</string>
Expand Down Expand Up @@ -274,7 +278,6 @@ work. If not, see <https://creativecommons.org/publicdomain/zero/1.0/>.
<string name="no_calendar_app_is_installed">No calendar app is installed!</string>
<string name="popular_documents">Popular documents</string>
<string name="color">Color</string>
<string name="zero_width_space">Zero-width space</string>
<string name="basic_color_scheme">Basic color scheme</string>
<string name="background_foreground_color_in_editor_works_dark_light">Changes background and foreground color of the text editor. Adjusts to app theme so available in light and dark theme. Syntax highlighting colors remain the same.</string>
<string name="preset">Preset</string>
Expand Down

0 comments on commit d4183ef

Please sign in to comment.