1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Bug 205765 - [terminal] some emacs keys do not work correctly Ctrl-/ and Backspace

Change-Id: Ib1af6d41ec0ea9512b289ee78ed9c93bc522d8ee
Signed-off-by: Anton Leherbauer <anton.leherbauer@windriver.com>
This commit is contained in:
Anton Leherbauer 2015-03-03 14:34:30 +01:00
parent bbc2062eeb
commit 6326319292
2 changed files with 40 additions and 20 deletions

View file

@ -152,7 +152,7 @@ public class VT100Emulator implements ControlListener {
ansiParameters[i] = new StringBuffer(); ansiParameters[i] = new StringBuffer();
} }
setInputStreamReader(reader); setInputStreamReader(reader);
if(TerminalPlugin.isOptionEnabled(Logger.TRACE_DEBUG_LOG_VT100BACKEND)) //$NON-NLS-1$ if(TerminalPlugin.isOptionEnabled(Logger.TRACE_DEBUG_LOG_VT100BACKEND))
text=new VT100BackendTraceDecorator(new VT100EmulatorBackend(data),System.out); text=new VT100BackendTraceDecorator(new VT100EmulatorBackend(data),System.out);
else else
text=new VT100EmulatorBackend(data); text=new VT100EmulatorBackend(data);
@ -450,6 +450,9 @@ public class VT100Emulator implements ControlListener {
text.eraseAll(); text.eraseAll();
text.setCursor(0, 0); text.setCursor(0, 0);
text.setStyle(text.getDefaultStyle()); text.setStyle(text.getDefaultStyle());
text.setScrollRegion(-1, -1);
text.setInsertMode(false);
terminal.enableApplicationCursorKeys(false);
} }
/** /**
* This method is called when we have parsed an OS Command escape sequence. * This method is called when we have parsed an OS Command escape sequence.
@ -1039,6 +1042,9 @@ public class VT100Emulator implements ControlListener {
terminal.enableApplicationCursorKeys(true); terminal.enableApplicationCursorKeys(true);
break; break;
case 47: case 47:
case 1047:
case 1048:
case 1049:
// Use Alternate Screen Buffer (ignored). // Use Alternate Screen Buffer (ignored).
break; break;
default: default:
@ -1055,6 +1061,9 @@ public class VT100Emulator implements ControlListener {
terminal.enableApplicationCursorKeys(false); terminal.enableApplicationCursorKeys(false);
break; break;
case 47: case 47:
case 1047:
case 1048:
case 1049:
// Use Normal Screen Buffer (ignored, but reset scroll region). // Use Normal Screen Buffer (ignored, but reset scroll region).
text.setScrollRegion(-1, -1); text.setScrollRegion(-1, -1);
break; break;

View file

@ -944,11 +944,15 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
} }
// Manage the Del key // Manage the Del key
if (event.keyCode == 0x000007f) if (event.keyCode == 0x000007f) {
{
sendString("\u001b[3~"); //$NON-NLS-1$ sendString("\u001b[3~"); //$NON-NLS-1$
return; return;
} }
if (event.keyCode == SWT.BS) {
sendChar('\u007f', altKeyPressed);
return;
}
// If the event character is NUL ('\u0000'), then a special key was pressed // If the event character is NUL ('\u0000'), then a special key was pressed
// (e.g., PageUp, PageDown, an arrow key, a function key, Shift, Alt, // (e.g., PageUp, PageDown, an arrow key, a function key, Shift, Alt,
@ -1032,62 +1036,62 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
case 0x100000a: // F1 key. case 0x100000a: // F1 key.
if (!anyModifierPressed) if (!anyModifierPressed)
escSeq = "\u001b[M"; //$NON-NLS-1$ escSeq = "\u001bOP"; //$NON-NLS-1$
break; break;
case 0x100000b: // F2 key. case 0x100000b: // F2 key.
if (!anyModifierPressed) if (!anyModifierPressed)
escSeq = "\u001b[N"; //$NON-NLS-1$ escSeq = "\u001bOQ"; //$NON-NLS-1$
break; break;
case 0x100000c: // F3 key. case 0x100000c: // F3 key.
if (!anyModifierPressed) if (!anyModifierPressed)
escSeq = "\u001b[O"; //$NON-NLS-1$ escSeq = "\u001bOR"; //$NON-NLS-1$
break; break;
case 0x100000d: // F4 key. case 0x100000d: // F4 key.
if (!anyModifierPressed) if (!anyModifierPressed)
escSeq = "\u001b[P"; //$NON-NLS-1$ escSeq = "\u001bOS"; //$NON-NLS-1$
break; break;
case 0x100000e: // F5 key. case 0x100000e: // F5 key.
if (!anyModifierPressed) if (!anyModifierPressed)
escSeq = "\u001b[Q"; //$NON-NLS-1$ escSeq = "\u001b[15~"; //$NON-NLS-1$
break; break;
case 0x100000f: // F6 key. case 0x100000f: // F6 key.
if (!anyModifierPressed) if (!anyModifierPressed)
escSeq = "\u001b[R"; //$NON-NLS-1$ escSeq = "\u001b[17~"; //$NON-NLS-1$
break; break;
case 0x1000010: // F7 key. case 0x1000010: // F7 key.
if (!anyModifierPressed) if (!anyModifierPressed)
escSeq = "\u001b[S"; //$NON-NLS-1$ escSeq = "\u001b[18~"; //$NON-NLS-1$
break; break;
case 0x1000011: // F8 key. case 0x1000011: // F8 key.
if (!anyModifierPressed) if (!anyModifierPressed)
escSeq = "\u001b[T"; //$NON-NLS-1$ escSeq = "\u001b[19~"; //$NON-NLS-1$
break; break;
case 0x1000012: // F9 key. case 0x1000012: // F9 key.
if (!anyModifierPressed) if (!anyModifierPressed)
escSeq = "\u001b[U"; //$NON-NLS-1$ escSeq = "\u001b[20~"; //$NON-NLS-1$
break; break;
case 0x1000013: // F10 key. case 0x1000013: // F10 key.
if (!anyModifierPressed) if (!anyModifierPressed)
escSeq = "\u001b[V"; //$NON-NLS-1$ escSeq = "\u001b[21~"; //$NON-NLS-1$
break; break;
case 0x1000014: // F11 key. case 0x1000014: // F11 key.
if (!anyModifierPressed) if (!anyModifierPressed)
escSeq = "\u001b[W"; //$NON-NLS-1$ escSeq = "\u001b[23~"; //$NON-NLS-1$
break; break;
case 0x1000015: // F12 key. case 0x1000015: // F12 key.
if (!anyModifierPressed) if (!anyModifierPressed)
escSeq = "\u001b[X"; //$NON-NLS-1$ escSeq = "\u001b[24~"; //$NON-NLS-1$
break; break;
default: default:
@ -1111,11 +1115,18 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
Logger.log("stateMask = " + event.stateMask); //$NON-NLS-1$ Logger.log("stateMask = " + event.stateMask); //$NON-NLS-1$
if (onlyCtrlKeyPressed && character == ' ') { if (onlyCtrlKeyPressed) {
// Send a NUL character -- many terminal emulators send NUL when switch (character) {
// Control-Space is pressed. This is used to set the mark in Emacs. case ' ':
// Send a NUL character -- many terminal emulators send NUL when
character = '\u0000'; // Control-Space is pressed. This is used to set the mark in Emacs.
character = '\u0000';
break;
case '/':
// Ctrl+/ is undo in emacs
character = '\u001f';
break;
}
} }
//TODO: At this point, Ctrl+M sends the same as Ctrl+Shift+M . //TODO: At this point, Ctrl+M sends the same as Ctrl+Shift+M .