mirror of
https://github.com/eclipse-cdt/cdt
synced 2024-10-28 03:59:40 +01:00
Convert \b to 0x7f to properly handle backspace in the terminal (#619)
Includes a new system property `org.eclipse.tm.terminal.control.convertBackspace` to allow us to disable this new behaviour in the field if it turns out that some terminal/host combination does not like this conversion. Fixes #392
This commit is contained in:
parent
f5754e2723
commit
9ba721566d
2 changed files with 26 additions and 0 deletions
|
@ -26,6 +26,14 @@ The managed build GNU linker tool description now provides an option for groupin
|
||||||
|
|
||||||
The new option is available within managed build configurations using a _Cross GCC_, _Cygwin GCC_, _Linux GCC_ or _MinGW GCC_ toolchain.
|
The new option is available within managed build configurations using a _Cross GCC_, _Cygwin GCC_, _Linux GCC_ or _MinGW GCC_ toolchain.
|
||||||
|
|
||||||
|
# Terminal
|
||||||
|
|
||||||
|
## Backspace now sends `0x7f` instead of `0x08` (`\b`, `^H`)
|
||||||
|
|
||||||
|
Introduced to [fix an incompatibility on Windows](https://github.com/eclipse-cdt/cdt/issues/392) the terminal converts `^H` to ascii `0x7f` to ensure a single character is deleted rather than a whole word.
|
||||||
|
|
||||||
|
The java property `org.eclipse.tm.terminal.control.convertBackspace` can be set to `false` to disable this behavior in case it interferes with the expected behavior of the terminal.
|
||||||
|
|
||||||
# API Changes, current and planned
|
# API Changes, current and planned
|
||||||
|
|
||||||
## Changes to org.eclipse.tools.templates APIs
|
## Changes to org.eclipse.tools.templates APIs
|
||||||
|
|
|
@ -184,6 +184,19 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
|
||||||
|
|
||||||
private PollingTextCanvasModel fPollingTextCanvasModel;
|
private PollingTextCanvasModel fPollingTextCanvasModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In some circumstances (e.g PowerShell on Windows) the backspace
|
||||||
|
* character received from the keypress needs modifying. This
|
||||||
|
* system property allows disabling this new feature in case there
|
||||||
|
* are users who are negatively affected by this conversion.
|
||||||
|
*
|
||||||
|
* \b is ^H which is interpreted by the console as Ctrl + Backspace
|
||||||
|
* which deletes a word. \b on its own should just delete a character
|
||||||
|
* so we send 0x7f to do that.
|
||||||
|
*/
|
||||||
|
private boolean convertBackspace = Boolean
|
||||||
|
.parseBoolean(System.getProperty("org.eclipse.tm.terminal.control.convertBackspace", "true")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiate a Terminal widget.
|
* Instantiate a Terminal widget.
|
||||||
* @param target Callback for notifying the owner of Terminal state changes.
|
* @param target Callback for notifying the owner of Terminal state changes.
|
||||||
|
@ -1175,6 +1188,11 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// see javadoc on convertBackspace for details
|
||||||
|
if (convertBackspace && !ctrlKeyPressed && character == '\b') {
|
||||||
|
character = 0x7f;
|
||||||
|
}
|
||||||
|
|
||||||
//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 .
|
||||||
//This is undesired. Fixing this here might make the special Ctrl+Shift+C
|
//This is undesired. Fixing this here might make the special Ctrl+Shift+C
|
||||||
//handling unnecessary further up.
|
//handling unnecessary further up.
|
||||||
|
|
Loading…
Reference in a new issue