shithub: hell

Download patch

ref: 95d3998c4833f97093f1cdaac6d6b6bb51f82671
parent: 1f796fcf73960e12979e09a9f6f925dba6a147d6
author: penny <penny@limitedideas.org>
date: Wed Oct 29 16:09:54 EDT 2025

new account selection logic

--- a/main.go
+++ b/main.go
@@ -27,7 +27,9 @@
 	debugMap := hc.debugMap
 	lastindex := ""
 	recentpost := &hc.recentpost
+	var lastaccount *mastodon.Account
 
+
 	go StreamHomeTimeline(&client, homeMap, hc)
 
 	for {
@@ -61,20 +63,25 @@
 			defer hc.unlock()
 
 			index, content, _ := strings.Cut(arguments, " ")
+			
+			
 
 			// "." refers to most recently acted on status
-			if index == "." {
+			// but if we have an account set, we don't want to set an index!
+			if index == "." && lastaccount == nil {
 				index = lastindex
 			}
+
 			postItem, postOK := homeMap[index]
 			debugItem := debugMap[index]
 
 			//Wether we got a post index or not
-			var foundindex bool
+			foundindex := false
 			//If there's no index selected load the last post we operated on
 			if postOK {
 				foundindex = true
 				lastindex = index
+				lastaccount = nil
 			} else {
 				postItem, postOK = homeMap[lastindex]
 			}
@@ -91,10 +98,16 @@
 			}
 
 			accByNameOrRef := func() (account *mastodon.Account)  {
-				if foundindex || index == "" {
+				if lastaccount != nil {
+					account = lastaccount
+					return
+				}
+				if foundindex {
 					account = &postItem.Account
 				} else {
-					account = hc.resolveAccount(index)
+					account = hc.resolveAccount(arguments)
+					lastaccount = account
+					lastindex = ""
 					if account == nil {
 						return
 					}
@@ -291,7 +304,7 @@
 				return
 			}
 
-			if arguments == "" && !postOK {
+			if arguments == "" && !postOK && lastaccount == nil {
 				fmt.Printf("%v requires an argument\n", command)
 				return
 			}
--