Add/Remove Inline File References in UI #165
Labels
No labels
Epic 5
MCP
P1
PR-0
PR-1
api
api-layer
architecture
area:backend
area:frontend
arrow
authentication
backend
bug
chat
client
clipboard
common-module
compose
cross-cutting
cross-cutting-requirement
data-layer
data-models
database
desktop-client
documentation
duplicate
enhancement
epic
epic-1
epic-2
epic-3
epic-4
epic-5
epic-6
epic-7
epic-llm-config
error-handling
feature
frontend
good first issue
help wanted
implementation
infrastructure
installer
invalid
kotlin
ktor
llm
medium-priority
message
multiplatform
needs-review
needs-triage
packaging
performance
phase-1
phase-2
phase-3
phase-4
phase-5
phase3
phase:3
priority: high
question
refactor
refactoring
resource-sharing
security
server
server-module
services
session
session-management
settings
setup
shutdown
state
storage
streaming
sub-issue
tests
tooling
type:task
ui
ui/ux
user-accounts
user-management
ux
viewmodel
websocket
windows
windows-integration
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Torvian.eu/chatbot#165
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
Implement interactive inline file attachment in the chat input field, allowing users to insert file references at specific cursor positions using the
#key and display them as colored text links within the message.User Story
As a user, I want to insert file references inline within my message text using the
#key, so that files are embedded at specific positions in my message rather than just appended at the end.Implementation Plan
Steps
Migrate
InputAreafromStringtoTextFieldValueinInputArea.kt,ChatState, andUpdateInputUseCaseto track cursor position and selection; update all call sites inChatViewModeland UI components.Create
FileReferenceVisualTransformationclass implementingVisualTransformationwithOffsetMappingto inject colored text links like[file.txt]atinlinePositionindices, making them skip-over zones for cursor navigation while keeping the actual text unchanged.Implement automatic position synchronization in
UpdateInputUseCase.execute()to detect text insertions/deletions and shift allinlinePositionvalues that come after the change point, maintaining correct inline reference placement as user types.Add
#key handler toInputArea.onKeyEventto intercept Shift+3, capturetextFieldValue.selection.start, show a file selection dialog listing currently attached non-inline files, and update selectedFileReferencewith capturedinlinePosition.Add Backspace handler to detect when cursor is immediately after an inline reference (check if any file has
inlinePosition == cursorPosition - 1), and if found, clear itsinlinePositionto convert it back to non-inline instead of deleting text.Make inline text clickable by implementing click detection through
OffsetMappinginverse lookup to determine which file reference was clicked, then invokeonFileReferenceClickcallback to show details dialog.Design Decisions
[file.txt](usingSpanStylewithcolor = primaryColor)[file.txt]is included when copying (natural TextField behavior)inlinePosition,inlinePosition+1, etc.#key inserts one file at a time (simpler implementation)Related Issues
Technical Notes
inlinePositionviabuildContentWithFileReferencesOffsetMappingto handle cursor positioning around inline references