From 2af8d8fdaec76a8d6c5d9b33cad3f6c9f626605f Mon Sep 17 00:00:00 2001 From: Evan Reichard Date: Sun, 26 Jul 2026 21:01:26 -0400 Subject: [PATCH] fix(binarykeyboard): split candidates by on-screen position --- apps/BinaryKeyboard/main.lua | 13 ++++++++++--- apps/BinaryKeyboard/manifest.txt | 2 +- catalog.txt | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/BinaryKeyboard/main.lua b/apps/BinaryKeyboard/main.lua index 224c54c..d0673ef 100644 --- a/apps/BinaryKeyboard/main.lua +++ b/apps/BinaryKeyboard/main.lua @@ -6,10 +6,17 @@ local ROWS = { { "Z", "X", "C", "V", "B", "N", "M" } } +-- Spatial Rank - Halving must split the keyboard left/right on screen, so keys sort by their +-- centered column position, with the row index only breaking ties. local KEYS = {} -for _, row in ipairs(ROWS) do - for _, key in ipairs(row) do KEYS[#KEYS + 1] = key end +local keyRank = {} +for rowIndex, row in ipairs(ROWS) do + for columnIndex, key in ipairs(row) do + KEYS[#KEYS + 1] = key + keyRank[key] = (columnIndex - (#row + 1) / 2) * 10 + rowIndex + end end +table.sort(KEYS, function(a, b) return keyRank[a] < keyRank[b] end) local MAX_TEXT_BYTES = 80 local text = "" @@ -110,7 +117,7 @@ local function render() local visibleText = text == "" and "Type with the side buttons" or text:sub(-38) gui.drawText(FONT_UI_12, margin + 12, 96, visibleText, COLOR_BLACK, STYLE_NORMAL) - gui.drawCenteredText(FONT_UI_10, 170, "UP = plain DOWN = shaded", COLOR_BLACK, STYLE_NORMAL) + gui.drawCenteredText(FONT_UI_10, 170, "UP = plain left DOWN = shaded right", COLOR_BLACK, STYLE_NORMAL) drawKeyboard(width, 195, height - 90) gui.drawButtonHints(#history == 0 and "Exit" or "Undo", "Space", "Delete", uppercase and "lower" or "UPPER") diff --git a/apps/BinaryKeyboard/manifest.txt b/apps/BinaryKeyboard/manifest.txt index bd18ea6..7a74a1a 100644 --- a/apps/BinaryKeyboard/manifest.txt +++ b/apps/BinaryKeyboard/manifest.txt @@ -1,2 +1,2 @@ XTEINK-MANIFEST|1 -main.lua|4726|1a958ed089a1c3b6c8757298a94aed32fb2603732d83d3ed6c3ea98f31bd816a +main.lua|5085|59fddef1f3259f748e5b84e7c99f8bd2f02d7a0c18c4678872a92a1b0c4e8581 diff --git a/catalog.txt b/catalog.txt index 9ef08d1..e4619dc 100644 --- a/catalog.txt +++ b/catalog.txt @@ -1,5 +1,5 @@ XTEINK-CATALOG|1 AppStore|Install apps from public Xteink repositories|apps/AppStore/manifest.txt|192|2eb608b92de6bdeff4fc8ed447b9319f45c0d79d5d73b14db1ab5a92f91e42d4 -BinaryKeyboard|Two-button recursive keyboard experiment|apps/BinaryKeyboard/manifest.txt|97|8d26b7d2057f7ebdca133b936ea5d2074e8771af5235e9bf9722689a6fd8f5fd +BinaryKeyboard|Two-button recursive keyboard experiment|apps/BinaryKeyboard/manifest.txt|97|893867dba0ae2725caca1eb56375c98c4dd00d351134aa129698c51f97e25690 HomeAssistant|Home Assistant status cards|apps/HomeAssistant/manifest.txt|177|b38ca49804444fd383a505ce9c51680ad9b7443950d682ca1b9ef3047bff98a5 Wordle|Guess the five-letter word in six tries|apps/Wordle/manifest.txt|177|199fafdf0d0f6e77916befc011f6e8466c254867800e1d4a9e67e95a06d0366b