Documentation
¶
Index ¶
- func IsImageFile(path string) bool
- type CloseViewerMsg
- type EditableKeyMap
- type ExitEditModeMsg
- type FileEditDirtyMsg
- type FileEditSavedMsg
- type FileEditableComponent
- type FileViewerComponent
- type Highlighter
- type OpenEditableFileMsg
- type Tab
- type TabBar
- func (t *TabBar) ActivePath() string
- func (t *TabBar) ActiveTab() *Tab
- func (t *TabBar) BindingKeys() []key.Binding
- func (t *TabBar) CloseActiveTab()
- func (t *TabBar) CloseTab(index int)
- func (t *TabBar) Count() int
- func (t *TabBar) IsActiveEditable() bool
- func (t *TabBar) NextTab()
- func (t *TabBar) OpenEditableTab(path string) int
- func (t *TabBar) OpenTab(path string) int
- func (t *TabBar) PrevTab()
- func (t *TabBar) SetActiveEditable(editable bool)
- func (t *TabBar) SetDirty(path string, dirty bool)
- func (t *TabBar) SetSize(width int)
- func (t *TabBar) Update(msg tea.Msg) (*TabBar, tea.Cmd)
- func (t *TabBar) View() string
- type TabKeyMap
- type ViewerKeyMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsImageFile ¶ added in v0.252.0
IsImageFile reports whether path is a supported image file.
Types ¶
type CloseViewerMsg ¶
type CloseViewerMsg struct {
Path string
}
CloseViewerMsg is emitted when the viewer should be closed.
type EditableKeyMap ¶
type EditableKeyMap struct {
Up key.Binding
Down key.Binding
Left key.Binding
Right key.Binding
LineStart key.Binding
LineEnd key.Binding
PageUp key.Binding
PageDown key.Binding
FileStart key.Binding
FileEnd key.Binding
Save key.Binding
// Selection (shift variants)
SelectUp key.Binding
SelectDown key.Binding
SelectLeft key.Binding
SelectRight key.Binding
SelectLineStart key.Binding
SelectLineEnd key.Binding
SelectAll key.Binding
// Clipboard
Copy key.Binding
Paste key.Binding
PasteClipboard key.Binding
// Multicursor (Micro-style)
AddCursorUp key.Binding
AddCursorDown key.Binding
// Exit edit mode
ExitEditMode key.Binding
// Toggle word wrap
ToggleWordWrap key.Binding
}
EditableKeyMap defines keybindings for the editable file editor.
func DefaultEditableKeyMap ¶
func DefaultEditableKeyMap() EditableKeyMap
DefaultEditableKeyMap returns the default keybindings for the editable component.
type ExitEditModeMsg ¶ added in v0.5.0
type ExitEditModeMsg struct {
Path string
}
ExitEditModeMsg is emitted when the user presses Esc in edit mode to return to view mode.
type FileEditDirtyMsg ¶
FileEditDirtyMsg is emitted when the editable file's dirty state changes.
type FileEditSavedMsg ¶
type FileEditSavedMsg struct {
Path string
}
FileEditSavedMsg is emitted after a file is successfully saved.
type FileEditableComponent ¶
type FileEditableComponent interface {
tea.Model
layout.Sizeable
layout.Bindings
OpenFile(path string) tea.Cmd
FilePath() string
IsDirty() bool
}
FileEditableComponent is the editable file editor used by the editor area.
func NewFileEditor ¶
func NewFileEditor() FileEditableComponent
NewFileEditor creates a new editable file component.
type FileViewerComponent ¶
type FileViewerComponent interface {
tea.Model
layout.Sizeable
layout.Bindings
OpenFile(path string) tea.Cmd
FilePath() string
}
FileViewerComponent is the read-only file viewer used by the editor area.
func NewFileViewer ¶
func NewFileViewer() FileViewerComponent
NewFileViewer creates a new read-only file viewer component.
func NewSmartFileViewer ¶ added in v0.252.0
func NewSmartFileViewer() FileViewerComponent
NewSmartFileViewer creates a composite file viewer that automatically selects the best renderer for the given file type.
type Highlighter ¶
type Highlighter struct {
// contains filtered or unexported fields
}
Highlighter provides reusable chroma-based syntax highlighting for TUI code views.
func New ¶
func New(theme tuitheme.Theme) *Highlighter
New creates a highlighter using the provided Pando theme.
func (*Highlighter) Highlight ¶
func (h *Highlighter) Highlight(source, fileName string) (string, error)
Highlight applies syntax highlighting to a full source buffer.
func (*Highlighter) HighlightLine ¶
func (h *Highlighter) HighlightLine(line, fileName string) string
HighlightLine applies syntax highlighting to a single line. If highlighting fails, the original line is returned unchanged.
func (*Highlighter) HighlightLines ¶
func (h *Highlighter) HighlightLines(source, fileName string) []string
HighlightLines returns the highlighted source split into per-line strings. If highlighting fails, the original unhighlighted lines are returned.
func (*Highlighter) HighlightSnippet ¶
func (h *Highlighter) HighlightSnippet(source, language string) (string, error)
HighlightSnippet applies syntax highlighting to a code block using the declared language when available, falling back to automatic detection.
type OpenEditableFileMsg ¶
type OpenEditableFileMsg struct {
Path string
}
OpenEditableFileMsg requests that a file be opened in editable mode.
type Tab ¶
type Tab struct {
Path string
Name string
Dirty bool
Icon string
IsEditable bool // true when the tab should be opened in editable mode
}
Tab represents a file opened in the editor area.
type TabBar ¶
type TabBar struct {
// contains filtered or unexported fields
}
TabBar keeps track of open files and renders the compact one-line tab strip.
func (*TabBar) ActivePath ¶
ActivePath returns the active tab path or an empty string when none is selected.
func (*TabBar) BindingKeys ¶
BindingKeys returns the keybindings handled by the tab bar.
func (*TabBar) CloseActiveTab ¶
func (t *TabBar) CloseActiveTab()
CloseActiveTab closes the currently focused tab.
func (*TabBar) IsActiveEditable ¶
IsActiveEditable returns true when the active tab is in editable mode.
func (*TabBar) OpenEditableTab ¶
OpenEditableTab opens a new editable tab or focuses an existing one, returning its index.
func (*TabBar) PrevTab ¶
func (t *TabBar) PrevTab()
PrevTab focuses the previous tab, wrapping around.
func (*TabBar) SetActiveEditable ¶ added in v0.5.0
SetActiveEditable switches the active tab between editable and view-only mode.
type ViewerKeyMap ¶
type ViewerKeyMap struct {
Down key.Binding
Up key.Binding
HalfPageDown key.Binding
HalfPageUp key.Binding
Top key.Binding
Bottom key.Binding
Search key.Binding
SearchNext key.Binding
SearchPrev key.Binding
CancelSearch key.Binding
Close key.Binding
ToggleWordWrap key.Binding
}
ViewerKeyMap defines the keybindings for the file viewer component.
func DefaultViewerKeyMap ¶
func DefaultViewerKeyMap() ViewerKeyMap
DefaultViewerKeyMap returns the default keybindings for the file viewer.