fix: 修复消息区溢出布局问题,恢复Spacer弹性空白

- 消息区添加 .height(maxMessageLines) + .overflow(HIDDEN) 防止溢出
- 恢复 Spacer.create() 在消息少时填充空白
- AskUser工具添加调试日志帮助排查结构化回调

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
pull/1/head
abel533 1 month ago
parent 65bd5b5d9a
commit 7199b4f2dd
  1. 4
      src/main/java/com/claudecode/tool/impl/AskUserQuestionTool.java
  2. 4
      src/main/java/com/claudecode/tui/ClaudeCodeComponent.java

@ -86,6 +86,7 @@ public class AskUserQuestionTool implements Tool {
// 优先使用结构化回调(支持交互式选择) // 优先使用结构化回调(支持交互式选择)
Object structuredCb = context.get(ASK_USER_STRUCTURED_CALLBACK); Object structuredCb = context.get(ASK_USER_STRUCTURED_CALLBACK);
log.debug("Structured callback type: {}", structuredCb != null ? structuredCb.getClass().getName() : "null");
if (structuredCb instanceof java.util.function.BiFunction<?, ?, ?> biFn) { if (structuredCb instanceof java.util.function.BiFunction<?, ?, ?> biFn) {
try { try {
var askFn = (java.util.function.BiFunction<String, java.util.List<String>, String>) biFn; var askFn = (java.util.function.BiFunction<String, java.util.List<String>, String>) biFn;
@ -97,6 +98,9 @@ public class AskUserQuestionTool implements Tool {
} catch (Exception e) { } catch (Exception e) {
log.debug("Structured callback failed, falling back", e); log.debug("Structured callback failed, falling back", e);
} }
} else {
log.debug("Structured callback not a BiFunction, got: {}",
structuredCb != null ? structuredCb.getClass().getInterfaces()[0] : "null");
} }
// 回退到简单文本回调 // 回退到简单文本回调

@ -265,7 +265,9 @@ public class ClaudeCodeComponent extends Component<ClaudeCodeComponent.TuiState>
return Box.of(visibleItems.toArray(new Renderable[0])) return Box.of(visibleItems.toArray(new Renderable[0]))
.flexDirection(FlexDirection.COLUMN) .flexDirection(FlexDirection.COLUMN)
.paddingTop(1) .paddingTop(1)
.paddingX(1); .paddingX(1)
.height(Math.max(1, maxLines))
.overflow(io.mybatis.jink.style.Overflow.HIDDEN);
} }
/** 将 UIMessage 渲染为 Renderable 列表(一条消息可能产生多行) */ /** 将 UIMessage 渲染为 Renderable 列表(一条消息可能产生多行) */

Loading…
Cancel
Save