diff --git a/internal/config/settings.go b/internal/config/settings.go index 2f8158334f..800d2d1413 100644 --- a/internal/config/settings.go +++ b/internal/config/settings.go @@ -115,7 +115,7 @@ var DefaultGlobalOnlySettings = map[string]any{ "colorscheme": "default", "divchars": "|-", "divreverse": true, - "fakecursor": false, + "fakecursor": defaultFakeCursor(), "helpsplit": "hsplit", "infobar": true, "keymenu": false, @@ -441,6 +441,15 @@ func defaultFileFormat() string { return "unix" } +func defaultFakeCursor() bool { + _, wt := os.LookupEnv("WT_SESSION") + if runtime.GOOS == "windows" && !wt { + // enabled for windows consoles where the cursor is slow + return true + } + return false +} + func GetInfoBarOffset() int { offset := 0 if GetGlobalOption("infobar").(bool) { diff --git a/internal/screen/screen.go b/internal/screen/screen.go index f8f9136161..a0bd93eb35 100644 --- a/internal/screen/screen.go +++ b/internal/screen/screen.go @@ -8,7 +8,6 @@ import ( "github.com/micro-editor/tcell/v2" "github.com/zyedidia/micro/v2/internal/config" - "github.com/zyedidia/micro/v2/internal/util" ) // Screen is the tcell screen we use to draw to the terminal @@ -90,7 +89,7 @@ func ShowFakeCursor(x, y int) { } func UseFake() bool { - return util.FakeCursor || config.GetGlobalOption("fakecursor").(bool) + return config.GetGlobalOption("fakecursor").(bool) } // ShowFakeCursorMulti is the same as ShowFakeCursor except it does not diff --git a/internal/util/util.go b/internal/util/util.go index e0ae62f287..cad6374349 100644 --- a/internal/util/util.go +++ b/internal/util/util.go @@ -38,9 +38,6 @@ var ( CompileDate = "Unknown" // Debug logging Debug = "OFF" - // FakeCursor is used to disable the terminal cursor and have micro - // draw its own (enabled for windows consoles where the cursor is slow) - FakeCursor = false // Stdout is a buffer that is written to stdout when micro closes Stdout *bytes.Buffer @@ -93,10 +90,6 @@ func init() { fmt.Println("Invalid version: ", Version, err) } - _, wt := os.LookupEnv("WT_SESSION") - if runtime.GOOS == "windows" && !wt { - FakeCursor = true - } Stdout = new(bytes.Buffer) } diff --git a/runtime/help/options.md b/runtime/help/options.md index d4832c5d08..85f25e8b38 100644 --- a/runtime/help/options.md +++ b/runtime/help/options.md @@ -133,6 +133,8 @@ Here are the available options: * `fakecursor`: forces micro to render the cursor using terminal colors rather than the actual terminal cursor. This is useful when the terminal's cursor is slow or otherwise unavailable/undesirable to use. + Note: This option defaults to `true` in case `micro` is used in the legacy + Windows Console. default value: `false`