Update Dependencies (#390)
Co-authored-by: Norwin Roosen <git@nroo.de> Co-authored-by: Norwin <git@nroo.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/390 Reviewed-by: 6543 <6543@obermui.de> Reviewed-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Norwin <noerw@noreply.gitea.io> Co-committed-by: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
20
vendor/github.com/muesli/reflow/wordwrap/wordwrap.go
generated
vendored
20
vendor/github.com/muesli/reflow/wordwrap/wordwrap.go
generated
vendored
@@ -46,7 +46,7 @@ func NewWriter(limit int) *WordWrap {
|
||||
func Bytes(b []byte, limit int) []byte {
|
||||
f := NewWriter(limit)
|
||||
_, _ = f.Write(b)
|
||||
f.Close()
|
||||
_ = f.Close()
|
||||
|
||||
return f.Bytes()
|
||||
}
|
||||
@@ -59,7 +59,7 @@ func String(s string, limit int) string {
|
||||
|
||||
func (w *WordWrap) addSpace() {
|
||||
w.lineLen += w.space.Len()
|
||||
w.buf.Write(w.space.Bytes())
|
||||
_, _ = w.buf.Write(w.space.Bytes())
|
||||
w.space.Reset()
|
||||
}
|
||||
|
||||
@@ -67,13 +67,13 @@ func (w *WordWrap) addWord() {
|
||||
if w.word.Len() > 0 {
|
||||
w.addSpace()
|
||||
w.lineLen += w.word.PrintableRuneWidth()
|
||||
w.buf.Write(w.word.Bytes())
|
||||
_, _ = w.buf.Write(w.word.Bytes())
|
||||
w.word.Reset()
|
||||
}
|
||||
}
|
||||
|
||||
func (w *WordWrap) addNewLine() {
|
||||
w.buf.WriteRune('\n')
|
||||
_, _ = w.buf.WriteRune('\n')
|
||||
w.lineLen = 0
|
||||
w.space.Reset()
|
||||
}
|
||||
@@ -101,10 +101,10 @@ func (w *WordWrap) Write(b []byte) (int, error) {
|
||||
for _, c := range s {
|
||||
if c == '\x1B' {
|
||||
// ANSI escape sequence
|
||||
w.word.WriteRune(c)
|
||||
_, _ = w.word.WriteRune(c)
|
||||
w.ansi = true
|
||||
} else if w.ansi {
|
||||
w.word.WriteRune(c)
|
||||
_, _ = w.word.WriteRune(c)
|
||||
if (c >= 0x40 && c <= 0x5a) || (c >= 0x61 && c <= 0x7a) {
|
||||
// ANSI sequence terminated
|
||||
w.ansi = false
|
||||
@@ -117,7 +117,7 @@ func (w *WordWrap) Write(b []byte) (int, error) {
|
||||
w.lineLen = 0
|
||||
} else {
|
||||
// preserve whitespace
|
||||
w.buf.Write(w.space.Bytes())
|
||||
_, _ = w.buf.Write(w.space.Bytes())
|
||||
}
|
||||
w.space.Reset()
|
||||
}
|
||||
@@ -127,15 +127,15 @@ func (w *WordWrap) Write(b []byte) (int, error) {
|
||||
} else if unicode.IsSpace(c) {
|
||||
// end of current word
|
||||
w.addWord()
|
||||
w.space.WriteRune(c)
|
||||
_, _ = w.space.WriteRune(c)
|
||||
} else if inGroup(w.Breakpoints, c) {
|
||||
// valid breakpoint
|
||||
w.addSpace()
|
||||
w.addWord()
|
||||
w.buf.WriteRune(c)
|
||||
_, _ = w.buf.WriteRune(c)
|
||||
} else {
|
||||
// any other character
|
||||
w.word.WriteRune(c)
|
||||
_, _ = w.word.WriteRune(c)
|
||||
|
||||
// add a line break if the current word would exceed the line's
|
||||
// character limit
|
||||
|
||||
Reference in New Issue
Block a user