[PR #237] [MERGED] feat: add /goto slash command to jump to a message by number #4523

Closed
opened 2026-10-22 04:08:23 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/237
Author: @LukaTheHero
Created: 4/25/2026
Status: ✅ Merged
Merged: 4/25/2026
Merged by: @LukaTheHero

Base: main ← Head: feat/goto-message-command


📝 Commits (1)

  • 8256fcd feat: add /goto slash command to jump to a message by number

📊 Changes

3 files changed (+90 additions, -0 deletions)

View changed files

📝 packages/client/src/components/chat/ChatArea.tsx (+58 -0)
📝 packages/client/src/lib/slash-commands.ts (+16 -0)
📝 packages/client/src/stores/chat.store.ts (+16 -0)

📄 Description

Summary

  • Adds /goto N (aliases /jump, /scroll) — scrolls the chat to message #N using the same 1-based numbering already exposed by the existing "Show message numbers" setting.
  • If the target message lives in an older paginated page, the handler auto-fetches older pages one at a time (mirroring the existing "load more" path) until the message is in the DOM, then smooth-scrolls to it (block: "center").
  • Out-of-range numbers show a sonner toast (Message #N doesn't exist — this chat has X messages.); bad input (non-integer, ≤ 0) returns the usage hint via the normal slash-command feedback bubble.

Why

Long chats are a pain to navigate — scrolling back hundreds of messages to revisit a specific moment is tedious and breaks flow. /goto 27 jumps you straight there, including across paginated history.

Implementation

  • stores/chat.store.ts — new gotoRequest state + requestGotoMessage / clearGotoRequest actions. A token field forces re-fire when the same number is requested twice.
  • lib/slash-commands.ts — new local /goto command; validates input and dispatches via the store so the command stays decoupled from React.
  • components/chat/ChatArea.tsx — effect fulfils the request: paginate older pages until the target index is in the loaded window, then scrollIntoView via data-message-id. Sets userScrolledAwayRef so the streaming auto-scroll-to-bottom doesn't immediately yank the user back.

Test plan

  • /goto 27 in a chat with the target already loaded → scrolls smoothly to message #27, centered.
  • /goto 27 in a long chat where #27 is on an older page → auto-fetches older pages then scrolls.
  • /goto 9999 (out of range) → toast: Message #9999 doesn't exist — this chat has X messages.
  • /goto abc, /goto 0, /goto -3, /goto → usage hint shown in feedback bubble.
  • Works in both Conversation and Roleplay surfaces.
  • pnpm check (TypeScript + ESLint + build) is clean.

Summary by CodeRabbit

  • New Features
    • Added /goto slash command for message navigation. Users can jump to specific messages by entering /goto <message_number>. The feature includes input validation, error feedback, and automatic pagination for older messages.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/237 **Author:** [@LukaTheHero](https://github.com/LukaTheHero) **Created:** 4/25/2026 **Status:** ✅ Merged **Merged:** 4/25/2026 **Merged by:** [@LukaTheHero](https://github.com/LukaTheHero) **Base:** `main` ← **Head:** `feat/goto-message-command` --- ### 📝 Commits (1) - [`8256fcd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8256fcdea3a14651699805583a5bc85be73a52c1) feat: add /goto slash command to jump to a message by number ### 📊 Changes **3 files changed** (+90 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatArea.tsx` (+58 -0) 📝 `packages/client/src/lib/slash-commands.ts` (+16 -0) 📝 `packages/client/src/stores/chat.store.ts` (+16 -0) </details> ### 📄 Description ## Summary - Adds `/goto N` (aliases `/jump`, `/scroll`) — scrolls the chat to message #N using the same 1-based numbering already exposed by the existing "Show message numbers" setting. - If the target message lives in an older paginated page, the handler auto-fetches older pages one at a time (mirroring the existing "load more" path) until the message is in the DOM, then smooth-scrolls to it (`block: "center"`). - Out-of-range numbers show a sonner toast (`Message #N doesn't exist — this chat has X messages.`); bad input (non-integer, ≤ 0) returns the usage hint via the normal slash-command feedback bubble. ## Why Long chats are a pain to navigate — scrolling back hundreds of messages to revisit a specific moment is tedious and breaks flow. `/goto 27` jumps you straight there, including across paginated history. ## Implementation - `stores/chat.store.ts` — new `gotoRequest` state + `requestGotoMessage` / `clearGotoRequest` actions. A `token` field forces re-fire when the same number is requested twice. - `lib/slash-commands.ts` — new local `/goto` command; validates input and dispatches via the store so the command stays decoupled from React. - `components/chat/ChatArea.tsx` — effect fulfils the request: paginate older pages until the target index is in the loaded window, then `scrollIntoView` via `data-message-id`. Sets `userScrolledAwayRef` so the streaming auto-scroll-to-bottom doesn't immediately yank the user back. ## Test plan - [x] `/goto 27` in a chat with the target already loaded → scrolls smoothly to message #27, centered. - [x] `/goto 27` in a long chat where #27 is on an older page → auto-fetches older pages then scrolls. - [x] `/goto 9999` (out of range) → toast: `Message #9999 doesn't exist — this chat has X messages.` - [x] `/goto abc`, `/goto 0`, `/goto -3`, `/goto` → usage hint shown in feedback bubble. - [x] Works in both Conversation and Roleplay surfaces. - [x] `pnpm check` (TypeScript + ESLint + build) is clean. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added `/goto` slash command for message navigation. Users can jump to specific messages by entering `/goto <message_number>`. The feature includes input validation, error feedback, and automatic pagination for older messages. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:08:23 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4523
No description provided.