ref: b459d984f54e4c5c5dc215cf19a1e502ca06b4f9
parent: da847f3643423b925328ff3a1c4c5dcef565dfa9
author: penny <penny@limitedideas.org>
date: Mon Oct 27 14:50:37 EDT 2025
fix a crash with /edit and twiddle plan 9 driver
--- a/main.go
+++ b/main.go
@@ -33,14 +33,10 @@
for { func() {line, err := rl.Readline()
- //If we get an interupt error, we'll return to read the next line
- //If the next line is empty, exit the program
- //If it isn't empty, we were just clearing the line
-
if err != nil {- fmt.Println("Error:", err)return
}
+
command, arguments, found := processInput(line)
//empty line
@@ -467,6 +463,10 @@
return
case "edit":
if content == "" || content == " " {+ if (postItem == nil) || postItem.Account.ID != hc.currentuser.ID {+ fmt.Printf("cannot edit other's statuses!\n")+ return
+ }
fixedHTML, err := prepareForEdit(postItem)
if err != nil { fmt.Printf("Error loading post HTML: %s\n", err)--- a/readline_plan9.go
+++ b/readline_plan9.go
@@ -47,9 +47,11 @@
}
fmt.Print(cfg.Prompt)
var sb strings.Builder
+ var err error
+ var input string
for {buffer := bufio.NewReader(os.Stdin)
- input, err := buffer.ReadString('\n')+ input, err = buffer.ReadString('\n')sb.WriteString(input)
if err != nil {rl.multi = !rl.multi
@@ -63,7 +65,7 @@
break
}
}
- return strings.TrimSpace(sb.String()), nil
+ return strings.TrimSpace(sb.String()), err
}
func (rl *readline) Stdout() io.Writer {@@ -81,7 +83,7 @@
func (rl *readline) SetDefault(editline string) {rl.multi = true
rl.ctl.WriteString("holdon")- fmt.Printf("%s\n", editline)+ fmt.Printf("%s\n\n", editline)}
func (rl *readline) Readline() (string, error) {--
⑨