Skip to content

Commit 73692e9

Browse files
committed
feat: Implement comprehensive JLine Curses TUI library with focus indicators and repaint system
This commit implements a complete Terminal User Interface (TUI) library for JLine with: ## 🎯 Core TUI Components - **Essential Components**: List, Table, Tree, Input, Label, Button, TextArea - **Layout Containers**: Box, Window, Panel for organizing components - **Interactive Demo**: Complete CursesDemo showcasing all functionality ## 🎨 Visual Focus System - **Focus Indicators**: Yellow borders and titles for focused components - **Theme Integration**: Consistent styling through DefaultTheme - **Visual Feedback**: Clear indication of which component has focus ## ⚡ Smart Repaint System - **Invalidation API**: Components automatically invalidate on state changes - **Efficient Updates**: Only invalid components are redrawn - **Focus-Aware**: Automatic invalidation on focus changes - **Performance**: Minimal screen updates for optimal performance ## ⌨️ Advanced Input Handling - **KeyEvent System**: Comprehensive key event processing - **Keyboard Navigation**: Arrow keys, Tab, Enter, Escape support - **Modifier Keys**: Ctrl, Alt, Shift detection and handling - **Shortcut System**: Configurable keyboard shortcuts ## 🧪 Quality Assurance - **Comprehensive Tests**: 368+ tests across all modules - **Virtual Screen Testing**: Mock screen for component testing - **Integration Tests**: End-to-end functionality verification - **Code Quality**: Spotless formatting and clean architecture ## 📦 Additional Features - **POSIX Commands**: Comprehensive POSIX command implementation - **Build System**: Clean Maven build with proper dependency management - **Documentation**: Updated module documentation and examples The implementation follows TUI best practices from libraries like Ratatui and Cursive, providing a modern, efficient, and user-friendly terminal interface experience.
1 parent 9411ffc commit 73692e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+11619
-2012
lines changed

build

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ function command_demo() {
6565
echo " repl - Run the REPL demo"
6666
echo " password - Run the password demo"
6767
echo " consoleui - Run the ConsoleUI demo"
68+
echo " curses - Run the interactive Curses demo"
6869
echo "Options:"
6970
echo " --help Show help message"
7071
echo " debug Enable remote debugging"
@@ -132,6 +133,13 @@ function command_demo() {
132133
fi
133134
MAIN_CLASS="org.jline.demo.consoleui.BasicDynamic"
134135
;;
136+
"curses")
137+
# Add curses jar
138+
if [ -d ${TARGETDIR}/lib ]; then
139+
cp=${cp}$(find ${TARGETDIR}/lib -name "jline-curses-*.jar" -exec printf :{} ';')
140+
fi
141+
MAIN_CLASS="org.jline.demo.CursesDemo"
142+
;;
135143
*)
136144
echo "Unknown demo type: $demo_type"
137145
exit 1
@@ -185,6 +193,26 @@ function command_demo() {
185193
echo ""
186194
echo "Note: On Windows, either Jansi or JNA library must be included in classpath."
187195
echo "To test with a dumb terminal, use: TERM=dumb $basename demo consoleui"
196+
elif [ "$demo_type" = "curses" ]; then
197+
echo "Usage: $basename demo curses [options]"
198+
echo "Options:"
199+
echo " --help Show this help message"
200+
echo " debug Enable remote debugging"
201+
echo " debugs Enable remote debugging with suspend"
202+
echo " jansi Add Jansi support (recommended for Windows)"
203+
echo " jna Add JNA support (alternative for Windows)"
204+
echo " verbose Enable verbose logging"
205+
echo " ffm Enable Foreign Function Memory (preview)"
206+
echo ""
207+
echo "Interactive demo showcasing Phase 2 curses enhancements:"
208+
echo " • Enhanced Input component with text selection and validation"
209+
echo " • Advanced List component with multiple selection"
210+
echo " • Rich TextArea component with multi-line editing"
211+
echo " • Dynamic Table component with sorting and filtering"
212+
echo " • Interactive Tree component with expandable nodes"
213+
echo ""
214+
echo "Note: This demo requires a real terminal to work properly."
215+
echo "To test with a dumb terminal, use: TERM=dumb $basename demo curses"
188216
else
189217
echo "Usage: $basename demo $demo_type [options]"
190218
echo "Options:"

build.bat

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ if "%demo_type%"=="" (
5858
echo repl - Run the REPL demo
5959
echo password - Run the password demo
6060
echo consoleui - Run the ConsoleUI demo
61+
echo curses - Run the interactive Curses demo
6162
echo Options:
6263
echo --help Show help message
6364
echo debug Enable remote debugging
@@ -135,6 +136,14 @@ if "%demo_type%"=="gogo" (
135136
)
136137
)
137138
set "MAIN_CLASS=org.jline.demo.consoleui.BasicDynamic"
139+
) else if "%demo_type%"=="curses" (
140+
:: Add curses jar
141+
if exist "%TARGETDIR%\lib" (
142+
for /f "tokens=*" %%i in ('dir /b /s "%TARGETDIR%\lib\jline-curses-*.jar"') do (
143+
set "cp=!cp!;%%i"
144+
)
145+
)
146+
set "MAIN_CLASS=org.jline.demo.CursesDemo"
138147
) else (
139148
echo Unknown demo type: %demo_type%
140149
exit /b 1
@@ -188,6 +197,26 @@ if "%~1"=="--help" (
188197
echo.
189198
echo Note: On Windows, either Jansi or JNA library must be included in classpath.
190199
echo To test with a dumb terminal, use: set TERM=dumb ^& %~n0 demo consoleui
200+
) else if "%demo_type%"=="curses" (
201+
echo Usage: %~n0 demo curses [options]
202+
echo Options:
203+
echo --help Show this help message
204+
echo debug Enable remote debugging
205+
echo debugs Enable remote debugging with suspend
206+
echo jansi Add Jansi support ^(recommended for Windows^)
207+
echo jna Add JNA support ^(alternative for Windows^)
208+
echo verbose Enable verbose logging
209+
echo ffm Enable Foreign Function Memory ^(preview^)
210+
echo.
211+
echo Interactive demo showcasing Phase 2 curses enhancements:
212+
echo • Enhanced Input component with text selection and validation
213+
echo • Advanced List component with multiple selection
214+
echo • Rich TextArea component with multi-line editing
215+
echo • Dynamic Table component with sorting and filtering
216+
echo • Interactive Tree component with expandable nodes
217+
echo.
218+
echo Note: This demo requires a real terminal to work properly.
219+
echo To test with a dumb terminal, use: set TERM=dumb ^& %~n0 demo curses
191220
) else (
192221
echo Usage: %~n0 demo %demo_type% [options]
193222
echo Options:

0 commit comments

Comments
 (0)