Claus Ibsen created CAMEL-23512:
-----------------------------------

             Summary: camel-jbang-plugin-tui: TamboUI API misuse, Unicode bugs, 
and improvements
                 Key: CAMEL-23512
                 URL: https://issues.apache.org/jira/browse/CAMEL-23512
             Project: Camel
          Issue Type: Improvement
          Components: camel-jbang
            Reporter: Claus Ibsen


The camel-jbang-plugin-tui module has several issues related to TamboUI API 
usage identified through code review.

h3. Bugs

# {{CamelCatalogTui}} uses the deprecated {{KeyEvent.character()}} API (lines 
380, 382) which cannot handle supplementary Unicode code points. Should use 
{{ke.string()}} instead.
# {{TuiHelper.truncate()}} uses {{String.length()}} and {{String.substring()}} 
for display truncation instead of TamboUI's {{CharWidth}} utilities. This 
causes incorrect display with CJK characters and emoji. Should use 
{{CharWidth.truncateWithEllipsis()}}.
# {{CamelCatalogTui.wrapText()}} and {{flowFields()}} use {{String.length()}} 
for width calculations — same CharWidth violation.
# {{CamelMonitor.styleDiagramLine()}} uses {{line.length()}} for horizontal 
scroll width calculation instead of {{CharWidth.of()}}.
# {{CamelMonitor.renderProcessors()}} and {{renderRouteHeader()}} create a 
{{new TableState()}} on every render frame, preventing any selection state from 
persisting in those tables.
# {{CamelMonitor}} handles {{MouseEvent}} for diagram scrolling but creates 
{{TuiRunner}} with default config which has {{mouseCapture=false}}, so mouse 
events never arrive.

h3. Improvements

* Manual word wrapping in {{CamelCatalogTui}} could use TamboUI's built-in 
{{Paragraph}} with {{Overflow.WRAP_WORD}} instead of the custom {{wrapText()}} 
method.
* Manual description scrolling could use Paragraph's built-in {{scroll()}} 
method instead of manually slicing the lines list.
* Raw {{KeyCode}} checks could use TamboUI's semantic bindings 
({{ke.isPageUp()}}, {{ke.matches(Actions.*)}}) to respect user-configured key 
bindings (vim, emacs).
* {{refreshData()}} and {{pollJsonResponse()}} perform blocking I/O on the 
render thread, which can freeze the UI. Should use the scheduler for background 
work with {{runOnRenderThread()}} callback.
* Separator line manually drawn with box-drawing character repetition could use 
{{Block}} with {{Borders.TOP_ONLY}}.
* Footer rendering has approximately 100 lines of duplicated patterns that 
could be simplified with a helper method.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to