mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-29 01:31:41 +00:00
fix: clean newline paste thingy
This commit is contained in:
parent
eec1db36f7
commit
0642b6cc53
3 changed files with 33 additions and 7 deletions
18
ui-tui/src/lib/text.test.ts
Normal file
18
ui-tui/src/lib/text.test.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { stripTrailingPasteNewlines } from './text.js'
|
||||
|
||||
describe('stripTrailingPasteNewlines', () => {
|
||||
it('removes trailing newline runs from pasted text', () => {
|
||||
expect(stripTrailingPasteNewlines('alpha\n')).toBe('alpha')
|
||||
expect(stripTrailingPasteNewlines('alpha\nbeta\n\n')).toBe('alpha\nbeta')
|
||||
})
|
||||
|
||||
it('preserves interior newlines', () => {
|
||||
expect(stripTrailingPasteNewlines('alpha\nbeta\ngamma')).toBe('alpha\nbeta\ngamma')
|
||||
})
|
||||
|
||||
it('preserves newline-only pastes', () => {
|
||||
expect(stripTrailingPasteNewlines('\n\n')).toBe('\n\n')
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue