diff --git a/foo b/foo new file mode 100644 index 0000000..e69de29 diff --git a/gui/buffer.go b/gui/buffer.go index 309c6a4..024f79b 100644 --- a/gui/buffer.go +++ b/gui/buffer.go @@ -830,9 +830,7 @@ func (b *Buffer) processActionKey(key int) bool { // if no \t (i.e. start of line) go to // the start of the line! b.curs.gotoStart() - } - - if ALT_DOWN { + } else if ALT_DOWN { currLine := b.contents[b.curs.y] i := b.curs.x @@ -1228,9 +1226,15 @@ func (b *Buffer) renderAt(ctx *strife.Renderer, rx int, ry int) { } lineHeight := last_h + pad - yPos := b.ey + ((ry + y_col) * lineHeight) + halfPad + xPos := b.ex + (rx + ((x_col - 1) * last_w)) + yPos := b.ey + (ry + (y_col * lineHeight)) + halfPad - last_w, last_h = ctx.String(string(char), b.ex+(rx+((x_col-1)*last_w)), yPos) + last_w, last_h = ctx.String(string(char), xPos, yPos) + + if DEBUG_MODE { + ctx.SetColor(strife.HexRGB(0xff00ff)) + ctx.Rect(xPos, yPos, last_w, last_h, strife.Line) + } } if b.cfg.Editor.Show_Line_Numbers { @@ -1248,6 +1252,11 @@ func (b *Buffer) renderAt(ctx *strife.Renderer, rx int, ry int) { ctx.SetColor(strife.HexRGB(b.buffOpts.lineNumBackground)) ctx.Rect(rx, yPos, gutterWidth, b.h, strife.Fill) + if DEBUG_MODE { + ctx.SetColor(strife.HexRGB(0xff00ff)) + ctx.Rect(rx, yPos, gutterWidth, b.h, strife.Line) + } + ctx.SetColor(strife.HexRGB(b.buffOpts.lineNumForeground)) ctx.String(fmt.Sprintf("%*d", numLinesCharWidth, (start+lineNum)+1), rx+gutterPadPx, yPos) @@ -1271,6 +1280,11 @@ func (b *Buffer) renderAt(ctx *strife.Renderer, rx int, ry int) { ctx.SetColor(strife.HexRGB(b.buffOpts.cursor)) ctx.Rect(xPos, yPos, cursorWidth, cursorHeight, strife.Fill) + + if DEBUG_MODE { + ctx.SetColor(strife.HexRGB(0xff00ff)) + ctx.Rect(xPos, yPos, cursorWidth, cursorHeight, strife.Line) + } } if b.autoComplete.hasSuggestions() { @@ -1283,6 +1297,11 @@ func (b *Buffer) renderAt(ctx *strife.Renderer, rx int, ry int) { b.autoComplete.renderAt(xPos, yPos, ctx) } + + if DEBUG_MODE { + ctx.SetColor(strife.HexRGB(0xff00ff)) + ctx.Rect(b.ex+rx, b.ey+ry, b.w-b.ex, b.h-b.ey, strife.Line) + } } func (b *Buffer) OnRender(ctx *strife.Renderer) { diff --git a/gui/component.go b/gui/component.go index 5eece3c..5baca57 100644 --- a/gui/component.go +++ b/gui/component.go @@ -4,6 +4,8 @@ import ( "github.com/felixangell/strife" ) +var DEBUG_MODE = false + type Component interface { SetPosition(x, y int) Translate(x, y int) diff --git a/gui/palette.go b/gui/palette.go index 73b24ff..e87d1ea 100644 --- a/gui/palette.go +++ b/gui/palette.go @@ -114,6 +114,7 @@ func NewCommandPalette(conf cfg.TomlConfig, view *View) *CommandPalette { // general border offsets. this is a real easy fixme // for general code clean but maybe another day! palette.buff.ex = 5 + palette.buff.ey = 0 suggestionBoxWidth = palette.w @@ -239,8 +240,13 @@ func (b *CommandPalette) OnRender(ctx *strife.Renderer) { conf := b.conf.Theme.Palette border := 5 + xPos := b.x - border + yPos := b.y - border + paletteWidth := b.w + (border * 2) + paletteHeight := b.h + (border * 2) + ctx.SetColor(strife.HexRGB(conf.Outline)) - ctx.Rect(b.x-border, b.y-border, b.w+(border*2), b.h+(border*2), strife.Fill) + ctx.Rect(xPos, yPos, paletteWidth, paletteHeight, strife.Fill) _, charHeight := ctx.String("foo", -5000, -5000) b.buff.ey = (suggestionBoxHeight / 2) - (charHeight / 2) @@ -256,4 +262,9 @@ func (b *CommandPalette) OnRender(ctx *strife.Renderer) { } } } + + if DEBUG_MODE { + ctx.SetColor(strife.HexRGB(0xff00ff)) + ctx.Rect(xPos, yPos, paletteWidth, paletteHeight, strife.Line) + } } diff --git a/gui/view.go b/gui/view.go index 52ac674..35090af 100644 --- a/gui/view.go +++ b/gui/view.go @@ -137,7 +137,7 @@ func (n *View) OnUpdate() bool { CONTROL_DOWN = strife.KeyPressed(sdl.K_LCTRL) || strife.KeyPressed(sdl.K_RCTRL) SUPER_DOWN = strife.KeyPressed(sdl.K_LGUI) || strife.KeyPressed(sdl.K_RGUI) - shortcutName := "ctl" + shortcutName := "ctrl" mainSuper := CONTROL_DOWN source := cfg.Shortcuts.Controls @@ -151,6 +151,10 @@ func (n *View) OnUpdate() bool { if mainSuper && strife.PollKeys() { r := rune(strife.PopKey()) + if r == sdl.K_F12 { + DEBUG_MODE = !DEBUG_MODE + } + left := 1073741904 right := 1073741903