davsclaus commented on code in PR #24328:
URL: https://github.com/apache/camel/pull/24328#discussion_r3497341309


##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ShellPanel.java:
##########
@@ -616,14 +653,37 @@ static byte[] encodeKeyEvent(KeyEvent ke) {
         };
     }
 
+    // TODO: ScreenTerminal.history is private with no public accessor in 
JLine 4.2.1.
+    //       File a JLine issue to add getHistory()/getHistorySize() public 
methods,
+    //       then replace this reflection with direct calls.
+    //       See: https://github.com/jline/jline3/issues/1266
+    private static final Field HISTORY_FIELD;
+    private static final AtomicBoolean HISTORY_WARN_LOGGED = new 
AtomicBoolean(false);
+
+    static {
+        Field f = null;
+        try {
+            f = ScreenTerminal.class.getDeclaredField("history");
+            f.setAccessible(true);
+        } catch (NoSuchFieldException e) {
+            System.err.println("[ShellPanel] ScreenTerminal.history field not 
found — "
+                               + "scrollback will be unavailable. JLine API 
may have changed.");
+        }
+        HISTORY_FIELD = f;

Review Comment:
   Also this reflection will be fixed if jline makes a release with a public 
api for this, right ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to