fix: remove the styles package, fixed tests
All checks were successful
Run Test Suite / test (push) Successful in 31s
All checks were successful
Run Test Suite / test (push) Successful in 31s
However, the colorscheme functions and tests do not work anymore, they need to be rebuilt.
This commit is contained in:
parent
1c2585b8d9
commit
be13f8838d
@ -2,7 +2,6 @@ package action
|
||||
|
||||
import (
|
||||
"git.gophernest.net/azpect/TextEditor/internal/core"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/style"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/theme"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
)
|
||||
@ -55,8 +54,6 @@ type Model interface {
|
||||
|
||||
Settings() core.EditorSettings
|
||||
SetSettings(s core.EditorSettings)
|
||||
Styles() style.Styles
|
||||
SetStyles(s style.Styles)
|
||||
Theme() theme.EditorTheme
|
||||
SetTheme(t theme.EditorTheme)
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@ package action
|
||||
|
||||
import (
|
||||
"git.gophernest.net/azpect/TextEditor/internal/core"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/style"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/theme"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
)
|
||||
@ -24,7 +23,6 @@ type MockModel struct {
|
||||
CommandHistoryList []string
|
||||
CommandHistoryCur int
|
||||
LastFindVal core.LastFindCommand
|
||||
StylesVal style.Styles
|
||||
ThemeVal theme.EditorTheme
|
||||
LastChangeKeysList []string
|
||||
}
|
||||
@ -119,8 +117,6 @@ func (m *MockModel) Mode() core.Mode { return m.ModeVal }
|
||||
func (m *MockModel) SetMode(mode core.Mode) { m.ModeVal = mode }
|
||||
func (m *MockModel) Settings() core.EditorSettings { return m.SettingsVal }
|
||||
func (m *MockModel) SetSettings(s core.EditorSettings) { m.SettingsVal = s }
|
||||
func (m *MockModel) Styles() style.Styles { return m.StylesVal }
|
||||
func (m *MockModel) SetStyles(s style.Styles) { m.StylesVal = s }
|
||||
func (m *MockModel) Theme() theme.EditorTheme { return m.ThemeVal }
|
||||
func (m *MockModel) SetTheme(t theme.EditorTheme) { m.ThemeVal = t }
|
||||
|
||||
|
||||
@ -12,7 +12,6 @@ import (
|
||||
|
||||
"git.gophernest.net/azpect/TextEditor/internal/action"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/core"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/style"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
)
|
||||
|
||||
@ -915,7 +914,7 @@ func cmdColorscheme(m action.Model, args []string, force bool) tea.Cmd {
|
||||
return nil
|
||||
}
|
||||
|
||||
m.SetStyles(style.DefaultStyles())
|
||||
// m.SetStyles(style.DefaultStyles())
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,6 @@ import (
|
||||
|
||||
"git.gophernest.net/azpect/TextEditor/internal/action"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/core"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/style"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
)
|
||||
|
||||
@ -5512,32 +5511,32 @@ func TestCmdColorscheme(t *testing.T) {
|
||||
// Group 1: Valid name — styles are updated
|
||||
// --------------------------------------------------
|
||||
|
||||
t.Run("valid name updates styles on model", func(t *testing.T) {
|
||||
m := action.NewMockModel()
|
||||
m.SetStyles(style.DefaultStyles())
|
||||
before := m.StylesVal.BackgroundStyle.Render(" ")
|
||||
|
||||
cmdColorscheme(m, []string{"default"}, false)
|
||||
|
||||
after := m.StylesVal.BackgroundStyle.Render(" ")
|
||||
if after != before {
|
||||
t.Error("expected default styles to remain stable after applying default")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("same valid name applied twice produces same styles", func(t *testing.T) {
|
||||
m := action.NewMockModel()
|
||||
|
||||
cmdColorscheme(m, []string{"default"}, false)
|
||||
first := m.StylesVal.BackgroundStyle.Render(" ")
|
||||
|
||||
cmdColorscheme(m, []string{"default"}, false)
|
||||
second := m.StylesVal.BackgroundStyle.Render(" ")
|
||||
|
||||
if first != second {
|
||||
t.Error("expected applying the same colorscheme twice to produce identical styles")
|
||||
}
|
||||
})
|
||||
// t.Run("valid name updates styles on model", func(t *testing.T) {
|
||||
// m := action.NewMockModel()
|
||||
// // m.SetStyles(style.DefaultStyles())
|
||||
// before := m.StylesVal.BackgroundStyle.Render(" ")
|
||||
//
|
||||
// cmdColorscheme(m, []string{"default"}, false)
|
||||
//
|
||||
// after := m.StylesVal.BackgroundStyle.Render(" ")
|
||||
// if after != before {
|
||||
// t.Error("expected default styles to remain stable after applying default")
|
||||
// }
|
||||
// })
|
||||
//
|
||||
// t.Run("same valid name applied twice produces same styles", func(t *testing.T) {
|
||||
// m := action.NewMockModel()
|
||||
//
|
||||
// cmdColorscheme(m, []string{"default"}, false)
|
||||
// first := m.StylesVal.BackgroundStyle.Render(" ")
|
||||
//
|
||||
// cmdColorscheme(m, []string{"default"}, false)
|
||||
// second := m.StylesVal.BackgroundStyle.Render(" ")
|
||||
//
|
||||
// if first != second {
|
||||
// t.Error("expected applying the same colorscheme twice to produce identical styles")
|
||||
// }
|
||||
// })
|
||||
|
||||
t.Run("valid name sets no error output", func(t *testing.T) {
|
||||
m := action.NewMockModel()
|
||||
@ -5576,16 +5575,16 @@ func TestCmdColorscheme(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("unknown name does not change styles", func(t *testing.T) {
|
||||
m := action.NewMockModel()
|
||||
before := m.StylesVal.BackgroundStyle.Render(" ")
|
||||
|
||||
cmdColorscheme(m, []string{"not-a-real-theme"}, false)
|
||||
|
||||
if m.StylesVal.BackgroundStyle.Render(" ") != before {
|
||||
t.Error("expected styles to remain unchanged after unknown colorscheme")
|
||||
}
|
||||
})
|
||||
// t.Run("unknown name does not change styles", func(t *testing.T) {
|
||||
// m := action.NewMockModel()
|
||||
// before := m.StylesVal.BackgroundStyle.Render(" ")
|
||||
//
|
||||
// cmdColorscheme(m, []string{"not-a-real-theme"}, false)
|
||||
//
|
||||
// if m.StylesVal.BackgroundStyle.Render(" ") != before {
|
||||
// t.Error("expected styles to remain unchanged after unknown colorscheme")
|
||||
// }
|
||||
// })
|
||||
|
||||
t.Run("empty string name sets error output", func(t *testing.T) {
|
||||
m := action.NewMockModel()
|
||||
@ -5624,16 +5623,16 @@ func TestCmdColorscheme(t *testing.T) {
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("no args does not change styles", func(t *testing.T) {
|
||||
m := action.NewMockModel()
|
||||
before := m.StylesVal.BackgroundStyle.Render(" ")
|
||||
|
||||
cmdColorscheme(m, []string{}, false)
|
||||
|
||||
if m.StylesVal.BackgroundStyle.Render(" ") != before {
|
||||
t.Error("expected styles to remain unchanged when no args given")
|
||||
}
|
||||
})
|
||||
// t.Run("no args does not change styles", func(t *testing.T) {
|
||||
// m := action.NewMockModel()
|
||||
// before := m.StylesVal.BackgroundStyle.Render(" ")
|
||||
//
|
||||
// cmdColorscheme(m, []string{}, false)
|
||||
//
|
||||
// if m.StylesVal.BackgroundStyle.Render(" ") != before {
|
||||
// t.Error("expected styles to remain unchanged when no args given")
|
||||
// }
|
||||
// })
|
||||
|
||||
t.Run("no args returns nil tea.Cmd", func(t *testing.T) {
|
||||
m := action.NewMockModel()
|
||||
@ -5802,5 +5801,3 @@ func TestCmdListColorschemes(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
var _ = style.DefaultStyles
|
||||
|
||||
@ -7,7 +7,6 @@ import (
|
||||
"git.gophernest.net/azpect/TextEditor/internal/action"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/core"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/input"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/style"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/syntax"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/theme"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
@ -52,7 +51,6 @@ type Model struct {
|
||||
registers map[rune]core.Register // name -> register
|
||||
|
||||
// Visual styles
|
||||
styles style.Styles
|
||||
theme theme.EditorTheme
|
||||
syntax syntax.Engine
|
||||
|
||||
@ -343,16 +341,6 @@ func (m *Model) SetSettings(s core.EditorSettings) {
|
||||
m.settings = s
|
||||
}
|
||||
|
||||
// Model.Styles: Returns the visual styles used for rendering.
|
||||
func (m *Model) Styles() style.Styles {
|
||||
return m.styles
|
||||
}
|
||||
|
||||
// Model.SetStyles: Sets the visual styles used for rendering.
|
||||
func (m *Model) SetStyles(s style.Styles) {
|
||||
m.styles = s
|
||||
}
|
||||
|
||||
func (m *Model) Theme() theme.EditorTheme {
|
||||
return m.theme
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ package editor
|
||||
import (
|
||||
"git.gophernest.net/azpect/TextEditor/internal/core"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/input"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/style"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/syntax"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/theme/themes"
|
||||
)
|
||||
@ -14,7 +13,6 @@ type ModelBuilder struct {
|
||||
|
||||
// NewModelBuilder: Builds and returns a new model, using the default color scheme (kanagawa-wave).
|
||||
func NewModelBuilder() *ModelBuilder {
|
||||
editorStyles := style.DefaultStyles()
|
||||
editorTheme := themes.NewDefaultTheme()
|
||||
|
||||
return &ModelBuilder{
|
||||
@ -34,7 +32,6 @@ func NewModelBuilder() *ModelBuilder {
|
||||
commandOutput: nil,
|
||||
settings: core.NewDefaultSettings(),
|
||||
registers: core.DefaultRegisters(),
|
||||
styles: editorStyles,
|
||||
syntax: syntax.NewTreeSitterEngine(editorTheme),
|
||||
theme: editorTheme,
|
||||
},
|
||||
@ -129,12 +126,6 @@ func (mb *ModelBuilder) WithCommandOutput(out *core.CommandOutput) *ModelBuilder
|
||||
return mb
|
||||
}
|
||||
|
||||
// ModelBuilder.WithStyles: Set the visual styling for the editor.
|
||||
func (mb *ModelBuilder) WithStyles(styles style.Styles) *ModelBuilder {
|
||||
mb.model.styles = styles
|
||||
return mb
|
||||
}
|
||||
|
||||
// ModelBuilder.Build: Build and return the configured Model instance.
|
||||
func (mb *ModelBuilder) Build() *Model {
|
||||
m := &mb.model
|
||||
|
||||
@ -1,52 +0,0 @@
|
||||
package style
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
)
|
||||
|
||||
func CaptureStyle(base lipgloss.Style, capture string) lipgloss.Style {
|
||||
full := strings.ToLower(strings.TrimSpace(capture))
|
||||
baseName := strings.Split(full, ".")[0]
|
||||
|
||||
switch full {
|
||||
case "keyword", "keyword.type", "keyword.function", "keyword.coroutine", "keyword.repeat", "keyword.import", "keyword.conditional":
|
||||
return base.Foreground(lipgloss.Color("#c678dd"))
|
||||
case "function", "function.call", "function.method", "function.method.call":
|
||||
return base.Foreground(lipgloss.Color("#61afef"))
|
||||
case "function.builtin", "constructor", "keyword.return":
|
||||
return base.Foreground(lipgloss.Color("#ff5f5f"))
|
||||
case "type", "type.builtin", "type.definition", "tag.attribute", "tag.attribute.url":
|
||||
return base.Foreground(lipgloss.Color("#e5c07b"))
|
||||
case "string", "string.escape":
|
||||
return base.Foreground(lipgloss.Color("#98c379"))
|
||||
case "number", "number.float", "boolean", "constant", "constant.builtin", "string.special.url":
|
||||
return base.Foreground(lipgloss.Color("#56b6c2"))
|
||||
case "operator", "punctuation.delimiter", "punctuation.bracket", "string.special":
|
||||
return base.Foreground(lipgloss.Color("#d19a66"))
|
||||
case "comment", "comment.documentation", "tag.delimiter":
|
||||
return base.Foreground(lipgloss.Color("#7f848e"))
|
||||
case "variable.parameter":
|
||||
return base.Foreground(lipgloss.Color("#dcdfe4")).Italic(true)
|
||||
case "module", "label", "property", "variable.member", "variable":
|
||||
return base.Foreground(lipgloss.Color("#dcdfe4"))
|
||||
}
|
||||
|
||||
switch baseName {
|
||||
case "keyword", "tag":
|
||||
return base.Foreground(lipgloss.Color("#c678dd"))
|
||||
case "function", "markup":
|
||||
return base.Foreground(lipgloss.Color("#61afef"))
|
||||
case "type":
|
||||
return base.Foreground(lipgloss.Color("#e5c07b"))
|
||||
case "string":
|
||||
return base.Foreground(lipgloss.Color("#98c379"))
|
||||
case "number", "boolean", "constant":
|
||||
return base.Foreground(lipgloss.Color("#56b6c2"))
|
||||
case "comment":
|
||||
return base.Foreground(lipgloss.Color("#7f848e"))
|
||||
default:
|
||||
return base
|
||||
}
|
||||
}
|
||||
@ -1,147 +0,0 @@
|
||||
package style
|
||||
|
||||
import (
|
||||
"git.gophernest.net/azpect/TextEditor/internal/core"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
)
|
||||
|
||||
// Styles holds all the visual styling for the editor.
|
||||
type Styles struct {
|
||||
// Cursor styles by mode
|
||||
CursorNormal lipgloss.Style
|
||||
CursorInsert lipgloss.Style
|
||||
CursorCommand lipgloss.Style
|
||||
CursorReplace lipgloss.Style
|
||||
|
||||
// Gutter (line numbers)
|
||||
Gutter lipgloss.Style
|
||||
GutterCurrentLine lipgloss.Style
|
||||
|
||||
// Visual mode
|
||||
VisualHighlight lipgloss.Style
|
||||
VisualAnchor lipgloss.Style
|
||||
|
||||
// Status bar
|
||||
StatusBar lipgloss.Style
|
||||
StatusBarActive lipgloss.Style
|
||||
|
||||
// Command line
|
||||
CommandError lipgloss.Style
|
||||
CommandOutputBorder lipgloss.Style
|
||||
CommandContinueMessage lipgloss.Style
|
||||
|
||||
// General styles
|
||||
LineStyle lipgloss.Style
|
||||
BackgroundStyle lipgloss.Style
|
||||
}
|
||||
|
||||
// DefaultStyles: Returns the default editor color scheme.
|
||||
func DefaultStyles() Styles {
|
||||
bg := lipgloss.Color("#1f2335")
|
||||
fg := lipgloss.Color("#dcd7ba")
|
||||
|
||||
return Styles{
|
||||
CursorNormal: lipgloss.NewStyle().
|
||||
Background(fg).
|
||||
Foreground(bg),
|
||||
|
||||
CursorInsert: lipgloss.NewStyle().
|
||||
Background(bg).
|
||||
Foreground(fg).
|
||||
Underline(true),
|
||||
|
||||
CursorCommand: lipgloss.NewStyle().
|
||||
Background(fg).
|
||||
Foreground(bg),
|
||||
|
||||
CursorReplace: lipgloss.NewStyle().
|
||||
Background(bg).
|
||||
Foreground(fg).
|
||||
Underline(true),
|
||||
|
||||
Gutter: lipgloss.NewStyle().
|
||||
Background(lipgloss.Color("#181b2a")).
|
||||
Foreground(lipgloss.Color("#7e8399")),
|
||||
|
||||
GutterCurrentLine: lipgloss.NewStyle().
|
||||
Background(lipgloss.Color("#181b2a")).
|
||||
Foreground(lipgloss.Color("#e6c384")),
|
||||
|
||||
VisualHighlight: lipgloss.NewStyle().
|
||||
Background(lipgloss.Color("#2f334d")),
|
||||
|
||||
VisualAnchor: lipgloss.NewStyle().
|
||||
Background(lipgloss.Color("#3a3f5f")),
|
||||
|
||||
StatusBar: lipgloss.NewStyle().
|
||||
Background(lipgloss.Color("#181b2a")).
|
||||
Foreground(lipgloss.Color("#8ea4a2")),
|
||||
|
||||
StatusBarActive: lipgloss.NewStyle().
|
||||
Background(lipgloss.Color("#223249")).
|
||||
Foreground(lipgloss.Color("#9ec1cf")),
|
||||
|
||||
CommandError: lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#e82424")),
|
||||
|
||||
CommandOutputBorder: lipgloss.NewStyle().
|
||||
Background(lipgloss.Color("#11131d")),
|
||||
|
||||
CommandContinueMessage: lipgloss.NewStyle().
|
||||
Foreground(lipgloss.Color("#7aa2f7")),
|
||||
|
||||
LineStyle: lipgloss.NewStyle().
|
||||
Foreground(fg).
|
||||
Background(bg),
|
||||
|
||||
BackgroundStyle: lipgloss.NewStyle().
|
||||
Background(bg),
|
||||
}
|
||||
}
|
||||
|
||||
// Styles.DefaultCursorStyle: Returns the appropriate cursor style for the given mode.
|
||||
//
|
||||
// DEPRECATED: Using EditorTheme.DefaultCursor now
|
||||
func (s Styles) DefaultCursorStyle(mode core.Mode) lipgloss.Style {
|
||||
switch mode {
|
||||
case core.InsertMode:
|
||||
return s.CursorInsert
|
||||
case core.CommandMode:
|
||||
return s.CursorCommand
|
||||
case core.ReplaceMode:
|
||||
return s.CursorReplace
|
||||
default:
|
||||
return s.CursorNormal
|
||||
}
|
||||
}
|
||||
|
||||
// Styles.CursorStyle: Returns a cursor style derived from the text style.
|
||||
//
|
||||
// DEPRECATED: Using EditorTheme.Cursor now
|
||||
func (s Styles) CursorStyle(mode core.Mode, textStyle lipgloss.Style) lipgloss.Style {
|
||||
switch mode {
|
||||
case core.NormalMode, core.VisualLineMode, core.VisualBlockMode, core.VisualMode:
|
||||
return lipgloss.NewStyle().
|
||||
Background(textStyle.GetForeground()).
|
||||
Foreground(textStyle.GetBackground())
|
||||
case core.ReplaceMode, core.WaitingMode:
|
||||
return lipgloss.NewStyle().
|
||||
Background(textStyle.GetBackground()).
|
||||
Foreground(textStyle.GetForeground()).
|
||||
Underline(true)
|
||||
default:
|
||||
return lipgloss.NewStyle().
|
||||
Background(s.BackgroundStyle.GetBackground()).
|
||||
Foreground(textStyle.GetForeground()).
|
||||
Underline(true)
|
||||
}
|
||||
}
|
||||
|
||||
// Styles.VisualHighlightWithTextColor: Applies visual background while preserving text color.
|
||||
//
|
||||
// DEPRECATED: Using EditorTheme.VisualHighlightWithTextColor now
|
||||
func (s Styles) VisualHighlightWithTextColor(textStyle lipgloss.Style) lipgloss.Style {
|
||||
return lipgloss.NewStyle().
|
||||
Background(s.VisualHighlight.GetBackground()).
|
||||
Foreground(textStyle.GetForeground())
|
||||
}
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"git.gophernest.net/azpect/TextEditor/internal/core"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/style"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/theme/themes"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
)
|
||||
|
||||
@ -23,10 +23,10 @@ func TestTreeSitterEngineHighlightsGoKeywordAndString(t *testing.T) {
|
||||
Build()
|
||||
buf := &b
|
||||
|
||||
engine := NewTreeSitterEngine(style.DefaultStyles())
|
||||
engine := NewTreeSitterEngine(themes.NewDefaultTheme())
|
||||
engine.PrepareBuffer(buf)
|
||||
|
||||
base := engine.styles.LineStyle
|
||||
base := engine.editorTheme.Line
|
||||
|
||||
line0 := buf.Line(0)
|
||||
map0 := engine.LineStyleMap(buf, 0)
|
||||
@ -63,10 +63,10 @@ func TestTreeSitterEngineHighlightsMultilineRawString(t *testing.T) {
|
||||
Build()
|
||||
buf := &b
|
||||
|
||||
engine := NewTreeSitterEngine(style.DefaultStyles())
|
||||
engine := NewTreeSitterEngine(themes.NewDefaultTheme())
|
||||
engine.PrepareBuffer(buf)
|
||||
|
||||
base := engine.styles.LineStyle
|
||||
base := engine.editorTheme.Line
|
||||
map3 := engine.LineStyleMap(buf, 3)
|
||||
if len(map3) == 0 {
|
||||
t.Fatalf("expected style map on multiline raw string line")
|
||||
@ -89,7 +89,7 @@ func TestTreeSitterEngineApplyEditUpdatesStyleCategory(t *testing.T) {
|
||||
Build()
|
||||
buf := &b
|
||||
|
||||
engine := NewTreeSitterEngine(style.DefaultStyles())
|
||||
engine := NewTreeSitterEngine(themes.NewDefaultTheme())
|
||||
engine.PrepareBuffer(buf)
|
||||
|
||||
oldLine := buf.Line(2)
|
||||
@ -121,7 +121,7 @@ func TestTreeSitterEngineApplyEditUpdatesStyleCategory(t *testing.T) {
|
||||
newMap := engine.LineStyleMap(buf, 2)
|
||||
newStyle := newMap[newIdx]
|
||||
|
||||
if styleEquivalent(newStyle, engine.styles.LineStyle) {
|
||||
if styleEquivalent(newStyle, engine.editorTheme.Line) {
|
||||
t.Fatalf("expected updated string to be highlighted")
|
||||
}
|
||||
if styleEquivalent(oldStyle, newStyle) {
|
||||
@ -137,7 +137,7 @@ func TestTreeSitterEngineApplyEditLineCountChangeForcesFullDirty(t *testing.T) {
|
||||
Build()
|
||||
buf := &b
|
||||
|
||||
engine := NewTreeSitterEngine(style.DefaultStyles())
|
||||
engine := NewTreeSitterEngine(themes.NewDefaultTheme())
|
||||
engine.PrepareBuffer(buf)
|
||||
bc := engine.getCache(buf)
|
||||
|
||||
@ -176,10 +176,10 @@ func TestTreeSitterEngineUnsupportedBufferFallsBackToDefaultStyles(t *testing.T)
|
||||
Build()
|
||||
buf := &b
|
||||
|
||||
engine := NewTreeSitterEngine(style.DefaultStyles())
|
||||
engine := NewTreeSitterEngine(themes.NewDefaultTheme())
|
||||
engine.PrepareBuffer(buf)
|
||||
|
||||
base := engine.styles.LineStyle
|
||||
base := engine.editorTheme.Line
|
||||
line := buf.Line(0)
|
||||
m := engine.LineStyleMap(buf, 0)
|
||||
if len(m) != len([]rune(line)) {
|
||||
@ -200,7 +200,7 @@ func TestTreeSitterEngineLastLineEditDoesNotPanicAndRebuilds(t *testing.T) {
|
||||
Build()
|
||||
buf := &b
|
||||
|
||||
engine := NewTreeSitterEngine(style.DefaultStyles())
|
||||
engine := NewTreeSitterEngine(themes.NewDefaultTheme())
|
||||
engine.PrepareBuffer(buf)
|
||||
bc := engine.getCache(buf)
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"git.gophernest.net/azpect/TextEditor/internal/core"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/style"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/theme/themes"
|
||||
)
|
||||
|
||||
func BenchmarkTreeSitterPrepareAndIncrementalEdit(b *testing.B) {
|
||||
@ -18,7 +18,7 @@ func BenchmarkTreeSitterPrepareAndIncrementalEdit(b *testing.B) {
|
||||
|
||||
bld := core.NewBufferBuilder().WithFilename("bench.go").WithFiletype("go").WithLines(lines).Build()
|
||||
buf := &bld
|
||||
eng := NewTreeSitterEngine(style.DefaultStyles())
|
||||
eng := NewTreeSitterEngine(themes.NewDefaultTheme())
|
||||
|
||||
eng.PrepareBuffer(buf)
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"git.gophernest.net/azpect/TextEditor/internal/core"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/style"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/theme/themes"
|
||||
)
|
||||
|
||||
func TestTreeSitterEngineApplyEditMarksDirtyWithoutFullInvalidation(t *testing.T) {
|
||||
@ -15,7 +15,7 @@ func TestTreeSitterEngineApplyEditMarksDirtyWithoutFullInvalidation(t *testing.T
|
||||
Build()
|
||||
buf := &b
|
||||
|
||||
engine := NewTreeSitterEngine(style.DefaultStyles())
|
||||
engine := NewTreeSitterEngine(themes.NewDefaultTheme())
|
||||
engine.PrepareBuffer(buf)
|
||||
|
||||
bc := engine.getCache(buf)
|
||||
@ -62,7 +62,7 @@ func TestTreeSitterEngineInvalidateLinesAndBuffer(t *testing.T) {
|
||||
Build()
|
||||
buf := &b
|
||||
|
||||
engine := NewTreeSitterEngine(style.DefaultStyles())
|
||||
engine := NewTreeSitterEngine(themes.NewDefaultTheme())
|
||||
engine.PrepareBuffer(buf)
|
||||
|
||||
bc := engine.getCache(buf)
|
||||
|
||||
@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"git.gophernest.net/azpect/TextEditor/internal/core"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/style"
|
||||
"git.gophernest.net/azpect/TextEditor/internal/theme/themes"
|
||||
)
|
||||
|
||||
type seqOp func(*core.Buffer, *core.Window)
|
||||
@ -66,7 +66,7 @@ func TestTreeSitterEngineEditSequences(t *testing.T) {
|
||||
w := core.NewWindowBuilder().WithBuffer(buf).WithDimensions(120, 40).Build()
|
||||
win := &w
|
||||
|
||||
engine := NewTreeSitterEngine(style.DefaultStyles())
|
||||
engine := NewTreeSitterEngine(themes.NewDefaultTheme())
|
||||
|
||||
buf.OnChange = func(change core.BufferChange) {
|
||||
if change.Edit != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user