fix(desktop): collapse spreadsheet column tabs on paste#42573
Open
sanidhyasin wants to merge 1 commit into
Open
fix(desktop): collapse spreadsheet column tabs on paste#42573sanidhyasin wants to merge 1 commit into
sanidhyasin wants to merge 1 commit into
Conversation
Pasting multiple cells from Excel/Sheets into the composer dropped literal tab characters into the contenteditable, rendering as ragged column gaps. Route paste text through a new readPastedText helper that collapses tabs to spaces only when the clipboard also exposes an HTML <table> (the marker spreadsheet apps emit), so tab indentation in pasted code is left untouched. Closes NousResearch#42256
tonydwb
approved these changes
Jun 9, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Replaces the simplistic .trim() on pasted text with a new readPastedText() function that collapses spreadsheet column tabs (from Excel/Sheets) to spaces, but only when the paste is tabular (detected via HTML <table> presence). Tab indentation in code pastes is preserved.
- Well-scoped helper function with clear documentation
- Good test coverage (4 new test cases)
- No security concerns
Reviewed by Hermes Agent (cron batch)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pasting several cells from a spreadsheet (Excel / Google Sheets / Numbers) into the Desktop chat composer dumped literal tab characters into the
contentEditable, which rendered as ragged, uneven column gaps instead of readable text. Closes #42256.The composer's paste handler took the plain-text clipboard payload verbatim (only
.trim()-ed it). Spreadsheet apps put cell data on the plain-text clipboard as tab-separated columns, so a row likeFEERUM | 2026-06-05 | 17,95arrived asFEERUM\t2026-06-05\t17,95.Changes
apps/desktop/src/app/chat/composer/text-utils.ts— new purereadPastedText(clipboard)helper that trims edge whitespace (preserving internal newlines, as before) and collapses tab columns to single spaces only when the clipboard also exposes an HTML<table>— the marker spreadsheet apps emit. Gating on the table means tab indentation in pasted code is left completely untouched, avoiding a regression for the common "paste code into the agent" workflow.apps/desktop/src/app/chat/composer/index.tsx— route the paste handler throughreadPastedTextinstead of the inline.trim().apps/desktop/src/app/chat/composer/text-utils.test.ts— unit tests covering the spreadsheet paste, code-with-tabs (untouched), non-table HTML (untouched), and the existing trim behaviour.How to test
FEERUM | 2026-06-05 | 17,95.FEERUM 2026-06-05 17,95on a single clean line.Unit tests:
npm run test:ui(fromapps/desktop),text-utils.test.ts.Platforms
Logic is platform-independent (clipboard
text+text/html); verified via the new vitest cases. Behaviour matches Excel, Google Sheets, and Numbers, which all expose an HTML<table>alongside the tab-separated plain text.