From 6078260659debf67f9cc0dfa363a8a3dec6a8c99 Mon Sep 17 00:00:00 2001 From: Ivan Boothe Date: Mon, 25 Oct 2021 19:46:27 -0700 Subject: [PATCH] Adding alt+enter action to copy HTML entity Signed-off-by: Ivan Boothe --- main.py | 7 ++++--- manifest.json | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 28dbb0c..1684813 100644 --- a/main.py +++ b/main.py @@ -86,15 +86,16 @@ class KeywordQueryEventListener(EventListener): image_path = get_character_icon(char) encoded = htmlentities.encode(char.character) if "&" in encoded: - entity = " - " + encoded + sep = " - " else: - entity = "" + sep = "" items.append( ExtensionResultItem( icon=image_path, name=char.name.capitalize() + " - " + char.character, - description=char.block + " - U+" + char.code + entity, + description=char.block + " - U+" + char.code + sep + encoded, on_enter=CopyToClipboardAction(char.character), + on_alt_enter=CopyToClipboardAction(encoded), ) ) return RenderResultListAction(items) diff --git a/manifest.json b/manifest.json index 717c36b..8527ee9 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "Symbol search", - "description": "Search symbols in ASCII and Unicode and copy them to the clipboard. Dark mode friendly.", + "description": "Search symbols in ASCII and Unicode. Enter to copy the symbol, alt+enter to copy the HTML entity. Dark mode friendly.", "developer_name": "Ivan Boothe", "icon": "images/insertion-symbol.png", "required_api_version": "^2.0.0", @@ -12,7 +12,7 @@ "id": "symbol", "type": "keyword", "name": "Symbol", - "description": "Search symbols in ASCII and Unicode and copy them to the clipboard. Dark mode friendly.", + "description": "Search symbols in ASCII and Unicode. Enter to copy the symbol, alt+enter to copy the HTML entity. Dark mode friendly.", "default_value": "sym" } ]