chore: upgrade to gods v2

gods v2 uses go generics rather than interfaces which simplifies the
code considerably
This commit is contained in:
Michael Yang
2024-12-21 00:02:50 -08:00
parent d8bab8ea44
commit cb40d60469
5 changed files with 109 additions and 130 deletions

View File

@@ -120,11 +120,11 @@ func (i *Instance) Readline() (string, error) {
if i.History.Pos == i.History.Size() {
currentLineBuf = []rune(buf.String())
}
buf.Replace(i.History.Prev())
buf.Replace([]rune(i.History.Prev()))
}
case KeyDown:
if i.History.Pos < i.History.Size() {
buf.Replace(i.History.Next())
buf.Replace([]rune(i.History.Next()))
if i.History.Pos == i.History.Size() {
buf.Replace(currentLineBuf)
}
@@ -220,7 +220,7 @@ func (i *Instance) Readline() (string, error) {
case CharEnter, CharCtrlJ:
output := buf.String()
if output != "" {
i.History.Add([]rune(output))
i.History.Add(output)
}
buf.MoveToEnd()
fmt.Println()