make undothresthold a setting (part 2)

This commit is contained in:
Camille Scholtz
2016-05-24 21:40:05 +02:00
parent 3da2a870b6
commit e553815501
2 changed files with 5 additions and 8 deletions

View File

@@ -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
}

View File

@@ -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 (