Skip to content

Commit

Permalink
Improved nano and ttop commands when using on Windows terminal, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Dec 9, 2019
1 parent 238f020 commit 10840f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion builtins/src/main/java/org/jline/builtins/Nano.java
Original file line number Diff line number Diff line change
Expand Up @@ -2353,7 +2353,9 @@ public void run() throws IOException {
if (mouseSupport) {
terminal.trackMouse(Terminal.MouseTracking.Off);
}
terminal.puts(Capability.exit_ca_mode);
if (!terminal.puts(Capability.exit_ca_mode)) {
terminal.puts(Capability.clear_screen);
}
terminal.puts(Capability.keypad_local);
terminal.flush();
terminal.setAttributes(attributes);
Expand Down
8 changes: 6 additions & 2 deletions builtins/src/main/java/org/jline/builtins/TTop.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ public void run() throws IOException, InterruptedException {
try {

// Use alternate buffer
terminal.puts(InfoCmp.Capability.enter_ca_mode);
if (!terminal.puts(InfoCmp.Capability.enter_ca_mode)) {
terminal.puts(InfoCmp.Capability.clear_screen);
}
terminal.puts(InfoCmp.Capability.keypad_xmit);
terminal.puts(InfoCmp.Capability.cursor_invisible);
terminal.writer().flush();
Expand Down Expand Up @@ -233,7 +235,9 @@ public void run() throws IOException, InterruptedException {
terminal.handle(Terminal.Signal.WINCH, prevHandler);
}
// Use main buffer
terminal.puts(InfoCmp.Capability.exit_ca_mode);
if (!terminal.puts(InfoCmp.Capability.exit_ca_mode)) {
terminal.puts(InfoCmp.Capability.clear_screen);
}
terminal.puts(InfoCmp.Capability.keypad_local);
terminal.puts(InfoCmp.Capability.cursor_visible);
terminal.writer().flush();
Expand Down

0 comments on commit 10840f8

Please sign in to comment.