~taiite/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH senpai] ui: casemap nicks for coloring

Details
Message ID
<20210525150645.4977-1-yyp@disroot.org>
DKIM signature
pass
Download raw message
Patch: +4 -0
Prior to this, sending messages to a user with different letter case
(though this is the same user) was appearing in different colors.

Fixes #61
---
 ui/style.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ui/style.go b/ui/style.go
index d86e9f4..f1166f3 100644
--- a/ui/style.go
+++ b/ui/style.go
@@ -3,6 +3,8 @@ package ui
import (
	"hash/fnv"

	"git.sr.ht/~taiite/senpai/irc"

	"github.com/gdamore/tcell/v2"
	"github.com/mattn/go-runewidth"
)
@@ -232,6 +234,8 @@ var identColorBlacklist = []int{
}

func IdentColor(s string) (code int) {
	s = irc.CasemapRFC1459(s)

	h := fnv.New32()
	_, _ = h.Write([]byte(s))

-- 
2.31.1
Details
Message ID
<20210525193001.23e205b1@vroom.localdomain>
In-Reply-To
<20210525150645.4977-1-yyp@disroot.org> (view parent)
DKIM signature
pass
Download raw message
While this will work in most cases, this doesn't use the casemapping
provided by the server and I'd like to move IRC-specific code out of
the ui module.

I'm currently working on a simpler version of android's AnnotatedString
that will contain what's necessary to keep track of colors and text
styles in a string.

https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-main/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/AnnotatedString.kt

Once that's done, ui.Line will need to be changed so that the head
color will be of type tcell.Color.

After that, the app module will be able to put ANSI codes in the
timeline and casemap nicks before setting the head color.
Reply to thread Export thread (mbox)