abouttreesummaryrefslogcommitdiff
path: root/srcs
diff options
context:
space:
mode:
Diffstat (limited to 'srcs')
-rw-r--r--srcs/juloo.keyboard2/KeyEventHandler.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/srcs/juloo.keyboard2/KeyEventHandler.java b/srcs/juloo.keyboard2/KeyEventHandler.java
index cde26e1..3c95f3d 100644
--- a/srcs/juloo.keyboard2/KeyEventHandler.java
+++ b/srcs/juloo.keyboard2/KeyEventHandler.java
@@ -234,9 +234,9 @@ public final class KeyEventHandler
{
switch (ev)
{
- case COPY: send_context_menu_action(android.R.id.copy); break;
+ case COPY: if(is_selection_not_empty()) send_context_menu_action(android.R.id.copy); break;
case PASTE: send_context_menu_action(android.R.id.paste); break;
- case CUT: send_context_menu_action(android.R.id.cut); break;
+ case CUT: if(is_selection_not_empty()) send_context_menu_action(android.R.id.cut); break;
case SELECT_ALL: send_context_menu_action(android.R.id.selectAll); break;
case SHARE: send_context_menu_action(android.R.id.shareText); break;
case PASTE_PLAIN: send_context_menu_action(android.R.id.pasteAsPlainText); break;
@@ -466,6 +466,13 @@ public final class KeyEventHandler
_recv.selection_state_changed(false);
}
+ boolean is_selection_not_empty()
+ {
+ InputConnection conn = _recv.getCurrentInputConnection();
+ if (conn == null) return false;
+ return (conn.getSelectedText(0) != null);
+ }
+
public static interface IReceiver
{
public void handle_event_key(KeyValue.Event ev);