Skip to content

Commit aa003f8

Browse files
committed
notes on M.command
1 parent 00be3c4 commit aa003f8

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

lua/opencode.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ function M.send(text, opts)
5555
terminal.send(text, opts or {})
5656
end
5757

58-
-- TODO: How to press "enter" after?
59-
-- I don't understand why it works fine with `ask`
6058
function M.command(command, opts)
6159
terminal.command(command, opts or {})
6260
end

lua/opencode/terminal.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ end
6464
---Send a command to the terminal
6565
---@param command string opencode command (e.g. "/new")
6666
---@param opts? opencode.Config Optional config that will override the base config for this call only
67+
-- FIX: How to press "enter" after?
68+
-- I don't understand why it works fine with `ask`.
69+
-- That uses multi-line, which ends with \r.
70+
-- But single line uses \n.
71+
-- I tried sending commands with multi-line but it just sends the actual text - doesn't select the command.
72+
-- Maybe we need to send the text, wait a moment for the menu to appear, and then send the enter key?
6773
function M.command(command, opts)
6874
M.send(command, opts, false)
6975
end

0 commit comments

Comments
 (0)