Skip to content

feat(chat): add compact-mode with sticky header and sticky user messages - #20

Open
Blankeos wants to merge 6 commits into
mainfrom
feat/sticky-message-headers
Open

feat(chat): add compact-mode with sticky header and sticky user messages#20
Blankeos wants to merge 6 commits into
mainfrom
feat/sticky-message-headers

Conversation

@Blankeos

@Blankeos Blankeos commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Add /compact-mode command support to toggle compact layout while preserving chat-only behavior. Implement sticky session-title header and last fully-scrolled user message in compact mode with click-to-scroll, plus faded viewport copy handling and adjusted hit-testing to keep interaction and rendering stable.

image

I wanted to kinda copy Grok. It looked convenient.. It's toggleable by /compact-mode (also similar to Grok Build)

@cursor

cursor Bot commented Aug 8, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 8, 2026

Copy link
Copy Markdown

Deploying crabcode with  Cloudflare Pages  Cloudflare Pages

Latest commit: d6bb183
Status: ✅  Deploy successful!
Preview URL: https://3ae0f572.crabcode.pages.dev
Branch Preview URL: https://feat-sticky-message-headers.crabcode.pages.dev

View logs

@Blankeos
Blankeos force-pushed the feat/sticky-message-headers branch 2 times, most recently from aca9074 to 767d637 Compare August 8, 2026 18:21
@Blankeos

Blankeos commented Aug 8, 2026

Copy link
Copy Markdown
Owner Author

PR Review: feat/sticky-message-headersmain

Merge confidence: 4/5


Summary

Implements compact mode — a view toggle (/compact-mode or via app handler) that collapses the chat to show a narrow 3-row area with sticky user message headers above the latest assistant reply. Clicking a sticky user message bar scrolls directly to that message with hysteresis. Extends the scroll target region to include the sticky bar + header rows so wheel events work over that chrome. Adds the /compact-mode slash command.


Diff overview

File +/− What changed
src/views/chat.rs ~+270 Compact-mode layout: split area into 3 chunks (prior messages / sticky bar / latest reply), sticky‑click target tracking, hysteresis logic for sticky index, compact→normal state teardown
src/app.rs ~+60 chat_scroll_region fn to include sticky bar in scroll area, mouse click handler for sticky bar, /compact-mode intercept to toggle chat_state.compact_mode
src/command/handlers.rs +16 New /compact-mode command registration
src/ui/components/chat.rs +1 scroll_to_message_index (possibly pre-existing unused until now)

Issues found

⚠️ 1. Registry test not updated — will fail CI

src/command/handlers.rs:1392 asserts names.len() == 19, but the new compact-mode command makes it 20. The test also doesn't verify the new command at all.

Fix: bump to 20 and add assertions for compact-mode (name + is_chat_only).


Regressions

None. The compact mode is opt-in (defaults off) and adds no branching to the normal render path beyond the early if self.chat_state.compact_mode check at src/views/chat.rs:78. All existing tests pass except the pre-existing question_dialog oserror failures.

Test suite Result
cargo build ✅ clean
cargo fmt --check ✅ clean
cargo test views::chat ✅ all pass
cargo test app::tests ✅ all pass
cargo test ui::components::chat ✅ all pass
cargo test command::handlers ❌ 1 fail (test not updated — see #1)

Migration / checklists

No DB schema or data migrations needed. No config format changes.

Pre-merge checklist

  • Fix test_registry_has_all_commands: bump expected count to 20, add compact-mode to the assertions list
  • Run just fmt after the fix
  • (Nice to have) Add a dedicated unit/integration test for compact mode toggle and sticky message rendering

Add `/compact-mode` command support to toggle compact layout while preserving chat-only behavior. Implement sticky session-title header and last fully-scrolled user message in compact mode with click-to-scroll, plus faded viewport copy handling and adjusted hit-testing to keep interaction and rendering stable.
…atting

- add helper to render user message content with shared line-wrapping and image-placeholder styling - update compact sticky preview to use the shared formatter so it visually matches real user messages (including truncation behavior and colors)
@Blankeos
Blankeos force-pushed the feat/sticky-message-headers branch from 767d637 to d6bb183 Compare August 8, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant