mirror of
https://github.com/Hopiu/micro.git
synced 2026-04-04 23:20:37 +00:00
Remove undo options, make stackundo default behavior
This commit is contained in:
parent
007ece1e78
commit
1806ef3ad0
4 changed files with 13 additions and 26 deletions
|
|
@ -115,13 +115,10 @@ func (eh *EventHandler) Undo() {
|
|||
|
||||
te = t.(*TextEvent)
|
||||
|
||||
undoThreshold := int64(settings["undothreshold"].(float64))
|
||||
if startTime-(te.time.UnixNano()/int64(time.Millisecond)) > undoThreshold {
|
||||
return
|
||||
} else {
|
||||
if settings["stackundo"] == true {
|
||||
startTime = t.(*TextEvent).time.UnixNano() / int64(time.Millisecond)
|
||||
}
|
||||
startTime = t.(*TextEvent).time.UnixNano() / int64(time.Millisecond)
|
||||
}
|
||||
|
||||
eh.UndoOneEvent()
|
||||
|
|
@ -171,7 +168,6 @@ func (eh *EventHandler) Redo() {
|
|||
|
||||
te = t.(*TextEvent)
|
||||
|
||||
undoThreshold := int64(settings["undothreshold"].(float64))
|
||||
if (te.time.UnixNano()/int64(time.Millisecond))-startTime > undoThreshold {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ const (
|
|||
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
|
||||
undoThreshold = 500 // If two events are less than n milliseconds apart, undo both of them
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
|||
|
|
@ -72,19 +72,17 @@ func GetOption(name string) interface{} {
|
|||
// DefaultSettings returns the default settings for micro
|
||||
func DefaultSettings() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"autoindent": true,
|
||||
"colorscheme": "default",
|
||||
"ignorecase": false,
|
||||
"indentchar": " ",
|
||||
"ruler": true,
|
||||
"scrollspeed": float64(2),
|
||||
"scrollmargin": float64(3),
|
||||
"stackundo": false,
|
||||
"statusline": true,
|
||||
"syntax": true,
|
||||
"tabsize": float64(4),
|
||||
"tabstospaces": false,
|
||||
"undothreshold": float64(500),
|
||||
"autoindent": true,
|
||||
"colorscheme": "default",
|
||||
"ignorecase": false,
|
||||
"indentchar": " ",
|
||||
"ruler": true,
|
||||
"scrollspeed": float64(2),
|
||||
"scrollmargin": float64(3),
|
||||
"statusline": true,
|
||||
"syntax": true,
|
||||
"tabsize": float64(4),
|
||||
"tabstospaces": false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -203,18 +203,10 @@ Here are the options that you can set:
|
|||
|
||||
default value: `on`
|
||||
|
||||
* `undothreshold`: maximum time in milliseconds events can be apart to be counted as a single undo
|
||||
|
||||
default value: `500`
|
||||
|
||||
* `statusline`: display the status line at the bottom of the screen
|
||||
|
||||
default value: `on`
|
||||
|
||||
* `stackundo`: reset undothreshold timer to zero if an action is taken before the timer runs out
|
||||
|
||||
default value: `off`
|
||||
|
||||
* `scrollmargin`: amount of lines you would like to see above and below the cursor
|
||||
|
||||
default value: `3`
|
||||
|
|
|
|||
Loading…
Reference in a new issue