MCPcopy
hub / github.com/micro-editor/micro / NewBufferFromFile

Function NewBufferFromFile

internal/buffer/buffer.go:337–339  ·  view source on GitHub ↗

NewBufferFromFile opens a new buffer using the given path It will also automatically handle `~`, and line/column with filename:l:c It will return an empty buffer if the path does not exist and an error if the file is a directory

(path string, btype BufType)

Source from the content-addressed store, hash-verified

335// It will return an empty buffer if the path does not exist
336// and an error if the file is a directory
337func NewBufferFromFile(path string, btype BufType) (*Buffer, error) {
338 return NewBufferFromFileWithCommand(path, btype, emptyCommand)
339}
340
341// NewBufferFromStringWithCommand creates a new buffer containing the given string
342// with a cursor loc and a search text

Callers 5

OpenCmdMethod · 0.92
VSplitCmdMethod · 0.92
HSplitCmdMethod · 0.92
NewTabCmdMethod · 0.92
luaImportMicroBufferFunction · 0.92

Calls 1

Tested by

no test coverage detected