Skip to content

Commit

Permalink
Add 'scrollbarchar' option (#2342)
Browse files Browse the repository at this point in the history
This lets you specify a character that will get used for rendering the
scrollbar.

Co-authored-by: Zachary Yedidia <[email protected]>
  • Loading branch information
muesli and zyedidia authored Jul 8, 2023
1 parent 9593c2a commit ffa7f98
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions internal/config/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@ var DefaultGlobalOnlySettings = map[string]interface{}{
"multiopen": "tab",
"parsecursor": false,
"paste": false,
"savehistory": true,
"scrollbarchar": "|",
"sucmd": "sudo",
"pluginchannels": []string{"https://raw.githubusercontent.com/micro-editor/plugin-channel/master/channel.json"},
"pluginrepos": []string{},
"savehistory": true,

Check failure on line 361 in internal/config/settings.go

View workflow job for this annotation

GitHub Actions / test (1.19.x, ubuntu-latest)

duplicate key "savehistory" in map literal
Expand Down
8 changes: 7 additions & 1 deletion internal/display/bufwindow.go
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,14 @@ func (w *BufWindow) displayScrollBar() {
scrollBarStyle = style
}

scrollBarChar := config.GetGlobalOption("scrollbarchar").(string)
if util.CharacterCountInString(scrollBarChar) != 1 {
scrollBarChar = "|"
}
scrollBarRune := []rune(scrollBarChar)

for y := barstart; y < util.Min(barstart+barsize, w.Y+w.bufHeight); y++ {
screen.SetContent(scrollX, y, '|', nil, scrollBarStyle)
screen.SetContent(scrollX, y, scrollBarRune[0], nil, scrollBarStyle)
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions runtime/help/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ Here are the available options:

default value: `false`

* `scrollbarchar`: specifies the character used for displaying the scrollbar

default value: `|`

* `scrollmargin`: margin at which the view starts scrolling when the cursor
approaches the edge of the view.

Expand Down

0 comments on commit ffa7f98

Please sign in to comment.