mirror of
https://github.com/felixangell/phi.git
synced 2024-08-16 11:10:37 +03:00
fixed buffer overflow from colour change focus thing; added highlight
line col
This commit is contained in:
parent
5da67dbe41
commit
172344ad3f
@ -85,13 +85,14 @@ type RenderConfig struct {
|
||||
// the default theme in the EditorConfig
|
||||
// instead.
|
||||
type ThemeConfig struct {
|
||||
Background uint32
|
||||
Foreground uint32
|
||||
Cursor uint32
|
||||
Cursor_Invert uint32
|
||||
Palette PaletteConfig
|
||||
Gutter_Background uint32
|
||||
Gutter_Foreground uint32
|
||||
Background uint32
|
||||
Foreground uint32
|
||||
Cursor uint32
|
||||
Cursor_Invert uint32
|
||||
Palette PaletteConfig
|
||||
Gutter_Background uint32
|
||||
Gutter_Foreground uint32
|
||||
Highlight_Line_Background uint32
|
||||
}
|
||||
|
||||
type PaletteConfig struct {
|
||||
|
@ -41,6 +41,7 @@ cursor = 0xf2f4f6
|
||||
cursor_invert = 0x000000
|
||||
gutter_background = 0x002649
|
||||
gutter_foreground = 0xf2f4f6
|
||||
highlight_line_background = 0x000000
|
||||
|
||||
[theme.palette]
|
||||
outline = 0xebedef
|
||||
|
@ -41,6 +41,7 @@ cursor = 0xf2f4f6
|
||||
cursor_invert = 0x000000
|
||||
gutter_background = 0x002649
|
||||
gutter_foreground = 0xf2f4f6
|
||||
highlight_line_background = 0x000000
|
||||
|
||||
[theme.palette]
|
||||
outline = 0xebedef
|
||||
|
@ -41,6 +41,7 @@ cursor = 0xf2f4f6
|
||||
cursor_invert = 0x000000
|
||||
gutter_background = 0x002649
|
||||
gutter_foreground = 0xf2f4f6
|
||||
highlight_line_background = 0x000000
|
||||
|
||||
[theme.palette]
|
||||
outline = 0xebedef
|
||||
|
@ -29,7 +29,7 @@ var (
|
||||
)
|
||||
|
||||
const (
|
||||
DEFAULT_SCROLL_AMOUNT = 50
|
||||
DEFAULT_SCROLL_AMOUNT = 10
|
||||
)
|
||||
|
||||
// TODO move into config
|
||||
@ -119,6 +119,7 @@ type BufferConfig struct {
|
||||
foreground uint32
|
||||
cursor uint32
|
||||
cursorInvert uint32
|
||||
highlightLine uint32
|
||||
lineNumBackground uint32
|
||||
lineNumForeground uint32
|
||||
font *strife.Font
|
||||
@ -1249,7 +1250,7 @@ func (b *Buffer) renderAt(ctx *strife.Renderer, rx int, ry int) {
|
||||
ctx.Rect(b.x, b.y, b.w, b.h, strife.Fill)
|
||||
|
||||
if b.cfg.Editor.Highlight_Line && b.HasFocus() {
|
||||
ctx.SetColor(strife.Black) // highlight_line_col?
|
||||
ctx.SetColor(strife.HexRGB(b.buffOpts.highlightLine)) // highlight_line_col?
|
||||
|
||||
highlightLinePosY := b.ey + (ry + b.curs.ry*(last_h+pad)) - (b.cam.y * (last_h + pad))
|
||||
highlightLinePosX := b.ex + rx
|
||||
|
@ -48,10 +48,12 @@ func (b *BufferPane) renderMetaPanel(ctx *strife.Renderer) {
|
||||
focused := b.Buff.index == b.Buff.parent.focusedBuff
|
||||
|
||||
colour := strife.HexRGB(conf.Suggestion.Background)
|
||||
|
||||
if focused {
|
||||
colour.R *= 2
|
||||
colour.G *= 2
|
||||
colour.B *= 2
|
||||
nr := int(colour.R) + 10
|
||||
ng := int(colour.G) + 10
|
||||
nb := int(colour.B) + 10
|
||||
colour = strife.RGB(nr, ng, nb)
|
||||
}
|
||||
|
||||
// panel backdrop
|
||||
|
@ -102,9 +102,12 @@ func NewCommandPalette(conf cfg.TomlConfig, view *View) *CommandPalette {
|
||||
conf.Theme.Palette.Cursor,
|
||||
conf.Theme.Palette.Cursor, // TODO invert
|
||||
|
||||
conf.Theme.Highlight_Line_Background,
|
||||
|
||||
// we dont show line numbers
|
||||
// so these aren't necessary
|
||||
0x0, 0x0,
|
||||
|
||||
conf.Editor.Loaded_Font,
|
||||
}, nil, 0),
|
||||
parentBuff: nil,
|
||||
|
@ -334,6 +334,7 @@ func (n *View) AddBuffer() *Buffer {
|
||||
cfg.Theme.Foreground,
|
||||
cfg.Theme.Cursor,
|
||||
cfg.Theme.Cursor_Invert,
|
||||
cfg.Theme.Highlight_Line_Background,
|
||||
cfg.Theme.Gutter_Background,
|
||||
cfg.Theme.Gutter_Foreground,
|
||||
cfg.Editor.Loaded_Font,
|
||||
|
Loading…
Reference in New Issue
Block a user