@@ -220,6 +220,7 @@ public class PreferencesDialog extends Dialog {
220220 boolean oldTerminalLineInput ;
221221 boolean oldTerminalLocalEcho ;
222222 String oldConsoleFont ;
223+ int oldTerminalCursor ;
223224
224225 static int lastPage ;
225226
@@ -562,6 +563,7 @@ public void widgetSelected(SelectionEvent e) {
562563 oldTerminalLineInput = preferences .getTerminalLineInput ();
563564 oldTerminalLocalEcho = preferences .getTerminalLocalEcho ();
564565 oldConsoleFont = preferences .getConsoleFont ();
566+ oldTerminalCursor = preferences .getTerminalCursor ();
565567
566568 return composite ;
567569 }
@@ -1514,9 +1516,71 @@ public void widgetSelected(SelectionEvent e) {
15141516 terminalFont .setText (fontData .getName ());
15151517 terminalFontSize .setSelection (fontData .getHeight ());
15161518
1517- new Label (composite , SWT .NONE );
1519+ label = new Label (composite , SWT .NONE );
1520+ label .setText ("Cursor" );
15181521
15191522 Composite group = new Composite (composite , SWT .NONE );
1523+ layout = new GridLayout (2 , false );
1524+ layout .marginHeight = layout .marginWidth = 0 ;
1525+ group .setLayout (layout );
1526+ group .setLayoutData (new GridData (SWT .BEGINNING , SWT .CENTER , false , false ));
1527+
1528+ int cursorState = preferences .getTerminalCursor ();
1529+
1530+ Combo combo = new Combo (group , SWT .DROP_DOWN );
1531+ combo .setItems ("None" , "Underline" , "Block" );
1532+ if ((cursorState & Preferences .CURSOR_ON ) == 0 ) {
1533+ combo .select (0 );
1534+ }
1535+ else if ((cursorState & Preferences .CURSOR_ULINE ) != 0 ) {
1536+ combo .select (1 );
1537+ }
1538+ else {
1539+ combo .select (2 );
1540+ }
1541+ combo .addSelectionListener (new SelectionAdapter () {
1542+
1543+ @ Override
1544+ public void widgetSelected (SelectionEvent e ) {
1545+ int cursorState = preferences .getTerminalCursor () & Preferences .CURSOR_FLASH ;
1546+ int selection = ((Combo ) e .widget ).getSelectionIndex ();
1547+ if (selection == 0 ) {
1548+ cursorState |= Preferences .CURSOR_OFF ;
1549+ }
1550+ else if (selection == 1 ) {
1551+ cursorState |= Preferences .CURSOR_ON | Preferences .CURSOR_ULINE ;
1552+ }
1553+ else if (selection == 2 ) {
1554+ cursorState |= Preferences .CURSOR_ON | Preferences .CURSOR_BLOCK ;
1555+ }
1556+ preferences .setTerminalCursor (cursorState );
1557+ }
1558+
1559+ });
1560+
1561+ Button blinkCursor = new Button (group , SWT .CHECK );
1562+ blinkCursor .setText ("Blinking" );
1563+ blinkCursor .setSelection (preferences .getTerminalLocalEcho ());
1564+ blinkCursor .addSelectionListener (new SelectionAdapter () {
1565+
1566+ @ Override
1567+ public void widgetSelected (SelectionEvent e ) {
1568+ int cursorState = preferences .getTerminalCursor ();
1569+ if (((Button ) e .widget ).getSelection ()) {
1570+ cursorState |= Preferences .CURSOR_FLASH ;
1571+ }
1572+ else {
1573+ cursorState &= ~Preferences .CURSOR_FLASH ;
1574+ }
1575+ preferences .setTerminalCursor (cursorState );
1576+ }
1577+
1578+ });
1579+ blinkCursor .setSelection ((cursorState & Preferences .CURSOR_FLASH ) != 0 );
1580+
1581+ new Label (composite , SWT .NONE );
1582+
1583+ group = new Composite (composite , SWT .NONE );
15201584 layout = new GridLayout (1 , false );
15211585 layout .marginHeight = layout .marginWidth = 0 ;
15221586 group .setLayout (layout );
@@ -2268,6 +2332,7 @@ protected void cancelPressed() {
22682332 preferences .setTerminalFont (oldTerminalFont );
22692333 preferences .setTerminalLineInput (oldTerminalLineInput );
22702334 preferences .setTerminalLocalEcho (oldTerminalLocalEcho );
2335+ preferences .setTerminalCursor (oldTerminalCursor );
22712336
22722337 preferences .setConsoleFont (oldConsoleFont );
22732338
0 commit comments