Files
lazygit/pkg/integration/components/search_driver.go
Stefan HallerandClaude Opus 5.5 9765b96790 Let the search prompt receive pasted text in one piece
Treat pasted text like in the other views that take a single line of
text. Before, a pasted newline confirmed the search, and the rest of
the pasted text was lost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 10:22:50 +01:00

47 lines
889 B
Go

package components
// TODO: soft-code this
const ClearKey = "<ctrl+u>"
type SearchDriver struct {
t *TestDriver
}
func (self *SearchDriver) getViewDriver() *ViewDriver {
return self.t.Views().Search()
}
// asserts on the text initially present in the prompt
func (self *SearchDriver) InitialText(expected *TextMatcher) *SearchDriver {
self.getViewDriver().Content(expected)
return self
}
func (self *SearchDriver) Type(value string) *SearchDriver {
self.t.typeContent(value)
return self
}
// pastes the text the way a terminal does it
func (self *SearchDriver) Paste(text string) *SearchDriver {
self.t.paste(text)
return self
}
func (self *SearchDriver) Clear() *SearchDriver {
self.t.press(ClearKey)
return self
}
func (self *SearchDriver) Confirm() {
self.getViewDriver().PressEnter()
}
func (self *SearchDriver) Cancel() {
self.getViewDriver().PressEscape()
}