Update some dependencies
This commit is contained in:
parent
14903e0cdc
commit
bedb9979a9
8
Gopkg.lock
generated
8
Gopkg.lock
generated
@ -29,7 +29,7 @@
|
||||
branch = "master"
|
||||
name = "github.com/lucasb-eyer/go-colorful"
|
||||
packages = ["."]
|
||||
revision = "231272389856c976b7500c4fffcc52ddf06ff4eb"
|
||||
revision = "fa0f842f26263fb2ace6d6118309c8481e029fc1"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/mattn/go-runewidth"
|
||||
@ -88,7 +88,7 @@
|
||||
"html",
|
||||
"html/atom"
|
||||
]
|
||||
revision = "f73e4c9ed3b7ebdd5f699a16a880c2b1994e50dd"
|
||||
revision = "9ef9f5bb98a1fdc41f8cf6c250a4404b4085e389"
|
||||
|
||||
[[projects]]
|
||||
name = "golang.org/x/text"
|
||||
@ -124,7 +124,7 @@
|
||||
branch = "master"
|
||||
name = "maunium.net/go/gomatrix"
|
||||
packages = ["."]
|
||||
revision = "4ddf8d780ff6a0434a52c256015f7fcd2ca67dc9"
|
||||
revision = "b491397f18b90e34ef54b8b3598666564b90b01a"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@ -139,7 +139,7 @@
|
||||
branch = "master"
|
||||
name = "maunium.net/go/tview"
|
||||
packages = ["."]
|
||||
revision = "7eabba90a261a481d36ace89daa79c56582238d7"
|
||||
revision = "8b261597bbdb95dcaef03854aaa0cc192f56b1ff"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
|
2
vendor/github.com/lucasb-eyer/go-colorful/README.md
generated
vendored
2
vendor/github.com/lucasb-eyer/go-colorful/README.md
generated
vendored
@ -308,7 +308,7 @@ second is the fast one.
|
||||
![Warm, fast warm, happy and fast happy random colors, respectively.](doc/colorgens/colorgens.png)
|
||||
|
||||
Don't forget to initialize the random seed! You can see the code used for
|
||||
generating this picture in `doc/colorgens/golorgens.go`.
|
||||
generating this picture in `doc/colorgens/colorgens.go`.
|
||||
|
||||
### Getting random palettes
|
||||
As soon as you need to generate more than one random color, you probably want
|
||||
|
1
vendor/maunium.net/go/gomatrix/events.go
generated
vendored
1
vendor/maunium.net/go/gomatrix/events.go
generated
vendored
@ -14,6 +14,7 @@ type Event struct {
|
||||
ID string `json:"event_id"` // The unique ID of this event
|
||||
RoomID string `json:"room_id"` // The room the event was sent to. May be nil (e.g. for presence)
|
||||
Content map[string]interface{} `json:"content"` // The JSON content of the event.
|
||||
Redacts string `json:"redacts,omitempty"` // The event ID that was redacted if a m.room.redaction event
|
||||
Unsigned Unsigned `json:"unsigned,omitempty"` // Unsigned content set by own homeserver.
|
||||
}
|
||||
|
||||
|
1
vendor/maunium.net/go/tview/application.go
generated
vendored
1
vendor/maunium.net/go/tview/application.go
generated
vendored
@ -277,6 +277,7 @@ func (a *Application) Suspend(f func()) bool {
|
||||
a.Unlock()
|
||||
panic(err)
|
||||
}
|
||||
a.screen.EnableMouse()
|
||||
a.Unlock()
|
||||
a.Draw()
|
||||
|
||||
|
2
vendor/maunium.net/go/tview/dropdown.go
generated
vendored
2
vendor/maunium.net/go/tview/dropdown.go
generated
vendored
@ -190,7 +190,7 @@ func (d *DropDown) GetFieldWidth() int {
|
||||
// callback is called when this option was selected. It may be nil.
|
||||
func (d *DropDown) AddOption(text string, selected func()) *DropDown {
|
||||
d.options = append(d.options, &dropDownOption{Text: text, Selected: selected})
|
||||
d.list.AddItem(text, "", 0, selected)
|
||||
d.list.AddItem(text, "", 0, nil)
|
||||
return d
|
||||
}
|
||||
|
||||
|
44
vendor/maunium.net/go/tview/inputfield.go
generated
vendored
44
vendor/maunium.net/go/tview/inputfield.go
generated
vendored
@ -248,40 +248,18 @@ func (i *InputField) Draw(screen tcell.Screen) {
|
||||
text := i.text
|
||||
if text == "" && i.placeholder != "" {
|
||||
Print(screen, i.placeholder, x, y, fieldWidth, AlignLeft, i.placeholderTextColor)
|
||||
}
|
||||
|
||||
// Draw entered text.
|
||||
if i.maskCharacter > 0 {
|
||||
text = strings.Repeat(string(i.maskCharacter), utf8.RuneCountInString(i.text))
|
||||
}
|
||||
fieldWidth-- // We need one cell for the cursor.
|
||||
if fieldWidth < runewidth.StringWidth(text) {
|
||||
runes := []rune(text)
|
||||
for pos := len(runes) - 1; pos >= 0; pos-- {
|
||||
ch := runes[pos]
|
||||
w := runewidth.RuneWidth(ch)
|
||||
if fieldWidth-w < 0 {
|
||||
break
|
||||
}
|
||||
_, _, style, _ := screen.GetContent(x+fieldWidth-w, y)
|
||||
style = style.Foreground(i.fieldTextColor)
|
||||
for w > 0 {
|
||||
fieldWidth--
|
||||
screen.SetContent(x+fieldWidth, y, ch, nil, style)
|
||||
w--
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pos := 0
|
||||
for _, ch := range text {
|
||||
w := runewidth.RuneWidth(ch)
|
||||
_, _, style, _ := screen.GetContent(x+pos, y)
|
||||
style = style.Foreground(i.fieldTextColor)
|
||||
for w > 0 {
|
||||
screen.SetContent(x+pos, y, ch, nil, style)
|
||||
pos++
|
||||
w--
|
||||
}
|
||||
// Draw entered text.
|
||||
if i.maskCharacter > 0 {
|
||||
text = strings.Repeat(string(i.maskCharacter), utf8.RuneCountInString(i.text))
|
||||
} else {
|
||||
text = Escape(text)
|
||||
}
|
||||
fieldWidth-- // We need one cell for the cursor.
|
||||
if fieldWidth < runewidth.StringWidth(text) {
|
||||
Print(screen, text, x, y, fieldWidth, AlignRight, i.fieldTextColor)
|
||||
} else {
|
||||
Print(screen, text, x, y, fieldWidth, AlignLeft, i.fieldTextColor)
|
||||
}
|
||||
}
|
||||
|
||||
|
18
vendor/maunium.net/go/tview/list.go
generated
vendored
18
vendor/maunium.net/go/tview/list.go
generated
vendored
@ -222,8 +222,8 @@ func (l *List) Draw(screen tcell.Screen) {
|
||||
// We want to keep the current selection in view. What is our offset?
|
||||
var offset int
|
||||
if l.showSecondaryText {
|
||||
if l.currentItem >= height/2 {
|
||||
offset = l.currentItem + 1 - (height / 2)
|
||||
if 2*l.currentItem >= height {
|
||||
offset = (2*l.currentItem + 2 - height) / 2
|
||||
}
|
||||
} else {
|
||||
if l.currentItem >= height {
|
||||
@ -296,12 +296,14 @@ func (l *List) InputHandler() func(event *tcell.EventKey, setFocus func(p Primit
|
||||
case tcell.KeyPgUp:
|
||||
l.currentItem -= 5
|
||||
case tcell.KeyEnter:
|
||||
item := l.items[l.currentItem]
|
||||
if item.Selected != nil {
|
||||
item.Selected()
|
||||
}
|
||||
if l.selected != nil {
|
||||
l.selected(l.currentItem, item.MainText, item.SecondaryText, item.Shortcut)
|
||||
if l.currentItem >= 0 && l.currentItem < len(l.items) {
|
||||
item := l.items[l.currentItem]
|
||||
if item.Selected != nil {
|
||||
item.Selected()
|
||||
}
|
||||
if l.selected != nil {
|
||||
l.selected(l.currentItem, item.MainText, item.SecondaryText, item.Shortcut)
|
||||
}
|
||||
}
|
||||
case tcell.KeyEscape:
|
||||
if l.done != nil {
|
||||
|
24
vendor/maunium.net/go/tview/table.go
generated
vendored
24
vendor/maunium.net/go/tview/table.go
generated
vendored
@ -33,6 +33,9 @@ type TableCell struct {
|
||||
// The background color of the cell.
|
||||
BackgroundColor tcell.Color
|
||||
|
||||
// The style attributes of the cell.
|
||||
Attributes tcell.AttrMask
|
||||
|
||||
// If set to true, this cell cannot be selected.
|
||||
NotSelectable bool
|
||||
|
||||
@ -107,6 +110,22 @@ func (c *TableCell) SetBackgroundColor(color tcell.Color) *TableCell {
|
||||
return c
|
||||
}
|
||||
|
||||
// SetAttributes sets the cell's text attributes. You can combine different
|
||||
// attributes using bitmask operations:
|
||||
//
|
||||
// cell.SetAttributes(tcell.AttrUnderline | tcell.AttrBold)
|
||||
func (c *TableCell) SetAttributes(attr tcell.AttrMask) *TableCell {
|
||||
c.Attributes = attr
|
||||
return c
|
||||
}
|
||||
|
||||
// SetStyle sets the cell's style (foreground color, background color, and
|
||||
// attributes) all at once.
|
||||
func (c *TableCell) SetStyle(style tcell.Style) *TableCell {
|
||||
c.Color, c.BackgroundColor, c.Attributes = style.Decompose()
|
||||
return c
|
||||
}
|
||||
|
||||
// SetSelectable sets whether or not this cell can be selected by the user.
|
||||
func (c *TableCell) SetSelectable(selectable bool) *TableCell {
|
||||
c.NotSelectable = !selectable
|
||||
@ -684,11 +703,10 @@ ColumnLoop:
|
||||
finalWidth = width - columnX - 1
|
||||
}
|
||||
cell.x, cell.y, cell.width = x+columnX+1, y+rowY, finalWidth
|
||||
_, printed := Print(screen, cell.Text, x+columnX+1, y+rowY, finalWidth, cell.Align, cell.Color)
|
||||
_, printed := printWithStyle(screen, cell.Text, x+columnX+1, y+rowY, finalWidth, cell.Align, tcell.StyleDefault.Foreground(cell.Color)|tcell.Style(cell.Attributes))
|
||||
if StringWidth(cell.Text)-printed > 0 && printed > 0 {
|
||||
_, _, style, _ := screen.GetContent(x+columnX+1+finalWidth-1, y+rowY)
|
||||
fg, _, _ := style.Decompose()
|
||||
Print(screen, string(GraphicsEllipsis), x+columnX+1+finalWidth-1, y+rowY, 1, AlignLeft, fg)
|
||||
printWithStyle(screen, string(GraphicsEllipsis), x+columnX+1+finalWidth-1, y+rowY, 1, AlignLeft, style)
|
||||
}
|
||||
}
|
||||
|
||||
|
128
vendor/maunium.net/go/tview/textview.go
generated
vendored
128
vendor/maunium.net/go/tview/textview.go
generated
vendored
@ -769,50 +769,11 @@ func (t *TextView) Draw(screen tcell.Screen) {
|
||||
}
|
||||
|
||||
// Print the line.
|
||||
var currentTag, currentRegion, currentEscapeTag, skipped int
|
||||
for pos, ch := range text {
|
||||
// Get the color.
|
||||
if currentTag < len(colorTags) && pos >= colorTagIndices[currentTag][0] && pos < colorTagIndices[currentTag][1] {
|
||||
if pos == colorTagIndices[currentTag][1]-1 {
|
||||
foregroundColor, backgroundColor, attributes = styleFromTag(foregroundColor, backgroundColor, attributes, colorTags[currentTag])
|
||||
currentTag++
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
// Get the region.
|
||||
if currentRegion < len(regionIndices) && pos >= regionIndices[currentRegion][0] && pos < regionIndices[currentRegion][1] {
|
||||
if pos == regionIndices[currentRegion][1]-1 {
|
||||
regionID = regions[currentRegion][1]
|
||||
currentRegion++
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
// Skip the second-to-last character of an escape tag.
|
||||
if currentEscapeTag < len(escapeIndices) && pos >= escapeIndices[currentEscapeTag][0] && pos < escapeIndices[currentEscapeTag][1] {
|
||||
if pos == escapeIndices[currentEscapeTag][1]-1 {
|
||||
currentEscapeTag++
|
||||
} else if pos == escapeIndices[currentEscapeTag][1]-2 {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// Determine the width of this rune.
|
||||
chWidth := runewidth.RuneWidth(ch)
|
||||
if chWidth == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
// Skip to the right.
|
||||
if !t.wrap && skipped < skip {
|
||||
skipped += chWidth
|
||||
continue
|
||||
}
|
||||
|
||||
// Stop at the right border.
|
||||
if posX+chWidth > width {
|
||||
break
|
||||
var currentTag, currentRegion, currentEscapeTag, skipped, runeSeqWidth int
|
||||
runeSequence := make([]rune, 0, 10)
|
||||
flush := func() {
|
||||
if len(runeSequence) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
// Mix the existing style with the new style.
|
||||
@ -843,12 +804,85 @@ func (t *TextView) Draw(screen tcell.Screen) {
|
||||
}
|
||||
|
||||
// Draw the character.
|
||||
for offset := 0; offset < chWidth; offset++ {
|
||||
screen.SetContent(x+posX+offset, y+line-t.lineOffset, ch, nil, style)
|
||||
var comb []rune
|
||||
if len(runeSequence) > 1 {
|
||||
// Allocate space for the combining characters only when necessary.
|
||||
comb = make([]rune, len(runeSequence)-1)
|
||||
copy(comb, runeSequence[1:])
|
||||
}
|
||||
for offset := 0; offset < runeSeqWidth; offset++ {
|
||||
screen.SetContent(x+posX+offset, y+line-t.lineOffset, runeSequence[0], comb, style)
|
||||
}
|
||||
|
||||
// Advance.
|
||||
posX += chWidth
|
||||
posX += runeSeqWidth
|
||||
runeSequence = runeSequence[:0]
|
||||
runeSeqWidth = 0
|
||||
}
|
||||
for pos, ch := range text {
|
||||
// Get the color.
|
||||
if currentTag < len(colorTags) && pos >= colorTagIndices[currentTag][0] && pos < colorTagIndices[currentTag][1] {
|
||||
flush()
|
||||
if pos == colorTagIndices[currentTag][1]-1 {
|
||||
foregroundColor, backgroundColor, attributes = styleFromTag(foregroundColor, backgroundColor, attributes, colorTags[currentTag])
|
||||
currentTag++
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
// Get the region.
|
||||
if currentRegion < len(regionIndices) && pos >= regionIndices[currentRegion][0] && pos < regionIndices[currentRegion][1] {
|
||||
flush()
|
||||
if pos == regionIndices[currentRegion][1]-1 {
|
||||
regionID = regions[currentRegion][1]
|
||||
currentRegion++
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
// Skip the second-to-last character of an escape tag.
|
||||
if currentEscapeTag < len(escapeIndices) && pos >= escapeIndices[currentEscapeTag][0] && pos < escapeIndices[currentEscapeTag][1] {
|
||||
flush()
|
||||
if pos == escapeIndices[currentEscapeTag][1]-1 {
|
||||
currentEscapeTag++
|
||||
} else if pos == escapeIndices[currentEscapeTag][1]-2 {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// Determine the width of this rune.
|
||||
chWidth := runewidth.RuneWidth(ch)
|
||||
if chWidth == 0 {
|
||||
// If this is not a modifier, we treat it as a space character.
|
||||
if len(runeSequence) == 0 {
|
||||
ch = ' '
|
||||
chWidth = 1
|
||||
} else {
|
||||
runeSequence = append(runeSequence, ch)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// Skip to the right.
|
||||
if !t.wrap && skipped < skip {
|
||||
skipped += chWidth
|
||||
continue
|
||||
}
|
||||
|
||||
// Stop at the right border.
|
||||
if posX+runeSeqWidth+chWidth > width {
|
||||
break
|
||||
}
|
||||
|
||||
// Flush the rune sequence.
|
||||
flush()
|
||||
|
||||
// Queue this rune.
|
||||
runeSequence = append(runeSequence, ch)
|
||||
runeSeqWidth += chWidth
|
||||
}
|
||||
if posX+runeSeqWidth <= width {
|
||||
flush()
|
||||
}
|
||||
}
|
||||
|
||||
|
77
vendor/maunium.net/go/tview/util.go
generated
vendored
77
vendor/maunium.net/go/tview/util.go
generated
vendored
@ -297,7 +297,7 @@ func Print(screen tcell.Screen, text string, x, y, maxWidth, align int, color tc
|
||||
// printWithStyle works like Print() but it takes a style instead of just a
|
||||
// foreground color.
|
||||
func printWithStyle(screen tcell.Screen, text string, x, y, maxWidth, align int, style tcell.Style) (int, int) {
|
||||
if maxWidth < 0 {
|
||||
if maxWidth <= 0 || len(text) == 0 {
|
||||
return 0, 0
|
||||
}
|
||||
|
||||
@ -315,6 +315,9 @@ func printWithStyle(screen tcell.Screen, text string, x, y, maxWidth, align int,
|
||||
colorPos, escapePos, runePos, startPos int
|
||||
foregroundColor, backgroundColor, attributes string
|
||||
)
|
||||
if from >= len(runes) {
|
||||
return ""
|
||||
}
|
||||
for pos := range text {
|
||||
// Handle color tags.
|
||||
if colorPos < len(colorIndices) && pos >= colorIndices[colorPos][0] && pos < colorIndices[colorPos][1] {
|
||||
@ -361,6 +364,9 @@ func printWithStyle(screen tcell.Screen, text string, x, y, maxWidth, align int,
|
||||
width += w
|
||||
start = index
|
||||
}
|
||||
for start < len(runes) && runewidth.RuneWidth(runes[start]) == 0 {
|
||||
start++
|
||||
}
|
||||
return printWithStyle(screen, substring(start, len(runes)), x+maxWidth-width, y, width, AlignLeft, style)
|
||||
} else if align == AlignCenter {
|
||||
width := runewidth.StringWidth(strippedText)
|
||||
@ -376,12 +382,15 @@ func printWithStyle(screen tcell.Screen, text string, x, y, maxWidth, align int,
|
||||
var choppedLeft, choppedRight, leftIndex, rightIndex int
|
||||
rightIndex = len(runes) - 1
|
||||
for rightIndex > leftIndex && width-choppedLeft-choppedRight > maxWidth {
|
||||
leftWidth := runewidth.RuneWidth(runes[leftIndex])
|
||||
rightWidth := runewidth.RuneWidth(runes[rightIndex])
|
||||
if choppedLeft < choppedRight {
|
||||
leftWidth := runewidth.RuneWidth(runes[leftIndex])
|
||||
choppedLeft += leftWidth
|
||||
leftIndex++
|
||||
for leftIndex < len(runes) && leftIndex < rightIndex && runewidth.RuneWidth(runes[leftIndex]) == 0 {
|
||||
leftIndex++
|
||||
}
|
||||
} else {
|
||||
rightWidth := runewidth.RuneWidth(runes[rightIndex])
|
||||
choppedRight += rightWidth
|
||||
rightIndex--
|
||||
}
|
||||
@ -397,9 +406,39 @@ func printWithStyle(screen tcell.Screen, text string, x, y, maxWidth, align int,
|
||||
colorPos, escapePos int
|
||||
foregroundColor, backgroundColor, attributes string
|
||||
)
|
||||
runeSequence := make([]rune, 0, 10)
|
||||
runeSeqWidth := 0
|
||||
flush := func() {
|
||||
if len(runeSequence) == 0 {
|
||||
return // Nothing to flush.
|
||||
}
|
||||
|
||||
// Print the rune sequence.
|
||||
finalX := x + drawnWidth
|
||||
_, _, finalStyle, _ := screen.GetContent(finalX, y)
|
||||
_, background, _ := finalStyle.Decompose()
|
||||
finalStyle = overlayStyle(background, style, foregroundColor, backgroundColor, attributes)
|
||||
var comb []rune
|
||||
if len(runeSequence) > 1 {
|
||||
// Allocate space for the combining characters only when necessary.
|
||||
comb = make([]rune, len(runeSequence)-1)
|
||||
copy(comb, runeSequence[1:])
|
||||
}
|
||||
for offset := 0; offset < runeSeqWidth; offset++ {
|
||||
// To avoid undesired effects, we place the same character in all cells.
|
||||
screen.SetContent(finalX+offset, y, runeSequence[0], comb, finalStyle)
|
||||
}
|
||||
|
||||
// Advance and reset.
|
||||
drawn += len(runeSequence)
|
||||
drawnWidth += runeSeqWidth
|
||||
runeSequence = runeSequence[:0]
|
||||
runeSeqWidth = 0
|
||||
}
|
||||
for pos, ch := range text {
|
||||
// Handle color tags.
|
||||
if colorPos < len(colorIndices) && pos >= colorIndices[colorPos][0] && pos < colorIndices[colorPos][1] {
|
||||
flush()
|
||||
if pos == colorIndices[colorPos][1]-1 {
|
||||
foregroundColor, backgroundColor, attributes = styleFromTag(foregroundColor, backgroundColor, attributes, colors[colorPos])
|
||||
colorPos++
|
||||
@ -409,6 +448,7 @@ func printWithStyle(screen tcell.Screen, text string, x, y, maxWidth, align int,
|
||||
|
||||
// Handle escape tags.
|
||||
if escapePos < len(escapeIndices) && pos >= escapeIndices[escapePos][0] && pos < escapeIndices[escapePos][1] {
|
||||
flush()
|
||||
if pos == escapeIndices[escapePos][1]-1 {
|
||||
escapePos++
|
||||
} else if pos == escapeIndices[escapePos][1]-2 {
|
||||
@ -419,21 +459,26 @@ func printWithStyle(screen tcell.Screen, text string, x, y, maxWidth, align int,
|
||||
// Check if we have enough space for this rune.
|
||||
chWidth := runewidth.RuneWidth(ch)
|
||||
if drawnWidth+chWidth > maxWidth {
|
||||
break
|
||||
}
|
||||
finalX := x + drawnWidth
|
||||
|
||||
// Print the rune.
|
||||
_, _, finalStyle, _ := screen.GetContent(finalX, y)
|
||||
_, background, _ := finalStyle.Decompose()
|
||||
finalStyle = overlayStyle(background, style, foregroundColor, backgroundColor, attributes)
|
||||
for offset := 0; offset < chWidth; offset++ {
|
||||
// To avoid undesired effects, we place the same character in all cells.
|
||||
screen.SetContent(finalX+offset, y, ch, nil, finalStyle)
|
||||
break // No. We're done then.
|
||||
}
|
||||
|
||||
drawn++
|
||||
drawnWidth += chWidth
|
||||
// Put this rune in the queue.
|
||||
if chWidth == 0 {
|
||||
// If this is not a modifier, we treat it as a space character.
|
||||
if len(runeSequence) == 0 {
|
||||
ch = ' '
|
||||
chWidth = 1
|
||||
}
|
||||
} else {
|
||||
// We have a character. Flush all previous runes.
|
||||
flush()
|
||||
}
|
||||
runeSequence = append(runeSequence, ch)
|
||||
runeSeqWidth += chWidth
|
||||
|
||||
}
|
||||
if drawnWidth+runeSeqWidth <= maxWidth {
|
||||
flush()
|
||||
}
|
||||
|
||||
return drawn, drawnWidth
|
||||
|
Loading…
Reference in New Issue
Block a user