@ 261030.1

260517.6 · c67165c6c22b6758eb43209aaee45303f5b08b5b

[codex] Fix OSC 8 hyperlink state transitions (#1112)

* fix: hyperlink URL state transitions (fixes #1100)

* test hyperlink empty state coverage

reading declarations

Changes to style_test.go. All files

style_test.go

@@ -89,6 +89,39 @@ func TestStyle(t *testing.T) { 		t.Errorf("wrong underline style: %v", us.GetUnderlineStyle()) 	} +	us = us.Url("")+	if id, url := us.GetUrl(); id != "someId" || url != "" {+		t.Errorf("url clear should preserve id state: %q %q", id, url)+	}++	us = us.Url("http://example.net")+	if id, url := us.GetUrl(); id != "someId" || url != "http://example.net" {+		t.Errorf("url id not preserved across clear: %q %q", id, url)+	}++	us = us.UrlId("")+	if id, url := us.GetUrl(); id != "" || url != "http://example.net" {+		t.Errorf("url id clear did not preserve url: %q %q", id, url)+	}++	orphan := StyleDefault.UrlId("orphan")+	if id, url := orphan.GetUrl(); id != "orphan" || url != "" {+		t.Errorf("url id without url should be retained: %q %q", id, url)+	}++	orphan = orphan.Url("http://example.org")+	if id, url := orphan.GetUrl(); id != "orphan" || url != "http://example.org" {+		t.Errorf("url id set before url was not preserved: %q %q", id, url)+	}++	if id, url := StyleDefault.Url("").GetUrl(); id != "" || url != "" {+		t.Errorf("empty url should leave no hyperlink state: %q %q", id, url)+	}++	if id, url := StyleDefault.UrlId("").GetUrl(); id != "" || url != "" {+		t.Errorf("empty url id should leave no hyperlink state: %q %q", id, url)+	}+ 	us = us.Normal().Reverse(true).Italic(false) 	if us.GetAttributes() != AttrReverse { 		t.Errorf("wrong attributes: %v", us.GetAttributes())