Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion internal/config/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ var DefaultGlobalOnlySettings = map[string]any{
"colorscheme": "default",
"divchars": "|-",
"divreverse": true,
"fakecursor": false,
"fakecursor": defaultFakeCursor(),
"helpsplit": "hsplit",
"infobar": true,
"keymenu": false,
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions internal/screen/screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions internal/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

Expand Down
2 changes: 2 additions & 0 deletions runtime/help/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down