mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-04 14:10:23 +09:00
config: Don't hardcode the fakecursor under Windows console any longer (#3959)
* config: Don't hardcode the `fakecursor` under Windows console any longer We just set the global default and allow the user to override it. * help: Add a concrete note for the `fakecursor` option in the Windows Console
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user