Add colorcolumn option

Fixes #333

For example: `> set colorcolumn 80`.
This commit is contained in:
Zachary Yedidia 2016-09-07 17:17:51 -04:00
parent dc8207149b
commit 8f06e51170
13 changed files with 37 additions and 11 deletions

File diff suppressed because one or more lines are too long

View file

@ -165,6 +165,7 @@ func GetOption(name string) interface{} {
func DefaultGlobalSettings() map[string]interface{} {
return map[string]interface{}{
"autoindent": true,
"colorcolumn": float64(0),
"colorscheme": "zenburn",
"cursorline": true,
"ignorecase": false,
@ -187,6 +188,7 @@ func DefaultGlobalSettings() map[string]interface{} {
func DefaultLocalSettings() map[string]interface{} {
return map[string]interface{}{
"autoindent": true,
"colorcolumn": float64(0),
"cursorline": true,
"filetype": "Unknown",
"ignorecase": false,

View file

@ -806,7 +806,16 @@ func (v *View) DisplayView() {
}
}
if screenX-v.x-v.leftCol+i >= v.lineNumOffset {
v.drawCell(screenX-v.leftCol+i, screenY, ' ', nil, lineStyle)
colorcolumn := int(v.Buf.Settings["colorcolumn"].(float64))
if colorcolumn != 0 && screenX-v.leftCol+i == colorcolumn-1 {
if style, ok := colorscheme["color-column"]; ok {
fg, _, _ := style.Decompose()
lineStyle = lineStyle.Background(fg)
}
v.drawCell(screenX-v.leftCol+i, screenY, ' ', nil, lineStyle)
} else {
v.drawCell(screenX-v.leftCol+i, screenY, ' ', nil, lineStyle)
}
}
}
}

View file

@ -17,3 +17,4 @@ color-link current-line-number "#656866,#1D1F21"
color-link gutter-error "#FF4444,#1D1F21"
color-link gutter-warning "#EEEE77,#1D1F21"
color-link cursor-line "#2D2F31"
color-link color-column "#2D2F31"

View file

@ -17,3 +17,4 @@ color-link gutter-error "197,231"
color-link gutter-warning "134,231"
color-link line-number "246,254"
color-link cursor-line "254"
color-link color-column "254"

View file

@ -13,3 +13,4 @@ color-link todo "bold 223,235"
color-link line-number "243,237"
color-link current-line-number "172,237"
color-link cursor-line "237"
color-link color-column "237"

View file

@ -17,3 +17,4 @@ color-link current-line-number "#AAAAAA,#282828"
color-link gutter-error "#CB4B16,#282828"
color-link gutter-warning "#E6DB74,#282828"
color-link cursor-line "#323232"
color-link color-column "#323232"

View file

@ -14,3 +14,4 @@ color-link current-line-number "red"
color-link gutter-error ",red"
color-link gutter-warning "red"
color-link cursor-line "white"
color-link color-column "white"

View file

@ -16,3 +16,4 @@ color-link current-line-number "#586E75,#002833"
color-link gutter-error "#003541,#CB4B16"
color-link gutter-warning "#CB4B16,#002833"
color-link cursor-line "#003541"
color-link color-column "#003541"

View file

@ -15,3 +15,4 @@ color-link current-line-number "brightgreen,default"
color-link gutter-error "black,brightred"
color-link gutter-warning "brightred,default"
color-link cursor-line "black"
color-link color-column "black"

View file

@ -17,4 +17,5 @@ color-link line-number "248,238"
color-link gutter-error "237,174"
color-link gutter-warning "174,237"
color-link cursor-line "238"
color-link color-column "238"
color-link current-line-number "188,237"

View file

@ -108,6 +108,8 @@ Here is a list of the colorscheme groups that you can use:
* gutter-error
* gutter-warning
* cursor-line
* current-line-number
* color-column
Colorschemes can be placed in the `~/.config/micro/colorschemes` directory to be used.

View file

@ -23,6 +23,11 @@ Here are the options that you can set:
You can read more about micro's colorschemes in the `colors` help topic
(`help colors`).
* `colorcolumn`: if this is not set to 0, it will display a column at the specified
column. This is useful if you want column 80 to be highlighted special for example.
default value: `0`
* `tabsize`: sets the tab size to `option`
default value: `4`