Have you ever found yourself wishing for a bit more “modernity” while editing environment variables or command strings at the U-Boot prompt? Our latest patch series brings a suite of enhanced editing features to U-Boot, designed to make the command-line experience much more forgiving and efficient.
While these features improve the standard CLI, they were primarily designed to empower the expo framework, specifically for the new multi-line textedit widget.
Key Features at a Glance
This series introduces several “quality-of-life” improvements that seasoned terminal users will recognize:
- Multi-level Undo & Redo: Mistake? No problem. Use
Ctrl+Zto undo andCtrl+Shift+Zto redo. - Emacs-style Yank/Paste: Text deleted with “kill” commands (like
Ctrl+K) is saved to a yank buffer and can be pasted back withCtrl+Y. - Word Navigation: Move quickly through long strings using
Ctrl+LeftandCtrl+Rightarrows. - Enhanced Multi-line Support: For expo-based editors,
HomeandEndnow intelligently navigate within the current line, andCtrl+Kkills text to the end of the line rather than the entire buffer. - Sandbox SDL Support: We’ve added mapping for Home, End, and Ctrl+arrow keys in the sandbox console for easier testing and development.
Focus on Expo and Graphical Editing
The real star of this update is the integration with expo. We’ve added a new flag, SCENEOF_MULTILINE, which allows the textedit widget to handle multiple lines of text naturally—pressing Enter now inserts a newline rather than closing the widget.
To showcase this, we’ve updated the editenv command. You can now use the -e flag to trigger a graphical environment editor:
=> editenv -e my_long_variable
This opens a dedicated expo scene where you can use all the new undo/redo and navigation features in a clear, multi-line interface.
Configuration (Kconfig Options)
To enable these features in your build, you’ll need to look at these primary Kconfig options:
| Option | Description |
CONFIG_CMDLINE_EDITOR | The master switch for enhanced editing features. Enabled by default if EXPO is on. |
CONFIG_CMDLINE_UNDO | Enables the undo/redo and yank/paste buffers. |
CONFIG_CMDLINE_UNDO_COUNT | Configures the depth of the undo ring buffer (Default: 64). |
CONFIG_EXPO_EDITENV | Enables the underlying graphical editor logic. |
CONFIG_CMD_EDITENV_EXPO | Adds the -e flag to the editenv command to use the expo editor. |
Note on Memory: Each undo level stores a full copy of the edit buffer. While 64 levels is the default, you can tune
CONFIG_CMDLINE_UNDO_COUNTto fit the memory constraints of your specific board.
Technical Details
The implementation involves a new cli_editor_state structure that manages the redirection of character output and navigation callbacks. This allows the CLI logic to remain clean while supporting the specific needs of a graphical UI like expo. We’ve also addressed several memory leaks in expo object destruction and improved the video test infrastructure to help debug these graphical features more easily.


