@@ -142,7 +142,9 @@ Returns an object containing:
142142- ` buffers` - Array of buffer information (id, name, path, language_id)
143143- ` current_buffer_index` - Index of the active buffer
144144- ` size` - Editor dimensions (rows, cols)
145- - ` theme` - Current theme information
145+ - ` theme` - Current theme information. ` theme .colors ` contains parsed VS Code
146+ workbench colors keyed by their original names, such as
147+ ` gitDecoration .modifiedResourceForeground ` or ` list .highlightForeground ` .
146148
147149#### Session State
148150` ` ` javascript
@@ -176,20 +178,27 @@ red.openBuffer(name: string)
176178red .drawText (x: number, y: number, text: string, style?: object)
177179
178180// Create and update a persistent side panel
179- red .createPanel (" tree" , { side: " left" , width: 32 , title : " Files " })
181+ red .createPanel (" tree" , { side: " left" , width: 32 })
180182red .updatePanel (" tree" , [{
181183 id: " /repo/src" ,
182- label: " src" ,
183184 path: " /repo/src" ,
184- depth: 0 ,
185185 expanded: true ,
186- kind: " directory"
186+ kind: " directory" ,
187+ segments: [
188+ { text: " │ " , style: mutedStyle },
189+ { text: " " , style: directoryStyle },
190+ { text: " src" , style: directoryStyle }
191+ ],
192+ right_segments: [
193+ { text: " " , style: modifiedStyle }
194+ ]
187195}])
188196red .focusPanel (" tree" )
189197red .focusEditor ()
190198red .closePanel (" tree" )
191199red .onPanelEvent (" tree" , (event ) => {
192- // event.action is "up", "down", "expand", "collapse", or "activate"
200+ // event.action is "up", "down", "expand", "collapse", "activate",
201+ // "toggle", "close", or "refresh"
193202})
194203` ` `
195204
@@ -198,9 +207,14 @@ while the panel is active. Plugins can call `focusEditor()` to return input
198207to the editor after handling a panel action. Pressing ` Esc` also returns
199208focus to the editor.
200209
210+ Rows are segment-based: ` segments` render from the left, and
211+ ` right_segments` render flush-right when space allows. Segment text is clipped
212+ by terminal display width, so plugins can use Unicode/Nerd Font glyphs safely.
213+
201214#### Filesystem
202215` ` ` javascript
203216const { entries , error } = await red .listDirectory (" ." )
217+ const git = await red .getGitStatus (" ." )
204218const watchId = red .watchDirectory (" ." , async (snapshot ) => {
205219 // snapshot has the same shape as listDirectory()
206220})
@@ -212,6 +226,10 @@ red.openFile("src/main.rs")
212226do not receive arbitrary filesystem access; they request directory listings
213227and directory watches through editor-owned APIs.
214228
229+ ` getGitStatus` returns ` { root, statuses, error }` for the Git repository that
230+ contains the requested path. Each status has ` path` , ` absolute_path` , and a
231+ normalized ` status` such as ` modified` , ` untracked` , ` ignored` , or ` conflict` .
232+
215233#### Buffer Manipulation
216234` ` ` javascript
217235// Insert text at position
0 commit comments