mirror of
https://github.com/zyedidia/micro.git
synced 2025-06-18 14:55:38 -04:00
Display a tilde before every capital letter for Canute
This commit is contained in:
parent
7ee77d56a6
commit
f61dd7a894
@ -2,6 +2,7 @@ package display
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"unicode"
|
||||||
|
|
||||||
runewidth "github.com/mattn/go-runewidth"
|
runewidth "github.com/mattn/go-runewidth"
|
||||||
"github.com/zyedidia/micro/v2/internal/buffer"
|
"github.com/zyedidia/micro/v2/internal/buffer"
|
||||||
@ -624,8 +625,12 @@ func (w *BufWindow) displayBuffer() {
|
|||||||
width = util.Min(ts, maxWidth-vloc.X)
|
width = util.Min(ts, maxWidth-vloc.X)
|
||||||
totalwidth += ts
|
totalwidth += ts
|
||||||
default:
|
default:
|
||||||
width = runewidth.RuneWidth(r)
|
if unicode.IsUpper(r) {
|
||||||
totalwidth += width
|
width = 2
|
||||||
|
} else {
|
||||||
|
width = runewidth.RuneWidth(r)
|
||||||
|
totalwidth += width
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
word = append(word, glyph{r, combc, curStyle, width})
|
word = append(word, glyph{r, combc, curStyle, width})
|
||||||
@ -658,17 +663,22 @@ func (w *BufWindow) displayBuffer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, r := range word {
|
for _, r := range word {
|
||||||
draw(r.r, r.combc, r.style, true, true)
|
if unicode.IsUpper(r.r) {
|
||||||
|
draw('~', nil, r.style, true, true)
|
||||||
|
draw(r.r, r.combc, r.style, true, false)
|
||||||
|
} else {
|
||||||
|
draw(r.r, r.combc, r.style, true, true)
|
||||||
|
|
||||||
// Draw any extra characters either spaces for tabs or @ for incomplete wide runes
|
// Draw any extra characters either spaces for tabs or @ for incomplete wide runes
|
||||||
if r.width > 1 {
|
if r.width > 1 {
|
||||||
char := ' '
|
char := ' '
|
||||||
if r.r != '\t' {
|
if r.r != '\t' {
|
||||||
char = '@'
|
char = '@'
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 1; i < r.width; i++ {
|
for i := 1; i < r.width; i++ {
|
||||||
draw(char, nil, r.style, true, false)
|
draw(char, nil, r.style, true, false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bloc.X++
|
bloc.X++
|
||||||
|
Loading…
Reference in New Issue
Block a user