Skip to content

Commit 6c47a73

Browse files
jrollinclaude
andcommitted
refactor: Replace superscript key with Escape key in keyboard layout
Remove the superscript 2/3 (²/³) key from AZERTY number row and replace with visual Escape key label [E] in keyboard display. Number row now has 12 keys starting with '&' instead of 13 keys. - Remove Key '²'/'³' from number row data model (azerty.rs) - Add [E] escape key label at start of number row display (keyboard.rs) - Update tests to expect 12 keys and remove superscript assertions - Update keyboard-layout documentation with new visual layout 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent a0501b5 commit 6c47a73

File tree

4 files changed

+18
-19
lines changed

4 files changed

+18
-19
lines changed

docs/features/keyboard-layout/design.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ The visual keyboard display renders the full AZERTY layout with real-time next-k
426426
**Complete AZERTY visual layout:**
427427

428428
```
429-
│ [²] [1] [2] [3] [4] [5] [6] [7] [8] [9] [0] [°] [=] │
429+
│ [E] [&] [é] ["] ['] [(] [-] [è] [_] [ç] [à] [)] [=] │
430430
│ [Tab] [a] [z] [e] [r] [t] [y] [u] [i] [o] [p] [^] [$] │
431431
│ [Caps] [q] [s] [d] [f] [g] [h] [j] [k] [l] [m] [ù] [*] [←] │
432432
│ [ ⇧ ] [<] [w] [x] [c] [v] [b] [n] [,] [;] [:] [!] [ ⇧ ] │
@@ -588,7 +588,7 @@ if key.base == '\n' {
588588
```rust
589589
#[derive(Debug, Clone, Copy, PartialEq)]
590590
pub enum RowType {
591-
Number, // ²1234567890°=
591+
Number, // &é"'(-è_çà)=
592592
Top, // azertyuiop^$
593593
Home, // qsdfghjklmù*
594594
Bottom, // <wxcvbn,;:!

docs/features/keyboard-layout/tasks.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
## Phase 3: Visual Keyboard Display ✓
4949

5050
### AZERTY Visual Layout (src/ui/keyboard.rs)
51-
- [x] Number row display ([²] [1] [2] [3]... base characters)
51+
- [x] Number row display ([E] [&] [é] ["] [']... with Escape key prefix)
5252
- [x] Top row with Tab key box ([Tab] [a] [z] [e]...)
5353
- [x] Home row with Caps Lock key box ([Caps] [q] [s] [d]...)
5454
- [x] Enter key as arrow ([]) on home row right end
@@ -61,8 +61,8 @@
6161

6262
### Layout Data Model (src/keyboard/azerty.rs)
6363
- [x] Extended RowType enum with Modifier variant
64-
- [x] Complete number row (14 keys including ²)
65-
- [x] Shift variant mappings (² → ³, letters, symbols)
64+
- [x] Complete number row (12 keys, starting with &)
65+
- [x] Shift variant mappings (letters, symbols, numbers)
6666
- [x] Base key lookup (handles shift variants)
6767
- [x] Modifier row definition
6868
- [x] Unit tests (91 tests passing)

src/keyboard/azerty.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ impl AzertyLayout {
134134
KeyboardRow {
135135
row_type: RowType::Number,
136136
keys: vec![
137-
Key::new('²', Some('³'), Finger::LeftPinky), // Superscript 2/3 (first key)
138137
Key::new('&', Some('1'), Finger::LeftPinky),
139138
Key::new('é', Some('2'), Finger::LeftPinky),
140139
Key::new('"', Some('3'), Finger::LeftRing),
@@ -358,16 +357,16 @@ mod tests {
358357
#[test]
359358
fn test_number_row_has_13_keys() {
360359
let layout = AzertyLayout::new();
361-
assert_eq!(layout.rows[0].keys.len(), 13);
362-
// First key should be ²
363-
assert_eq!(layout.rows[0].keys[0].base, '²');
364-
assert_eq!(layout.rows[0].keys[0].shift_variant, Some('³'));
365-
// 12th key (index 11) - French AZERTY: ) is base, ° is shift
366-
assert_eq!(layout.rows[0].keys[11].base, ')');
367-
assert_eq!(layout.rows[0].keys[11].shift_variant, Some('°'));
360+
assert_eq!(layout.rows[0].keys.len(), 12);
361+
// First key should be &
362+
assert_eq!(layout.rows[0].keys[0].base, '&');
363+
assert_eq!(layout.rows[0].keys[0].shift_variant, Some('1'));
364+
// 11th key (index 10) - French AZERTY: ) is base, ° is shift
365+
assert_eq!(layout.rows[0].keys[10].base, ')');
366+
assert_eq!(layout.rows[0].keys[10].shift_variant, Some('°'));
368367
// Last key should be =
369-
assert_eq!(layout.rows[0].keys[12].base, '=');
370-
assert_eq!(layout.rows[0].keys[12].shift_variant, Some('+'));
368+
assert_eq!(layout.rows[0].keys[11].base, '=');
369+
assert_eq!(layout.rows[0].keys[11].shift_variant, Some('+'));
371370
}
372371

373372
#[test]
@@ -382,7 +381,6 @@ mod tests {
382381
#[test]
383382
fn test_shift_mapping_numbers() {
384383
let layout = AzertyLayout::new();
385-
assert_eq!(layout.shift_mappings.get(&'²'), Some(&'³'));
386384
assert_eq!(layout.shift_mappings.get(&'1'), Some(&'&'));
387385
assert_eq!(layout.shift_mappings.get(&'5'), Some(&'('));
388386
assert_eq!(layout.shift_mappings.get(&'0'), Some(&'à'));
@@ -402,13 +400,11 @@ mod tests {
402400
fn test_get_base_key() {
403401
let layout = AzertyLayout::new();
404402
// Base characters (French AZERTY: symbols are base, numbers are shift)
405-
assert_eq!(layout.get_base_key('²'), Some('²'));
406403
assert_eq!(layout.get_base_key('a'), Some('a'));
407404
assert_eq!(layout.get_base_key('q'), Some('q'));
408405
assert_eq!(layout.get_base_key('&'), Some('&')); // Base character
409406
assert_eq!(layout.get_base_key('é'), Some('é')); // Base character
410407
// Shift variants (numbers require shift on French AZERTY)
411-
assert_eq!(layout.get_base_key('³'), Some('²'));
412408
assert_eq!(layout.get_base_key('A'), Some('a'));
413409
assert_eq!(layout.get_base_key('Q'), Some('q'));
414410
assert_eq!(layout.get_base_key('1'), Some('&')); // 1 is shift of &

src/ui/keyboard.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,11 @@ fn render_keyboard_row<'a>(
147147
// Add center padding
148148
spans.push(Span::raw(" ")); // 14 spaces
149149

150-
// Add modifier key box at start of row (Tab, Caps, Shift)
150+
// Add modifier key box at start of row (E, Tab, Caps, Shift)
151151
match row.row_type {
152+
RowType::Number => {
153+
spans.push(Span::styled("[E] ", Style::default().fg(Color::DarkGray)));
154+
}
152155
RowType::Top => {
153156
spans.push(Span::styled("[Tab] ", Style::default().fg(Color::DarkGray)));
154157
}

0 commit comments

Comments
 (0)