cleanup
This commit is contained in:
parent
1eebca289f
commit
56827fa470
@ -8,7 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"whspbrd/pkg/cell_size"
|
||||
//"whspbrd/pkg/clean_image"
|
||||
"whspbrd/pkg/clean_image"
|
||||
"whspbrd/pkg/render_image"
|
||||
|
||||
"github.com/jroimartin/gocui"
|
||||
@ -48,9 +48,9 @@ func layoutInput(g *gocui.Gui, maxX, maxY int) error {
|
||||
func updateChatView(v *gocui.View) {
|
||||
v.Clear()
|
||||
|
||||
//clear := cleanimage.NewKittyImageCleaner()
|
||||
clear := cleanimage.NewKittyImageCleaner()
|
||||
// TODO: In future optimize this to only clear certain part of screen
|
||||
//fmt.Print(clear.DeleteAllVisiblePlacements(true))
|
||||
fmt.Print(clear.DeleteByColumn(23, false))
|
||||
|
||||
for i, msg := range chatData.Messages {
|
||||
decoded, err := base64.StdEncoding.DecodeString(msg.Content)
|
||||
|
||||
@ -7,6 +7,7 @@ import (
|
||||
//"math"
|
||||
//"strings"
|
||||
//"whspbrd/pkg/cell_size"
|
||||
"whspbrd/pkg/clean_image"
|
||||
"whspbrd/pkg/render_image"
|
||||
//"whspbrd/pkg/resize_image"
|
||||
|
||||
@ -34,6 +35,8 @@ func updateContactsView(g *gocui.Gui) error {
|
||||
}
|
||||
|
||||
v.Clear()
|
||||
clear := cleanimage.NewKittyImageCleaner()
|
||||
fmt.Print(clear.DeleteByColumn(2, false))
|
||||
|
||||
// TODO: If no contacts then error, create some add contacts window or hello to WhspBrd
|
||||
LoadMessages(users[selectedUserIdx])
|
||||
@ -45,17 +48,17 @@ func updateContactsView(g *gocui.Gui) error {
|
||||
}
|
||||
|
||||
_, maxY := g.Size()
|
||||
h := min(len(users), (maxY / 2) - 1)
|
||||
startI := max(0, min(selectedUserIdx - (h / 2), len(users) - h))
|
||||
h := min(len(users), (maxY/2)-1)
|
||||
startI := max(0, min(selectedUserIdx-(h/2), len(users)-h))
|
||||
|
||||
fmt.Fprint(v, "\n\n")
|
||||
for i := startI; i < startI + h; i++ {
|
||||
for i := startI; i < startI+h; i++ {
|
||||
u := users[i]
|
||||
|
||||
fmt.Fprint(v, "\t\t\t\t")
|
||||
|
||||
icon_path := fmt.Sprintf("./configs/servers/default/users/%s/icon.png", u)
|
||||
render_image.RenderImage(icon_path, 3 + 2 * (i - startI), 2, 30, 30, false)
|
||||
render_image.RenderImage(icon_path, 3+2*(i-startI), 2, 30, 30, false)
|
||||
|
||||
if i == selectedUserIdx {
|
||||
fmt.Fprintln(v, "\x1b[7m"+u+"\x1b[0m\n")
|
||||
|
||||
@ -9,7 +9,10 @@ import (
|
||||
var users []string
|
||||
var prevWidth, prevHeight int
|
||||
|
||||
|
||||
|
||||
func Run() {
|
||||
|
||||
LoadContacts("configs/servers/default")
|
||||
|
||||
g, err := gocui.NewGui(gocui.OutputNormal)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user