40 lines
928 B
Go
40 lines
928 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"git.gophernest.net/azpect/TextEditor/internal/core"
|
|
"git.gophernest.net/azpect/TextEditor/internal/editor"
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
)
|
|
|
|
// main: Entry point for the Gim text editor. Creates a buffer and window,
|
|
// initializes the editor model, and runs the BubbleTea TUI program.
|
|
func main() {
|
|
buf := core.NewBufferBuilder().
|
|
Build()
|
|
|
|
win := core.NewWindowBuilder().
|
|
WithBuffer(&buf).
|
|
Build()
|
|
|
|
model := editor.NewModelBuilder().
|
|
AddBuffer(&buf).
|
|
AddWindow(&win).
|
|
WithActiveWindowId(win.Id).
|
|
Build()
|
|
|
|
m, _ := tea.NewProgram(model, tea.WithAltScreen()).Run()
|
|
|
|
final, ok := m.(*editor.Model)
|
|
if ok {
|
|
fmt.Printf("PRINTING WINDOWS: %+v\n", final.Windows())
|
|
fmt.Printf("PRINTING ACTIVE WINDOW: %+v\n", final.ActiveWindow())
|
|
for _, win := range final.Windows() {
|
|
fmt.Printf("\t%+v\n", *win.Buffer)
|
|
}
|
|
} else {
|
|
fmt.Printf("PRINTING ALL: %+v\n", m)
|
|
}
|
|
}
|