abouttreesummaryrefslogcommitdiff
path: root/srcs
diff options
context:
space:
mode:
authorJules Aguillon2023-08-07 13:11:21 +0200
committerJules Aguillon2023-08-07 13:11:21 +0200
commit21316b77d71b2cab75e9db41b883411d43308472 (patch)
tree5838914d1f745318a78efcfc5bcc4c621126f646 /srcs
parenteeae964ae618125e2f12f5133faa41dca6e6b2e6 (diff)
downloadunexpected-keyboard-21316b77d71b2cab75e9db41b883411d43308472.tar.gz
unexpected-keyboard-21316b77d71b2cab75e9db41b883411d43308472.zip
Don't elide label of non-string keys
Several non-string keys can have a large label that shouldn't be elided, for example ctrl, meta, send. Also, change the cutoff to 3 characters as labels are easily colliding.
Diffstat (limited to 'srcs')
-rw-r--r--srcs/juloo.keyboard2/Keyboard2View.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java
index 1dfaa16..3f4a895 100644
--- a/srcs/juloo.keyboard2/Keyboard2View.java
+++ b/srcs/juloo.keyboard2/Keyboard2View.java
@@ -408,7 +408,11 @@ public class Keyboard2View extends View
else
x += (a == Paint.Align.LEFT) ? subPadding : keyW - subPadding;
String label = kv.getString();
- canvas.drawText(label, 0, Math.min(4, label.length()), x, y, p);
+ int label_len = label.length();
+ // Limit the label of string keys to 3 characters
+ if (label_len > 3 && kv.getKind() == KeyValue.Kind.String)
+ label_len = 3;
+ canvas.drawText(label, 0, label_len, x, y, p);
}
private void drawIndication(Canvas canvas, String indication, float x,