]> git.lizzy.rs Git - micro.git/blobdiff - cmd/micro/micro.go
OutdentSelection works on all cases (whatever tabsize or tabstospace values)
[micro.git] / cmd / micro / micro.go
index f2c1e4668aca7832d09f4dca776ca0faa9eb2db4..d4668508448159a4d1bef9914d925edc0ab681d2 100644 (file)
@@ -21,8 +21,6 @@ import (
 )
 
 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 is not a double click
        undoThreshold        = 500 // If two events are less than n milliseconds apart, undo both of them
        autosaveTime         = 8   // Number of seconds to wait before autosaving
@@ -183,6 +181,10 @@ func InitScreen() {
        screen, err = tcell.NewScreen()
        if err != nil {
                fmt.Println(err)
+               if err == tcell.ErrTermNotFound {
+                       fmt.Println("Micro does not recognize your terminal:", oldTerm)
+                       fmt.Println("Please go to https://github.com/zyedidia/mkinfo to read about how to fix this problem (it should be easy to fix).")
+               }
                os.Exit(1)
        }
        if err = screen.Init(); err != nil {
@@ -248,6 +250,7 @@ func main() {
        flag.Usage = func() {
                fmt.Println("Usage: micro [OPTIONS] [FILE]...")
                fmt.Print("Micro's options can be set via command line arguments for quick adjustments. For real configuration, please use the bindings.json file (see 'help options').\n\n")
+               flag.CommandLine.SetOutput(os.Stdout)
                flag.PrintDefaults()
        }
 
@@ -307,7 +310,6 @@ func main() {
        // This is used for sending the user messages in the bottom of the editor
        messenger = new(Messenger)
        messenger.history = make(map[string][]string)
-       InitColorscheme()
 
        // Now we load the input
        buffers := LoadInput()
@@ -399,10 +401,14 @@ func main() {
                }
        }
 
+       InitColorscheme()
+
        // Here is the event loop which runs in a separate thread
        go func() {
                for {
-                       events <- screen.PollEvent()
+                       if screen != nil {
+                               events <- screen.PollEvent()
+                       }
                }
        }()