From e5538155011f13b346c4e4608974f3c0dc2bb845 Mon Sep 17 00:00:00 2001 From: Camille Scholtz Date: Tue, 24 May 2016 21:40:05 +0200 Subject: [PATCH] make undothresthold a setting (part 2) --- cmd/micro/eventhandler.go | 2 ++ cmd/micro/micro.go | 11 +++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/cmd/micro/eventhandler.go b/cmd/micro/eventhandler.go index 2c5076d1..de718731 100644 --- a/cmd/micro/eventhandler.go +++ b/cmd/micro/eventhandler.go @@ -115,6 +115,7 @@ func (eh *EventHandler) Undo() { te = t.(*TextEvent) + undoThreshold := int64(settings["undothreshold"].(float64)) if startTime-(te.time.UnixNano()/int64(time.Millisecond)) > undoThreshold { return } @@ -166,6 +167,7 @@ func (eh *EventHandler) Redo() { te = t.(*TextEvent) + undoThreshold := int64(settings["undothreshold"].(float64)) if (te.time.UnixNano()/int64(time.Millisecond))-startTime > undoThreshold { return } diff --git a/cmd/micro/micro.go b/cmd/micro/micro.go index 23818c67..cb24bf98 100644 --- a/cmd/micro/micro.go +++ b/cmd/micro/micro.go @@ -17,14 +17,9 @@ import ( ) const ( - // How many lines up to look to do syntax highlighting - synLinesUp = 75 - // How many lines down to look to do syntax highlighting - synLinesDown = 75 - // How many milliseconds to wait before a second click is not a double click - doubleClickThreshold = 400 - // If two events are less than n milliseconds apart, undo both of them - undoThreshold = int(settings["undothreshold"].(float64)) + synLinesUp = 75 // How many lines up to look to do syntax highlighting + synLinesDown = 75 // How many lines down to look to do syntax highlighting + doubleClickThreshold = 400 // How many milliseconds to wait before a second click i not a double click ) var (