mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-05 06:30:28 +09:00
Add fakecursor option
When 'fakecursor' is enabled micro will use a "fake" block to display the cursor instead of the terminal's cursor. Closes #2698 Closes #2703
This commit is contained in:
@@ -331,6 +331,7 @@ var DefaultGlobalOnlySettings = map[string]interface{}{
|
||||
"colorscheme": "default",
|
||||
"divchars": "|-",
|
||||
"divreverse": true,
|
||||
"fakecursor": false,
|
||||
"infobar": true,
|
||||
"keymenu": false,
|
||||
"mouse": true,
|
||||
|
||||
@@ -79,6 +79,10 @@ func ShowFakeCursor(x, y int) {
|
||||
lastCursor.style = style
|
||||
}
|
||||
|
||||
func UseFake() bool {
|
||||
return util.FakeCursor || config.GetGlobalOption("fakecursor").(bool)
|
||||
}
|
||||
|
||||
// ShowFakeCursorMulti is the same as ShowFakeCursor except it does not
|
||||
// reset previous locations of the cursor
|
||||
// Fake cursors are also necessary to display multiple cursors
|
||||
@@ -91,7 +95,7 @@ func ShowFakeCursorMulti(x, y int) {
|
||||
// if enabled or using the terminal cursor otherwise
|
||||
// By default only the windows console will use a fake cursor
|
||||
func ShowCursor(x, y int) {
|
||||
if util.FakeCursor {
|
||||
if UseFake() {
|
||||
ShowFakeCursor(x, y)
|
||||
} else {
|
||||
Screen.ShowCursor(x, y)
|
||||
@@ -106,7 +110,7 @@ func SetContent(x, y int, mainc rune, combc []rune, style tcell.Style) {
|
||||
}
|
||||
|
||||
Screen.SetContent(x, y, mainc, combc, style)
|
||||
if util.FakeCursor && lastCursor.x == x && lastCursor.y == y {
|
||||
if UseFake() && lastCursor.x == x && lastCursor.y == y {
|
||||
lastCursor.r = mainc
|
||||
lastCursor.style = style
|
||||
lastCursor.combc = combc
|
||||
|
||||
Reference in New Issue
Block a user