|
| 1 | +# CNL Editor Test - Keyboard Shortcuts and Autocompletion |
| 2 | + |
| 3 | +This file demonstrates the improved CNL Editor functionality with proper keyboard shortcuts and controlled autocompletion. |
| 4 | + |
| 5 | +## Testing Context-Aware Section Button |
| 6 | + |
| 7 | +### Universal Section Control (All Devices) |
| 8 | +- **First click** on `# Heading` button: Inserts single `#` at cursor position |
| 9 | +- **Subsequent clicks** on `# Heading` button: Shows level controls dropdown |
| 10 | +- **Button shows current level**: `# Heading (2)` when on a `##` line |
| 11 | +- **Works on any line**: Not just at the beginning |
| 12 | + |
| 13 | +### Section Level Controls Dropdown |
| 14 | +- **`-` button**: Decrease section level by 1 |
| 15 | +- **`+` button**: Increase section level by 1 |
| 16 | +- **`×` button**: Remove section markup completely |
| 17 | +- **Level indicator**: Shows current level (e.g., "Level 3") |
| 18 | +- **Auto-hide**: Closes when clicking outside or after action |
| 19 | + |
| 20 | +### Tab for Normal Indentation |
| 21 | +- **Tab** works as expected for normal text indentation |
| 22 | +- **Shift+Tab** for outdenting (standard editor behavior) |
| 23 | +- **No conflicts** with existing editor shortcuts |
| 24 | + |
| 25 | +## Testing Enter Key Behavior |
| 26 | + |
| 27 | +### Normal Enter Behavior |
| 28 | +- Press Enter at the end of a line to create a new line |
| 29 | +- The new line should maintain the same indentation as the current line |
| 30 | +- No unwanted autocompletion should be inserted |
| 31 | + |
| 32 | +### Enter with Autocompletion |
| 33 | +- Press Ctrl+Space to trigger autocompletion |
| 34 | +- Press Enter to select a completion |
| 35 | +- Press Escape to cancel autocompletion |
| 36 | + |
| 37 | +## Testing Autocompletion |
| 38 | + |
| 39 | +### Controlled Autocompletion |
| 40 | +- Autocompletion should NOT appear automatically as you type |
| 41 | +- Press Ctrl+Space to manually trigger autocompletion |
| 42 | +- Autocompletion should only show when you've typed at least 2 characters |
| 43 | +- Autocompletion should not trigger when typing at the end of a line |
| 44 | + |
| 45 | +### CNL-Specific Completions |
| 46 | +- Type '#' and press Ctrl+Space for node heading completions |
| 47 | +- Type '<' and press Ctrl+Space for relation completions |
| 48 | +- Type 'has' and press Ctrl+Space for attribute completions |
| 49 | + |
| 50 | +## Example CNL Structure |
| 51 | + |
| 52 | +Try creating this structure using the Tab shortcuts: |
| 53 | + |
| 54 | +# [Domain] Eukarya |
| 55 | +## [Kingdom] Animalia |
| 56 | +### [Phylum] Chordata |
| 57 | +#### [Class] Mammalia |
| 58 | +##### [Order] Primates |
| 59 | +###### [Family] Hominidae |
| 60 | +####### [Genus] Homo |
| 61 | +######## [Species] sapiens |
| 62 | + |
| 63 | +### [Phylum] Reptilia |
| 64 | +#### [Class] Archosauria |
| 65 | +##### [Order] aves |
| 66 | +###### [Family] aves |
| 67 | +####### Canis lupus [Example] |
| 68 | + |
| 69 | +## [Kingdom] Plantae |
| 70 | +### [Phylum] Phytotaxa |
| 71 | +#### [Class] Magnifera |
| 72 | +##### [Order] Proteaceae |
| 73 | +###### [Family] Proteaceae |
| 74 | +####### Utricularia [Example] |
| 75 | + |
| 76 | +### Instructions: |
| 77 | +1. Start with a blank line |
| 78 | +2. Click **`# Heading`** button to get `# ` |
| 79 | +3. Type `[Domain] Eukarya` |
| 80 | +4. Press Enter, then click **`# Heading`** button to get `## ` |
| 81 | +5. Type `[Kingdom] Animalia` |
| 82 | +6. Press Enter, then click **`# Heading`** button to get `### ` |
| 83 | +7. Type `[Phylum] Chordata` |
| 84 | +8. Click **`# Heading`** button again to see level controls, then use `+`/`-` buttons |
| 85 | + |
| 86 | +## Testing Instructions |
| 87 | + |
| 88 | +1. Open this file in the CNL Editor |
| 89 | +2. Test each keyboard shortcut mentioned above |
| 90 | +3. Verify that autocompletion behaves as described |
| 91 | +4. Verify that Enter key works correctly without unwanted insertions |
| 92 | +5. Test the Tab shortcuts for creating hierarchical structures like the example above |
0 commit comments