C-j fix; tool doc upd
This commit is contained in:
@@ -166,12 +166,12 @@ When enabled, the interactive console uses a subtle ANSI palette: the pending-re
|
||||
#### `write_file` tool
|
||||
|
||||
- Parameters:
|
||||
- `path` (string, required): JSON-escaped file path to write to (must be created unless existing).
|
||||
- `offset` (integer, optional, default 0): byte offset to start writing from (defaults to 0, start of file; does not append).
|
||||
- `del_bytes` (integer, optional, default 0): bytes to delete starting from the `offset` prior to writing.
|
||||
- `path` (string, required): JSON-escaped file path to write to.
|
||||
- `offset` (integer, optional): byte offset to start writing from. If omitted together with `del_bytes`, the whole file is overwritten instead. Defaults to 0 (start of file).
|
||||
- `del_bytes` (integer, optional): bytes to delete starting at `offset`. If omitted together with `offset`, the whole file is overwritten instead.
|
||||
- `content` (string, required, may be empty): JSON-escaped content to write to the file.
|
||||
- Return value: string
|
||||
- Action: write `content` into the file at `path` starting at `offset` after deleting `del_bytes` bytes (creating the file and any necessary parent directories).
|
||||
- Action: if `offset` and `del_bytes` are both omitted, the entire file is overwritten with `content` (the file, and any necessary parent directories, are created if missing); otherwise `content` is written at `offset`, optionally deleting `del_bytes` bytes first (splicing prefix + content + suffix and never appending to the end of an existing file), creating the file and parent directories as needed.
|
||||
|
||||
#### `shell_exec` tool
|
||||
|
||||
|
||||
@@ -1598,7 +1598,10 @@ func (e *editor) draw() {
|
||||
er, _ := textPos(P, W, s, len([]rune(s)))
|
||||
pr, pc := textPos(P, W, s, e.pos)
|
||||
if e.crow > 0 { fmt.Printf("\033[%dA", e.crow) }
|
||||
fmt.Print("\r\033[J" + e.prompt + s)
|
||||
// In raw mode OPOST is off, so a bare \n only moves down without
|
||||
// returning to column 0. Emit \r\n so each logical line starts at
|
||||
// column 0, matching the column-reset assumption in textPos().
|
||||
fmt.Print("\r\033[J" + e.prompt + strings.ReplaceAll(s, "\n", "\r\n"))
|
||||
if up := er - pr; up > 0 { fmt.Printf("\033[%dA", up) }
|
||||
fmt.Print("\r")
|
||||
if pc > 0 { fmt.Printf("\033[%dC", pc) }
|
||||
|
||||
Reference in New Issue
Block a user