From a945c39c7715d733598a24aada56884f1921b843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6ran=20Karl?= <3951388+JoeKar@users.noreply.github.com> Date: Sun, 4 Jan 2026 14:42:16 +0100 Subject: [PATCH 1/2] config: Don't hardcode the `fakecursor` under Windows console any longer We just set the global default and allow the user to override it. --- internal/config/settings.go | 11 ++++++++++- internal/screen/screen.go | 3 +-- internal/util/util.go | 7 ------- 3 files changed, 11 insertions(+), 10 deletions(-) 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) } From dcbf51be6491db53b44c3bd07af747191164441e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6ran=20Karl?= <3951388+JoeKar@users.noreply.github.com> Date: Mon, 5 Jan 2026 18:59:39 +0100 Subject: [PATCH 2/2] help: Add a concrete note for the `fakecursor` option in the Windows Console --- runtime/help/options.md | 2 ++ 1 file changed, 2 insertions(+) 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`