You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
String result = connection.queryOsc(oscCode, "?", 500, responseParser);
258
272
```
259
273
274
+
#### Batch Color Queries
275
+
276
+
For better performance when querying multiple colors, use batch queries. This reduces latency from O(n × timeout) to O(timeout) by sending all queries at once:
Copy file name to clipboardExpand all lines: content/docs/readline/connection.md
+62-3Lines changed: 62 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,22 @@ connection.openNonBlocking();
35
35
36
36
Reads input in a separate thread, allowing the current thread to continue.
37
37
38
+
#### Checking Reading State
39
+
40
+
```java
41
+
// Check if connection is actively reading
42
+
if (connection.reading()) {
43
+
// Handler-based queries work (setStdinHandler)
44
+
} else {
45
+
// Use synchronous methods like queryColorCapability()
46
+
}
47
+
```
48
+
49
+
The `reading()` method returns `true` after `openBlocking()` or `openNonBlocking()` is called
50
+
and before `close()` is called. This is useful for determining which query methods to use:
51
+
- When `reading()` is true: Handler-based methods like `queryTerminal()` work
52
+
- When `reading()` is false: Use synchronous methods like `queryColorCapability()`
53
+
38
54
## Handlers
39
55
40
56
### Standard Input Handler
@@ -282,6 +298,39 @@ Known terminal limitations:
282
298
-**Linux console**:NoOSC query support
283
299
-**Alacritty**:NoOSC52 (clipboard) support
284
300
301
+
### BatchOSCQueries
302
+
303
+
For better performance when querying multiple colors, use batch queries. This sends all queries at once and collects responses together, reducing latency from O(n × timeout) to O(timeout):
304
+
305
+
```java
306
+
// Query foreground, background, and cursor colors in one operation
307
+
// Takes ~50-100ms instead of ~300-400ms for individual queries
0 commit comments