mirror of
https://github.com/felixangell/phi.git
synced 2024-08-16 19:20:21 +03:00
attempted to not blink while moving... didnt work!
This commit is contained in:
parent
a46f211c0d
commit
c03af2199f
@ -837,6 +837,9 @@ func (b *Buffer) HandleEvent(evt strife.StrifeEvent) {
|
||||
var lastCursorDraw = time.Now()
|
||||
var renderFlashingCursor = true
|
||||
|
||||
var lastTimer = time.Now()
|
||||
var ldx, ldy = 0, 0
|
||||
|
||||
func (b *Buffer) OnUpdate() bool {
|
||||
return false
|
||||
}
|
||||
@ -885,7 +888,7 @@ func (b *Buffer) processInput(pred func(r int) bool) bool {
|
||||
}
|
||||
|
||||
// handle cursor flash
|
||||
if b.cfg.Cursor.Flash && runtime.GOOS == "spookyghost" {
|
||||
if b.cfg.Cursor.Flash && 15 == 12 {
|
||||
if time.Now().Sub(lastCursorDraw) >= time.Duration(b.cfg.Cursor.Flash_Rate)*time.Millisecond {
|
||||
renderFlashingCursor = !renderFlashingCursor
|
||||
lastCursorDraw = time.Now()
|
||||
@ -1098,7 +1101,7 @@ func (b *Buffer) renderAt(ctx *strife.Renderer, rx int, ry int) {
|
||||
}
|
||||
|
||||
// render the ol' cursor
|
||||
if b.HasFocus() && renderFlashingCursor && b.cfg.Cursor.Draw {
|
||||
if b.HasFocus() && (renderFlashingCursor || b.curs.moving) && b.cfg.Cursor.Draw {
|
||||
cursorWidth := b.cfg.Cursor.GetCaretWidth()
|
||||
if cursorWidth == -1 {
|
||||
cursorWidth = last_w
|
||||
|
@ -3,6 +3,8 @@ package gui
|
||||
type Cursor struct {
|
||||
x, y int
|
||||
rx, ry int
|
||||
dx, dy int
|
||||
moving bool
|
||||
}
|
||||
|
||||
func (c *Cursor) gotoStart() {
|
||||
@ -18,6 +20,20 @@ func (c *Cursor) move(x, y int) {
|
||||
// moves the cursors position, and the
|
||||
// rendered coordinates by the given amount
|
||||
func (c *Cursor) moveRender(x, y, rx, ry int) {
|
||||
if x > 0 {
|
||||
c.dx = 1
|
||||
} else if x < 0 {
|
||||
c.dx = -1
|
||||
}
|
||||
|
||||
if y > 0 {
|
||||
c.dy = 1
|
||||
} else if y < 0 {
|
||||
c.dy = -1
|
||||
}
|
||||
|
||||
c.moving = true
|
||||
|
||||
c.x += x
|
||||
c.y += y
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user