Compare commits

..

No commits in common. "05a7efd2234c83a46bf9f85946265ef9b42e756b" and "3f3f4b6c808c91f3da3593b005150fa21d21fcb9" have entirely different histories.

3 changed files with 9 additions and 31 deletions

View file

@ -19,18 +19,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security ### Security
## [0.2.3] - 2024-06-01
### Changed
- Reload chat history when changing room, with an option to keep history
## [0.2.2] - 2024-06-01
### Fixed
- Messages *actually* wrap properly with terminal viewport width this time
## [0.2.1] - 2024-05-31 ## [0.2.1] - 2024-05-31
### Fixed ### Fixed
@ -77,9 +65,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Go programs for [client](./tui/main.go) and [server](./server/main.go) - Go programs for [client](./tui/main.go) and [server](./server/main.go)
- GitHub Actions release flow, including binaries - GitHub Actions release flow, including binaries
[unreleased]: https://github.com/supleed2/go-chat/compare/v0.2.3...HEAD [unreleased]: https://github.com/supleed2/go-chat/compare/v0.2.1...HEAD
[0.2.3]: https://github.com/supleed2/go-chat/releases/tag/v0.2.3
[0.2.2]: https://github.com/supleed2/go-chat/releases/tag/v0.2.2
[0.2.1]: https://github.com/supleed2/go-chat/releases/tag/v0.2.1 [0.2.1]: https://github.com/supleed2/go-chat/releases/tag/v0.2.1
[0.2.0]: https://github.com/supleed2/go-chat/releases/tag/v0.2.0 [0.2.0]: https://github.com/supleed2/go-chat/releases/tag/v0.2.0
[0.1.2]: https://github.com/supleed2/go-chat/releases/tag/v0.1.2 [0.1.2]: https://github.com/supleed2/go-chat/releases/tag/v0.1.2

View file

@ -52,7 +52,6 @@ const (
) )
type model struct { type model struct {
kpHist bool
history viewport.Model history viewport.Model
msgs []c.SMsg msgs []c.SMsg
showTim showTim showTim showTim
@ -68,17 +67,15 @@ type model struct {
} }
type args struct { type args struct {
Address string `arg:"positional" default:"gochat.8bit.lol" help:"address to connect to, without ws://" placeholder:"HOST[:PORT]"` Address string `arg:"positional" default:"gochat.8bit.lol" help:"address to connect to, without ws://" placeholder:"HOST[:PORT]"`
KeepHistory bool `arg:"-k" help:"append chat history when changing rooms, instead of clearing"` Timestamps showTim `arg:"-t" default:"off" help:"display timestamps of messages, ctrl+t to cycle after startup [off, short, full]" placeholder:"CHOICE"`
Timestamps showTim `arg:"-t" default:"off" help:"display timestamps of messages, ctrl+t to cycle after startup [off, short, full]" placeholder:"CHOICE"` Nick *string `arg:"-n" help:"attempt to automatically set nick after connecting"`
Nick *string `arg:"-n" help:"attempt to automatically set nick after connecting"` Password *string `arg:"-p" help:"password, if required"`
Password *string `arg:"-p" help:"password, if required"`
} }
func (a *args) Version() string { func (a *args) Version() string {
return "v0.2.3" return "v0.2.1"
} }
func (a *args) Description() string { func (a *args) Description() string {
return "Go, chat!\nA basic irc-style chat client, written in Go using bubbletea and websockets" return "Go, chat!\nA basic irc-style chat client, written in Go using bubbletea and websockets"
} }
@ -183,9 +180,8 @@ func initModel(ctx context.Context, conn *ws.Conn, a args, tz time.Location) mod
msgs: messages, msgs: messages,
showTim: a.Timestamps, showTim: a.Timestamps,
tz: tz, tz: tz,
kpHist: a.KeepHistory,
history: vp, history: vp,
idStyle: lipgloss.NewStyle().Width(60), idStyle: lipgloss.NewStyle(),
pStyle: lipgloss.NewStyle().Bold(true), pStyle: lipgloss.NewStyle().Bold(true),
help: help.New(), help: help.New(),
recvCh: recvCh, recvCh: recvCh,
@ -234,9 +230,6 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
} else if text == "ls" { } else if text == "ls" {
m.sendCh <- c.CMsg{Typ: c.Ls, Msg: ""} m.sendCh <- c.CMsg{Typ: c.Ls, Msg: ""}
} else if text, ok := strings.CutPrefix(text, "cd "); ok { } else if text, ok := strings.CutPrefix(text, "cd "); ok {
if !m.kpHist {
m.msgs = []c.SMsg{}
}
m.sendCh <- c.CMsg{Typ: c.Cd, Msg: text} m.sendCh <- c.CMsg{Typ: c.Cd, Msg: text}
} else if text == "who" { } else if text == "who" {
m.sendCh <- c.CMsg{Typ: c.Who, Msg: ""} m.sendCh <- c.CMsg{Typ: c.Who, Msg: ""}
@ -257,8 +250,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.history.Width = msg.Width m.history.Width = msg.Width
m.history.GotoBottom() m.history.GotoBottom()
m.input.Width = msg.Width - 3 m.input.Width = msg.Width - 3
m.idStyle = m.idStyle.Width(msg.Width) m.help.Width = msg.Width - 1
m.help.Width = msg.Width
m.history.SetContent(m.viewMessages()) m.history.SetContent(m.viewMessages())
} }

View file

@ -63,7 +63,7 @@ const createRoomTable = "CREATE TABLE IF NOT EXISTS %s (tim DATETIME, id TEXT, m
const insertRoomMsg = "INSERT INTO %v (tim, id, msg) VALUES (:tim, :id, :msg)" const insertRoomMsg = "INSERT INTO %v (tim, id, msg) VALUES (:tim, :id, :msg)"
func (a *args) Version() string { func (a *args) Version() string {
return "v0.2.3" return "v0.2.1"
} }
func (a *args) Description() string { func (a *args) Description() string {