mirror of
https://github.com/zyedidia/micro.git
synced 2024-10-28 05:21:40 +03:00
Add cursorline option
This commit is contained in:
parent
98b006d0be
commit
742370646f
File diff suppressed because one or more lines are too long
@ -74,6 +74,7 @@ func DefaultSettings() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"autoindent": true,
|
||||
"colorscheme": "default",
|
||||
"cursorline": false,
|
||||
"ignorecase": false,
|
||||
"indentchar": " ",
|
||||
"ruler": true,
|
||||
|
@ -559,6 +559,13 @@ func (v *View) DisplayView() {
|
||||
lineStyle = highlightStyle
|
||||
}
|
||||
|
||||
if settings["cursorline"].(bool) && v.Cursor.Y == lineN+v.Topline {
|
||||
if style, ok := colorscheme["cursor-line"]; ok {
|
||||
fg, _, _ := style.Decompose()
|
||||
lineStyle = lineStyle.Background(fg)
|
||||
}
|
||||
}
|
||||
|
||||
if ch == '\t' {
|
||||
lineIndentStyle := defStyle
|
||||
if style, ok := colorscheme["indent-char"]; ok {
|
||||
@ -574,6 +581,12 @@ func (v *View) DisplayView() {
|
||||
lineIndentStyle = style
|
||||
}
|
||||
}
|
||||
if settings["cursorline"].(bool) && v.Cursor.Y == lineN+v.Topline {
|
||||
if style, ok := colorscheme["cursor-line"]; ok {
|
||||
fg, _, _ := style.Decompose()
|
||||
lineIndentStyle = lineIndentStyle.Background(fg)
|
||||
}
|
||||
}
|
||||
indentChar := []rune(settings["indentchar"].(string))
|
||||
screen.SetContent(x-v.leftCol, lineN, indentChar[0], nil, lineIndentStyle)
|
||||
tabSize := int(settings["tabsize"].(float64))
|
||||
@ -610,7 +623,14 @@ func (v *View) DisplayView() {
|
||||
charNum++
|
||||
|
||||
for i := 0; i < v.width-x; i++ {
|
||||
screen.SetContent(x+i, lineN, ' ', nil, defStyle)
|
||||
lineStyle := tcell.StyleDefault
|
||||
if settings["cursorline"].(bool) && v.Cursor.Y == lineN+v.Topline {
|
||||
if style, ok := colorscheme["cursor-line"]; ok {
|
||||
fg, _, _ := style.Decompose()
|
||||
lineStyle = lineStyle.Background(fg)
|
||||
}
|
||||
}
|
||||
screen.SetContent(x+i, lineN, ' ', nil, lineStyle)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,3 +12,4 @@ color-link indent-char "black"
|
||||
color-link line-number "yellow"
|
||||
color-link gutter-error ",red"
|
||||
color-link gutter-warning "red"
|
||||
color-link cursor-line "white"
|
||||
|
@ -14,3 +14,4 @@ color-link indent-char "#586E75,#002833"
|
||||
color-link line-number "#586E75,#003541"
|
||||
color-link gutter-error "#003541,#CB4B16"
|
||||
color-link gutter-warning "#CB4B16,#002833"
|
||||
color-link cursor-line "#003541"
|
||||
|
@ -13,3 +13,4 @@ color-link indent-char "black"
|
||||
color-link line-number "brightgreen,black"
|
||||
color-link gutter-error "black,brightred"
|
||||
color-link gutter-warning "brightred,default"
|
||||
color-link cursor-line "black"
|
||||
|
@ -184,6 +184,11 @@ Here are the options that you can set:
|
||||
|
||||
default value: `on`
|
||||
|
||||
* `cursorline`: highlight the line that the cursor is on in a different color
|
||||
(the color is defined by the colorscheme you are using)
|
||||
|
||||
default value: `off`
|
||||
|
||||
* `ruler`: display line numbers
|
||||
|
||||
default value: `on`
|
||||
|
Loading…
Reference in New Issue
Block a user