mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Generic PadRow function added
This commit is contained in:
@@ -2,8 +2,10 @@ package todo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
//"strings"
|
||||
//"github.com/gdamore/tcell"
|
||||
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
)
|
||||
|
||||
const checkWidth = 4
|
||||
@@ -32,20 +34,8 @@ func (widget *Widget) display() {
|
||||
item.Text,
|
||||
)
|
||||
|
||||
str = widget.padLine(str, item) + "\n"
|
||||
str = str + wtf.PadRow((4+len(item.Text)), widget.View) + "\n"
|
||||
}
|
||||
|
||||
fmt.Fprintf(widget.View, "%s", str)
|
||||
}
|
||||
|
||||
// Pad with spaces to get full-line highlighting
|
||||
func (widget *Widget) padLine(str string, item *Item) string {
|
||||
_, _, w, _ := widget.View.GetInnerRect()
|
||||
|
||||
padSize := w - checkWidth - len(item.Text)
|
||||
if padSize < 0 {
|
||||
padSize = 0
|
||||
}
|
||||
|
||||
return str + strings.Repeat(" ", padSize)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user