From bd0c172667d5be660fe8bd3047d7565c6dc0349d Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Sat, 28 Dec 2019 12:04:43 -0500 Subject: [PATCH] Improve mouse selection performance --- internal/action/actions.go | 1 - internal/util/profile.go | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/internal/action/actions.go b/internal/action/actions.go index 0894681b..dc510080 100644 --- a/internal/action/actions.go +++ b/internal/action/actions.go @@ -88,7 +88,6 @@ func (h *BufPane) MousePress(e *tcell.EventMouse) bool { h.Cursor.AddWordToSelection() } else { h.Cursor.SetSelectionEnd(h.Cursor.Loc) - h.Cursor.CopySelection("primary") } } diff --git a/internal/util/profile.go b/internal/util/profile.go index d15655dd..04add2c7 100644 --- a/internal/util/profile.go +++ b/internal/util/profile.go @@ -16,14 +16,12 @@ func GetMemStats() string { return fmt.Sprintf("Alloc: %s, Sys: %s, GC: %d, PauseTotalNs: %dns", humanize.Bytes(memstats.Alloc), humanize.Bytes(memstats.Sys), memstats.NumGC, memstats.PauseTotalNs) } -var start time.Time - -func Tic(s string) { +func Tic(s string) time.Time { log.Println("START:", s) - start = time.Now() + return time.Now() } -func Toc() { +func Toc(start time.Time) { end := time.Now() log.Println("END: ElapsedTime in seconds:", end.Sub(start)) }