Skip to content

Commit

Permalink
Don't elide label of non-string keys
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Julow committed Aug 7, 2023
1 parent eeae964 commit 21316b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion srcs/juloo.keyboard2/Keyboard2View.java
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,11 @@ private void drawSubLabel(Canvas canvas, KeyValue kv, float x, float y,
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,
Expand Down

0 comments on commit 21316b7

Please sign in to comment.