File tree 2 files changed +44
-1
lines changed
demo/src/main/java/org/jline/demo
terminal/src/main/java/org/jline/terminal/impl
2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2023, the original author or authors.
3
+ *
4
+ * This software is distributable under the BSD license. See the terms of the
5
+ * BSD license in the documentation provided with this software.
6
+ *
7
+ * https://opensource.org/licenses/BSD-3-Clause
8
+ */
9
+ package org .jline .demo ;
10
+
11
+ import org .jline .terminal .Terminal ;
12
+ import org .jline .terminal .TerminalBuilder ;
13
+
14
+ public class TerminalDemo {
15
+
16
+ public static void main (String [] args ) throws Exception {
17
+ try (Terminal terminal = TerminalBuilder .terminal () )
18
+ {
19
+ terminal .enterRawMode ();
20
+
21
+ terminal .writer ().println ("Terminal: " + terminal );
22
+ terminal .writer ().println ("Type characters, which will be echoed to the terminal. Q will also exit this example." );
23
+ terminal .writer ().println ();
24
+ terminal .writer ().flush ();
25
+
26
+ while (true ) {
27
+ int c = terminal .reader ().read (16 );
28
+ if (c >= 0 ) {
29
+ terminal .writer ().write (c );
30
+ terminal .writer ().flush ();
31
+
32
+ // Use "q" to quit early
33
+ if (c == 81 || c == 113 ) break ;
34
+ } else {
35
+ if (c == -1 ) break ; // Got EOF
36
+ }
37
+ }
38
+ }
39
+ }
40
+ }
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2002-2019 , the original author or authors.
2
+ * Copyright (c) 2002-2023 , the original author or authors.
3
3
*
4
4
* This software is distributable under the BSD license. See the terms of the
5
5
* BSD license in the documentation provided with this software.
@@ -170,6 +170,9 @@ public void setAttributes(Attributes attr) {
170
170
171
171
protected void updateConsoleMode () {
172
172
int mode = ENABLE_WINDOW_INPUT ;
173
+ if (attributes .getLocalFlag (Attributes .LocalFlag .ISIG )) {
174
+ mode |= ENABLE_PROCESSED_INPUT ;
175
+ }
173
176
if (attributes .getLocalFlag (Attributes .LocalFlag .ECHO )) {
174
177
mode |= ENABLE_ECHO_INPUT ;
175
178
}
You can’t perform that action at this time.
0 commit comments