*/
private long lastUpdateTime = 0;
+ /**
+ * If true, hide the mouse after typing a keystroke.
+ */
+ private boolean hideMouseWhenTyping = true;
+
+ /**
+ * If true, the mouse should not be displayed because a keystroke was
+ * typed.
+ */
+ private boolean typingHidMouse = false;
+
// ------------------------------------------------------------------------
// Constructors -----------------------------------------------------------
// ------------------------------------------------------------------------
this.closeOnExit = closeOnExit;
+ if (System.getProperty("jexer.TTerminal.shell") != null) {
+ String shell = System.getProperty("jexer.TTerminal.shell");
+ if (shell.trim().startsWith("ptypipe")) {
+ ptypipe = true;
+ }
+ spawnShell(shell.split("\\s+"));
+ return;
+ }
+
String cmdShellWindows = "cmd.exe";
// You cannot run a login shell in a bare Process interactively, due
*/
@Override
public void onKeypress(final TKeypressEvent keypress) {
+ if (hideMouseWhenTyping) {
+ typingHidMouse = true;
+ }
// Scrollback up/down
if (keypress.equals(kbShiftPgUp)
// UGLY HACK TIME! cmd.exe needs CRLF, not just CR, so if
// this is kBEnter then also send kbCtrlJ.
- if (System.getProperty("os.name").startsWith("Windows")) {
- if (keypress.equals(kbEnter)) {
+ if (keypress.equals(kbEnter)) {
+ if (System.getProperty("os.name").startsWith("Windows")
+ && (System.getProperty("jexer.TTerminal.cmdHack",
+ "true").equals("true"))
+ ) {
emulator.addUserEvent(new TKeypressEvent(kbCtrlJ));
}
}
return;
}
+ if (hideMouseWhenTyping) {
+ typingHidMouse = false;
+ }
+
// If the emulator is tracking mouse buttons, it needs to see wheel
// events.
if (emulator.getMouseProtocol() == ECMA48.MouseProtocol.OFF) {
return;
}
+ if (hideMouseWhenTyping) {
+ typingHidMouse = false;
+ }
+
if (mouseOnEmulator(mouse)) {
mouse.setX(mouse.getX() - 1);
mouse.setY(mouse.getY() - 1);
return;
}
+ if (hideMouseWhenTyping) {
+ typingHidMouse = false;
+ }
+
if (mouseOnEmulator(mouse)) {
mouse.setX(mouse.getX() - 1);
mouse.setY(mouse.getY() - 1);
// TTerminalWindow --------------------------------------------------------
// ------------------------------------------------------------------------
+ /**
+ * Returns true if this window does not want the application-wide mouse
+ * cursor drawn over it.
+ *
+ * @return true if this window does not want the application-wide mouse
+ * cursor drawn over it
+ */
+ @Override
+ public boolean hasHiddenMouse() {
+ return (super.hasHiddenMouse() || typingHidMouse);
+ }
+
/**
* Claim the keystrokes the emulator will need.
*/
// Pass the correct text cell width/height to the emulator
emulator.setTextWidth(getScreen().getTextWidth());
emulator.setTextHeight(getScreen().getTextHeight());
+
+ // Hide mouse when typing option
+ if (System.getProperty("jexer.TTerminal.hideMouseWhenTyping",
+ "true").equals("false")) {
+
+ hideMouseWhenTyping = false;
+ }
}
/**