shithub: hell

Download patch

ref: cfbaba2862bc94499cd71ee26123c6c72864ae4e
parent: afe2f385e4848787de1a5832b71e5d019995d03c
author: penny <penny@limitedideas.org>
date: Thu Aug 14 22:52:36 EDT 2025

Print newlines after long statuses and remove extra newlines from api

--- a/format.go
+++ b/format.go
@@ -18,6 +18,11 @@
 	if width < 2 {
 		return input
 	}
+	
+	longline := false
+	if len(remainder) > width {
+		longline = true
+	}
 
 	for len(remainder) > width {
 		if strings.HasPrefix(string(remainder), "\n") {
@@ -63,8 +68,17 @@
 			remainder = remainder[width-1:]
 		}
 	}
-
+	
 	result = append(result, remainder...)
+	//Sometimes posts come from mastodon with a newline at the end
+	//you can actually see it in the web interface
+	if(strings.HasSuffix(string(result), "\n")) {
+		result = result[:1]
+	}
+	//Put a newline at the end if status takes multiple lines
+	if longline {
+		result = append(result, '\n')
+	}
 	return string(result)
 }
 
--