fix(tui): fully paint cell areas and margins\n\n- Wrap HistoryCell Paragraphs in bg-styled Block to fill width\n- ExecCell: bg on pre/output blocks and borders\n- Gutter symbols + scrollbar track/thumb include bg\n\nEliminates rare right-margin artifacts and ensures consistent background under fast scroll.

This commit is contained in:
James Peter
2025-08-24 01:14:49 +10:00
parent ffd1120234
commit b6ee05005e
3 changed files with 55 additions and 13 deletions
+42 -9
View File
@@ -21,6 +21,28 @@ else
BIN_PATH="./target/${PROFILE}/code"
fi
# Optional deterministic mode: aim for more stable hashes by removing
# UUIDs on macOS, disabling debuginfo, and preferring a single-codegen
# optimized profile when user hasn't explicitly chosen a profile.
if [ "${DETERMINISTIC:-}" = "1" ]; then
echo "Deterministic build: enabled"
DET_FORCE_REL="${DETERMINISTIC_FORCE_RELEASE:-1}"
if [ "$PROFILE" = "dev-fast" ] && [ "$DET_FORCE_REL" = "1" ]; then
PROFILE="release-prod"
BIN_PATH="./target/${PROFILE}/code"
echo "Deterministic build: switching profile to ${PROFILE}"
elif [ "$PROFILE" = "dev-fast" ]; then
echo "Deterministic build: keeping profile ${PROFILE} (DETERMINISTIC_FORCE_RELEASE=0)"
fi
# Use SOURCE_DATE_EPOCH if available to stabilize timestamps
if command -v git >/dev/null 2>&1 && git -C "$REPO_ROOT" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
export SOURCE_DATE_EPOCH="$(git -C "$REPO_ROOT" log -1 --pretty=%ct 2>/dev/null || true)"
fi
# Disable debuginfo (safer to apply globally); avoid touching UUID here
# since some proc-macro dylibs require LC_UUID and will fail to load.
export RUSTFLAGS="${RUSTFLAGS:-} -C debuginfo=0"
fi
echo "Building code binary (${PROFILE} mode)..."
# Check Cargo.lock validity (fast, non-blocking check)
@@ -105,15 +127,6 @@ ${USE_CARGO} build ${USE_LOCKED} --profile "${PROFILE}" --bin code --bin code-tu
if [ $? -eq 0 ]; then
echo "✅ Build successful!"
echo "Binary location: ${BIN_PATH}"
# Compute absolute path and SHA256 for clarity
ABS_BIN_PATH="$(cd "$(dirname "${BIN_PATH}")" && pwd)/$(basename "${BIN_PATH}")"
if command -v shasum >/dev/null 2>&1; then
BIN_SHA="$(shasum -a 256 "${ABS_BIN_PATH}" | awk '{print $1}')"
elif command -v sha256sum >/dev/null 2>&1; then
BIN_SHA="$(sha256sum "${ABS_BIN_PATH}" | awk '{print $1}')"
else
BIN_SHA=""
fi
# Keep old symlink locations working for compatibility
# Create symlink in target/release for npm wrapper expectations
@@ -135,6 +148,26 @@ if [ $? -eq 0 ]; then
echo "✅ Symlinks updated"
echo ""
# Optional post-link step for deterministic builds: re-link executables
# with -no_uuid only on macOS. Apply per-bin via `cargo rustc` so
# dependencies/proc-macro dylibs are not affected.
if [ "${DETERMINISTIC:-}" = "1" ] && [ "$(uname -s)" = "Darwin" ]; then
echo "Deterministic post-link: removing LC_UUID from executables"
${USE_CARGO} rustc ${USE_LOCKED} --profile "${PROFILE}" --bin code -- -C link-arg=-Wl,-no_uuid 2>&1 || true
${USE_CARGO} rustc ${USE_LOCKED} --profile "${PROFILE}" --bin code-tui -- -C link-arg=-Wl,-no_uuid 2>&1 || true
${USE_CARGO} rustc ${USE_LOCKED} --profile "${PROFILE}" --bin code-exec -- -C link-arg=-Wl,-no_uuid 2>&1 || true
fi
# Compute absolute path and SHA256 for clarity (after any post-linking)
ABS_BIN_PATH="$(cd "$(dirname "${BIN_PATH}")" && pwd)/$(basename "${BIN_PATH}")"
if command -v shasum >/dev/null 2>&1; then
BIN_SHA="$(shasum -a 256 "${ABS_BIN_PATH}" | awk '{print $1}')"
elif command -v sha256sum >/dev/null 2>&1; then
BIN_SHA="$(sha256sum "${ABS_BIN_PATH}" | awk '{print $1}')"
else
BIN_SHA=""
fi
echo "You can run the CLI directly:"
if [ -n "$BIN_SHA" ]; then
echo " ${ABS_BIN_PATH} (sha256: ${BIN_SHA})"
+5 -3
View File
@@ -5708,7 +5708,9 @@ impl WidgetRef for &ChatWidget<'_> {
// Draw the symbol at the top of this cell only when the first line is visible
if skip_top == 0 && gutter_area.width >= 2 {
// Choose color based on symbol/type
let symbol_style = Style::default().fg(color);
let symbol_style = Style::default()
.fg(color)
.bg(crate::colors::background());
buf.set_string(gutter_area.x, gutter_area.y, symbol, symbol_style);
}
}
@@ -5774,9 +5776,9 @@ impl WidgetRef for &ChatWidget<'_> {
.begin_symbol(None)
.end_symbol(None)
.track_symbol(Some("│"))
.track_style(Style::default().fg(crate::colors::border()))
.track_style(Style::default().fg(crate::colors::border()).bg(crate::colors::background()))
.thumb_symbol("█")
.thumb_style(Style::default().fg(theme.border_focused));
.thumb_style(Style::default().fg(theme.border_focused).bg(crate::colors::background()));
// To avoid a small jump at the bottom due to spacer toggling,
// render the scrollbar in a slightly shorter area (reserve 1 row).
let sb_area = Rect {
+8 -1
View File
@@ -127,10 +127,14 @@ pub(crate) trait HistoryCell {
// Default path: render the full text and use Paragraph.scroll to skip
// vertical rows AFTER wrapping. Slicing lines before wrapping causes
// incorrect blank space when lines wrap across multiple rows.
// Ensure the entire allocated area is painted with the theme background
// by attaching a background-styled Block to the Paragraph.
let lines = self.display_lines_trimmed();
let text = Text::from(lines);
let bg_block = Block::default().style(Style::default().bg(crate::colors::background()));
Paragraph::new(text)
.block(bg_block)
.wrap(Wrap { trim: false })
.scroll((skip_rows, 0))
.style(Style::default().bg(crate::colors::background()))
@@ -379,7 +383,9 @@ impl HistoryCell for ExecCell {
// Render preamble (scrolled) if any space
if pre_height > 0 {
let pre_area = Rect { x: area.x, y: area.y, width: area.width, height: pre_height };
let pre_block = Block::default().style(Style::default().bg(crate::colors::background()));
Paragraph::new(pre_text)
.block(pre_block)
.wrap(Wrap { trim: false })
.scroll((pre_skip, 0))
.style(Style::default().bg(crate::colors::background()))
@@ -391,7 +397,8 @@ impl HistoryCell for ExecCell {
let out_area = Rect { x: area.x, y: area.y.saturating_add(pre_height), width: area.width, height: out_height };
let block = Block::default()
.borders(Borders::LEFT)
.border_style(Style::default().fg(crate::colors::border_dim()))
.border_style(Style::default().fg(crate::colors::border_dim()).bg(crate::colors::background()))
.style(Style::default().bg(crate::colors::background()))
.padding(Padding { left: 1, right: 0, top: 0, bottom: 0 });
Paragraph::new(out_text)
.block(block)