A fork of https://github.com/crosspoint-reader/crosspoint-reader
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: Change keyboard "caps" to "shift" & Wrap Keyboard (#377)

## Summary

* This PR solves issue
https://github.com/crosspoint-reader/crosspoint-reader/issues/357 in the
first commit
* I then added an additional commit which means when you reach the end
of the keyboard, if you go 'beyond', you wrap back to the other side.
* This replaces existing behaviour, so if you would rather this be
removed, let me know and I'll just do the `caps` -> `shift` change

## Additional Context

### Screenshots for the new shift display

I thought it might not fit and need column size changes, but ended up
fitting fine, see screenshots showing this below:

<img width="573" height="366" alt="image"
src="https://github.com/user-attachments/assets/b8f6a4ec-94f5-4f5e-b9a6-06cc5f250ddb"
/>

<img width="570" height="308" alt="image"
src="https://github.com/user-attachments/assets/7d775518-4784-4120-a20a-a9dc67af8565"
/>


### Gif showing the wrap-around of the text



![IMG_7648](https://github.com/user-attachments/assets/7eec9066-e1cc-49a1-8b6b-a61556038d31)

---

### AI Usage

Did you use AI tools to help write this code? **PARTIALLY** - used to
double check the text wrapping had no edge-cases. (It did also suggest
rewriting the function, but I decided that was too big of a change for a
working part of the codebase, for now!)

authored by

Nathan James and committed by
GitHub
7185e5d2 12940cc5

+26 -14
+26 -14
src/activities/util/KeyboardEntryActivity.cpp
··· 73 73 case 3: 74 74 return 10; // zxcvbnm,./ 75 75 case 4: 76 - return 10; // caps (2 wide), space (5 wide), backspace (2 wide), OK 76 + return 10; // shift (2 wide), space (5 wide), backspace (2 wide), OK 77 77 default: 78 78 return 0; 79 79 } ··· 145 145 // Clamp column to valid range for new row 146 146 const int maxCol = getRowLength(selectedRow) - 1; 147 147 if (selectedCol > maxCol) selectedCol = maxCol; 148 + } else { 149 + // Wrap to bottom row 150 + selectedRow = NUM_ROWS - 1; 151 + const int maxCol = getRowLength(selectedRow) - 1; 152 + if (selectedCol > maxCol) selectedCol = maxCol; 148 153 } 149 154 updateRequired = true; 150 155 } ··· 154 159 selectedRow++; 155 160 const int maxCol = getRowLength(selectedRow) - 1; 156 161 if (selectedCol > maxCol) selectedCol = maxCol; 162 + } else { 163 + // Wrap to top row 164 + selectedRow = 0; 165 + const int maxCol = getRowLength(selectedRow) - 1; 166 + if (selectedCol > maxCol) selectedCol = maxCol; 157 167 } 158 168 updateRequired = true; 159 169 } 160 170 161 171 if (mappedInput.wasPressed(MappedInputManager::Button::Left)) { 172 + const int maxCol = getRowLength(selectedRow) - 1; 173 + 162 174 // Special bottom row case 163 175 if (selectedRow == SPECIAL_ROW) { 164 176 // Bottom row has special key widths 165 177 if (selectedCol >= SHIFT_COL && selectedCol < SPACE_COL) { 166 - // In shift key, do nothing 178 + // In shift key, wrap to end of row 179 + selectedCol = maxCol; 167 180 } else if (selectedCol >= SPACE_COL && selectedCol < BACKSPACE_COL) { 168 181 // In space bar, move to shift 169 182 selectedCol = SHIFT_COL; ··· 180 193 181 194 if (selectedCol > 0) { 182 195 selectedCol--; 183 - } else if (selectedRow > 0) { 184 - // Wrap to previous row 185 - selectedRow--; 186 - selectedCol = getRowLength(selectedRow) - 1; 196 + } else { 197 + // Wrap to end of current row 198 + selectedCol = maxCol; 187 199 } 188 200 updateRequired = true; 189 201 } ··· 204 216 // In backspace, move to done 205 217 selectedCol = DONE_COL; 206 218 } else if (selectedCol >= DONE_COL) { 207 - // At done button, do nothing 219 + // At done button, wrap to beginning of row 220 + selectedCol = SHIFT_COL; 208 221 } 209 222 updateRequired = true; 210 223 return; ··· 212 225 213 226 if (selectedCol < maxCol) { 214 227 selectedCol++; 215 - } else if (selectedRow < NUM_ROWS - 1) { 216 - // Wrap to next row 217 - selectedRow++; 228 + } else { 229 + // Wrap to beginning of current row 218 230 selectedCol = 0; 219 231 } 220 232 updateRequired = true; ··· 288 300 289 301 // Handle bottom row (row 4) specially with proper multi-column keys 290 302 if (row == 4) { 291 - // Bottom row layout: CAPS (2 cols) | SPACE (5 cols) | <- (2 cols) | OK (2 cols) 303 + // Bottom row layout: SHIFT (2 cols) | SPACE (5 cols) | <- (2 cols) | OK (2 cols) 292 304 // Total: 11 visual columns, but we use logical positions for selection 293 305 294 306 int currentX = startX; 295 307 296 - // CAPS key (logical col 0, spans 2 key widths) 297 - const bool capsSelected = (selectedRow == 4 && selectedCol >= SHIFT_COL && selectedCol < SPACE_COL); 298 - renderItemWithSelector(currentX + 2, rowY, shiftActive ? "CAPS" : "caps", capsSelected); 308 + // SHIFT key (logical col 0, spans 2 key widths) 309 + const bool shiftSelected = (selectedRow == 4 && selectedCol >= SHIFT_COL && selectedCol < SPACE_COL); 310 + renderItemWithSelector(currentX + 2, rowY, shiftActive ? "SHIFT" : "shift", shiftSelected); 299 311 currentX += 2 * (keyWidth + keySpacing); 300 312 301 313 // Space bar (logical cols 2-6, spans 5 key widths)