Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update "help keys" output to include keycodes for ESC, F1-F12, and numpad keys #2299

Merged
merged 3 commits into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,4 @@ You can find iOS/tvOS version here
* David St-Hilaire - [GitHub @sthilaid](https://github.com/sthilaid)
* Alec Troemel - [Github @alectroemel](https://github.com/AlecTroemel)
* Kolten Pearson - [Github @koltenpearson](https://github.com/koltenpearson)
* Cort Stratton - [Github @cdwfs](https://github.com/cdwfs)
46 changes: 41 additions & 5 deletions src/studio/screens/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -3143,15 +3143,51 @@ static s32 createKeysTable(char* buf)
{63, "CTRL"},
{64, "SHIFT"},
{65, "ALT"},
{66, "ESC"},
{67, "F1"},
{68, "F2"},
{69, "F3"},
{70, "F4"},
{71, "F5"},
{72, "F6"},
{73, "F7"},
{74, "F8"},
{75, "F9"},
{76, "F10"},
{77, "F11"},
{78, "F12"},
{79, "NUM0"},
{80, "NUM1"},
{81, "NUM2"},
{82, "NUM3"},
{83, "NUM4"},
{84, "NUM5"},
{85, "NUM6"},
{86, "NUM7"},
{87, "NUM8"},
{88, "NUM9"},
{89, "NUMPLUS"},
{90, "NUMMINUS"},
{91, "NUMMULTIPLY"},
{92, "NUMDIVIDE"},
{93, "NUMENTER"},
{94, "NUMPERIOD"},
};

int lastAlphaNumeric = 36;
for(const struct Row* row = Rows, *end = row + lastAlphaNumeric; row < end; row++)
int numAlphaNumericRows = 36;
int numNonAlphaNumericRows = COUNT_OF(Rows) - numAlphaNumericRows;
int numRowPairs = MAX(numAlphaNumericRows, numNonAlphaNumericRows);
const struct Row* row = Rows;
for(int i=0; i<numRowPairs; i++,row++)
{
const struct Row* otherRow = row + lastAlphaNumeric;
ptr += sprintf(ptr, "\n| ");
ptr += sprintf(ptr, "%4d | %-3s |", row->code, row->key);
if (otherRow < Rows + COUNT_OF(Rows))
if (i < numAlphaNumericRows)
ptr += sprintf(ptr, "%4d | %-3s |", row->code, row->key);
else
ptr += sprintf(ptr, "%4s | %3s |", "", "");

const struct Row* otherRow = row + numAlphaNumericRows;
if (i < numNonAlphaNumericRows)
ptr += sprintf(ptr, " | %4d | %-12s |", otherRow->code, otherRow->key);
else
ptr += sprintf(ptr, " | %4s | %12s |", "", "");
Expand Down
Loading