@@ -2,6 +2,7 @@ package editor
22
33import (
44 "fmt"
5+ "math/rand"
56 "net/http"
67 "os"
78 "os/exec"
@@ -48,14 +49,16 @@ type FileCompletionItem struct {
4849}
4950
5051type editorCmp struct {
51− width int
52− height int
53− x, y int
54− app *app.App
55− session session.Session
56− textarea textarea.Model
57− attachments []message.Attachment
58− deleteMode bool
52+ width int
53+ height int
54+ x, y int
55+ app *app.App
56+ session session.Session
57+ textarea textarea.Model
58+ attachments []message.Attachment
59+ deleteMode bool
60+ readyPlaceholder string
61+ workingPlaceholder string
5962
6063 keyMap EditorKeyMap
6164
@@ -157,6 +160,10 @@ func (m *editorCmp) send() tea.Cmd {
157160 if value == "" {
158161 return nil
159162 }
163+
164+ // Change the placeholder when sending a new message.
165+ m.randomizePlaceholders()
166+
160167 return tea.Batch(
161168 util.CmdHandler(chat.SendMsg{
162169 Text: value,
@@ -379,8 +386,31 @@ func (m *editorCmp) Cursor() *tea.Cursor {
379386 return cursor
380387}
381388
389+var readyPlaceholders = [...]string{
390+ "Ready!",
391+ "Ready...",
392+ "Ready?",
393+}
394+
395+var workingPlaceholders = [...]string{
396+ "Working!",
397+ "Working...",
398+ "Working?",
399+}
400+
401+func (m *editorCmp) randomizePlaceholders() {
402+ m.workingPlaceholder = workingPlaceholders[rand.Intn(len(workingPlaceholders))]
403+ m.readyPlaceholder = readyPlaceholders[rand.Intn(len(readyPlaceholders))]
404+}
405+
382406func (m *editorCmp) View() string {
383407 t := styles.CurrentTheme()
408+ // Update placeholder
409+ if m.app.CoderAgent.IsBusy() {
410+ m.textarea.Placeholder = m.workingPlaceholder
411+ } else {
412+ m.textarea.Placeholder = m.readyPlaceholder
413+ }
384414 if len(m.attachments) == 0 {
385415 content := t.S().Base.Padding(1).Render(
386416 m.textarea.View(),
@@ -510,14 +540,18 @@ func New(app *app.App) Editor {
510540 })
511541 ta.ShowLineNumbers = false
512542 ta.CharLimit = -1
513− ta.Placeholder = "Tell me more about this project..."
514543 ta.SetVirtualCursor(false)
515544 ta.Focus()
516545
517− return &editorCmp{
546+ e := &editorCmp{
518547 // TODO: remove the app instance from here
519548 app: app,
520549 textarea: ta,
521550 keyMap: DefaultEditorKeyMap(),
522551 }
552+
553+ e.randomizePlaceholders()
554+ e.textarea.Placeholder = e.readyPlaceholder
555+
556+ return e
523557}