micro-editor / micro-editor/micro
Trying to replace pane buff
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 29.6k
- Forks
- 1.4k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 10
Description
Hi,
Im writing a plugin that first outputs into a vsplit and I want to replace that buffer with the string I receive from my job:
newFname = fname.sub(fname, 1, -1* (string.len(ext) +1 )) .. ".diff." .. ext
local buf = buffer.NewBuffer("Running query, please wait. Might take up to 1-2 minutes", newFname)
local newPb = buffer.NewVSplitFromBuffer(buf, bp) -- added it to initlua
shell.JobSpawn(cmd, {pwd .. "assistant.py", fname}, nil, nil, onExit, newPb, newFname)
end
function onExit(output, args)
local pb, fname = args[1], args[2]
if output == nil then
micro.InfoBar():Message(string.format("Running assistant failed (nil) %s ", output ))
return
end
local buf2 = buffer.NewBuffer(output, fname)
pb:OpenBuffer(buf2)
micro.InfoBar():Message(string.format("Done" ))
return
end
But it is not happening. No errors, but content remains the same. Tried it with the parent PaneBuff, content is replaced, but with the buf not buf2.
What am I doing wrong?
I'm looking for some guidance here.
Thanks!
Semirke
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the plugin flow using buffer.NewBuffer, buffer.NewVSplitFromBuffer, shell.JobSpawn, and pb:OpenBuffer(buf2). Start by tracing the pane and buffer objects passed through onExit, then compare the behavior with the parent PaneBuf case shown in the report. Done means identifying why the displayed content is unchanged and confirming the supported way to replace it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100