ref: ec63ec1b6056822aace571109c568921ff239ee3
parent: 6cefdc9f5a9cc2a2621d3cd832310b97a139bdc1
author: penny <penny@limitedideas.org>
date: Sun Oct 19 14:59:45 EDT 2025
add plan9 platform code
--- a/hellclient.go
+++ b/hellclient.go
@@ -8,14 +8,11 @@
"time"
mastodon "codeberg.org/penny64/hellclient-go-mastodon"
- "github.com/ergochat/readline"
)
-var (
- ErrInterrupt = readline.ErrInterrupt
- EOF = io.EOF
-)
+var EOF = io.EOF
+
type postref struct {prefix string
ref string
@@ -26,7 +23,7 @@
type Hellclient struct {//if you're gonna touch or read anything here lock the mutex with hc.lock()
isPaused bool
- rl *readline.Instance
+ rl *readline
prompt *PromptBar
attacher *StatusAttachmentHolder
client *mastodon.Client
@@ -72,24 +69,24 @@
func NewHellclient() (*Hellclient, error) {var hc Hellclient
- config := &readline.Config{+ config := &Config{Prompt: "Hell> ",
FuncFilterInputRune: func(r rune) (rune, bool) {- if r == readline.CharCtrlJ {+ if r == CharCtrlJ {hc.multiLineMode = !hc.multiLineMode
hc.prompt.UpdatePrompt()
return r, false
}
- if r == readline.CharInterrupt {+ if r == CharInterrupt {return toPUA(r), true
}
- if r == readline.CharEnter && hc.multiLineMode {+ if r == CharEnter && hc.multiLineMode {return toPUA(r), true
}
return r, true
},
Listener: func(line []rune, pos int, key rune) ([]rune, int, bool) {- if key == toPUA(readline.CharEnter) && hc.multiLineMode {+ if key == toPUA(CharEnter) && hc.multiLineMode {// handle multi-line input
line = line[:len(line)-1]
line = append(line, '\n')
@@ -97,7 +94,7 @@
}
//If we get an interupt just clear the line if it's not empty
- if key == toPUA(readline.CharInterrupt) {+ if key == toPUA(CharInterrupt) { if len(line) > 1 {return nil, 0, true
}
@@ -107,7 +104,7 @@
return nil, 0, false
},
}
- rl, err := readline.NewEx(config)
+ rl, err := NewReadline(config)
if err != nil {return nil, err
}
--- a/prompt.go
+++ b/prompt.go
@@ -5,7 +5,6 @@
"fmt"
"strings"
- "github.com/ergochat/readline"
)
// Returns text to add to the status bar
@@ -17,7 +16,7 @@
type PromptBar struct {prompt string
items []PromptItem
- rl *readline.Instance
+ rl *readline
}
// Render the prompt and update the readline prompt
--
⑨