abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/LayoutModifier.java
diff options
context:
space:
mode:
authorJules Aguillon2025-12-18 19:15:32 +0100
committerGitHub2025-12-18 19:15:32 +0100
commit41777fdda61715a59be241f0be9a8e3385222888 (patch)
treebcddb5a4a29af2caf37e1f565efcfbffdd6814be /srcs/juloo.keyboard2/LayoutModifier.java
parentbe0aa07a2a728509b6244e00247bfe2fff5c66e0 (diff)
downloadunexpected-keyboard-41777fdda61715a59be241f0be9a8e3385222888.tar.gz
unexpected-keyboard-41777fdda61715a59be241f0be9a8e3385222888.zip
Disable selection mode in text editors (#1141)
* Disable selection mode in text editors Selection mode removes the space bar key (which is replaced by the Esc key) and can be annoying in Emacs for example. Text editor users probably have the `esc` key available. * Refactor: Move EditorInfo related code to EditorConfig Add the new EditorConfig class that handles configuration extracted from the EditorInfo. It is accessible from the Config class for convenience. This aims at reducing the length of already large classes and group the code that was spread over several classes.
Diffstat (limited to 'srcs/juloo.keyboard2/LayoutModifier.java')
-rw-r--r--srcs/juloo.keyboard2/LayoutModifier.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/srcs/juloo.keyboard2/LayoutModifier.java b/srcs/juloo.keyboard2/LayoutModifier.java
index 22f15ec..fa7be0c 100644
--- a/srcs/juloo.keyboard2/LayoutModifier.java
+++ b/srcs/juloo.keyboard2/LayoutModifier.java
@@ -149,6 +149,7 @@ public final class LayoutModifier
*/
static KeyValue modify_key(KeyValue orig)
{
+ EditorConfig ec = globalConfig.editor_config;
switch (orig.getKind())
{
case Event:
@@ -159,11 +160,12 @@ public final class LayoutModifier
return KeyValue.getKeyByName("change_method_prev");
break;
case ACTION:
- if (globalConfig.actionLabel == null)
+ String action_label = ec.actionLabel;
+ if (action_label == null)
return null; // Remove the action key
- if (globalConfig.swapEnterActionKey)
+ if (ec.swapEnterActionKey)
return KeyValue.getKeyByName("enter");
- return KeyValue.makeActionKey(globalConfig.actionLabel);
+ return KeyValue.makeActionKey(action_label);
case SWITCH_FORWARD:
return (globalConfig.layouts.size() > 1) ? orig : null;
case SWITCH_BACKWARD:
@@ -177,8 +179,8 @@ public final class LayoutModifier
switch (orig.getKeyevent())
{
case KeyEvent.KEYCODE_ENTER:
- if (globalConfig.swapEnterActionKey && globalConfig.actionLabel != null)
- return KeyValue.makeActionKey(globalConfig.actionLabel);
+ if (ec.swapEnterActionKey && ec.actionLabel != null)
+ return KeyValue.makeActionKey(ec.actionLabel);
break;
}
break;