aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2020-02-19 21:54:53 +0200
committerTulir Asokan <tulir@maunium.net>2020-02-19 21:54:53 +0200
commit15e1d3f87c5e18f3429c49d21b30e66fb2a9cff7 (patch)
tree44146fe934a20cd688e83d5d059bd074b2ff633f /ui
parentaf99c76d460f190e873ed88432c9a8b08324200b (diff)
Fix rendering formatted m.emotes
Diffstat (limited to 'ui')
-rw-r--r--ui/messages/html/base.go4
-rw-r--r--ui/messages/html/blockquote.go5
-rw-r--r--ui/messages/html/break.go14
-rw-r--r--ui/messages/html/horizontalline.go5
-rw-r--r--ui/messages/html/list.go5
-rw-r--r--ui/messages/html/text.go5
6 files changed, 37 insertions, 1 deletions
diff --git a/ui/messages/html/base.go b/ui/messages/html/base.go
index 75cbd0c..fa4f3f0 100644
--- a/ui/messages/html/base.go
+++ b/ui/messages/html/base.go
@@ -92,4 +92,6 @@ func (be *BaseEntity) CalculateBuffer(width, startX int, bare bool) int {
return be.startX
}
-func (be *BaseEntity) Draw(screen mauview.Screen) {}
+func (be *BaseEntity) Draw(screen mauview.Screen) {
+ panic("Called Draw() of BaseEntity")
+}
diff --git a/ui/messages/html/blockquote.go b/ui/messages/html/blockquote.go
index 288d86d..bb7c009 100644
--- a/ui/messages/html/blockquote.go
+++ b/ui/messages/html/blockquote.go
@@ -40,6 +40,11 @@ func NewBlockquoteEntity(children []Entity) *BlockquoteEntity {
}}
}
+func (be *BlockquoteEntity) AdjustStyle(fn AdjustStyleFunc) Entity {
+ be.BaseEntity = be.BaseEntity.AdjustStyle(fn).(*BaseEntity)
+ return be
+}
+
func (be *BlockquoteEntity) Clone() Entity {
return &BlockquoteEntity{ContainerEntity: be.ContainerEntity.Clone().(*ContainerEntity)}
}
diff --git a/ui/messages/html/break.go b/ui/messages/html/break.go
index ea67ead..fca1d0e 100644
--- a/ui/messages/html/break.go
+++ b/ui/messages/html/break.go
@@ -16,6 +16,10 @@
package html
+import (
+ "maunium.net/go/mauview"
+)
+
type BreakEntity struct {
*BaseEntity
}
@@ -27,6 +31,12 @@ func NewBreakEntity() *BreakEntity {
}}
}
+// AdjustStyle changes the style of this text entity.
+func (be *BreakEntity) AdjustStyle(fn AdjustStyleFunc) Entity {
+ be.BaseEntity = be.BaseEntity.AdjustStyle(fn).(*BaseEntity)
+ return be
+}
+
func (be *BreakEntity) Clone() Entity {
return NewBreakEntity()
}
@@ -38,3 +48,7 @@ func (be *BreakEntity) PlainText() string {
func (be *BreakEntity) String() string {
return "&html.BreakEntity{},\n"
}
+
+func (be *BreakEntity) Draw(screen mauview.Screen) {
+ // No-op, the logic happens in containers
+}
diff --git a/ui/messages/html/horizontalline.go b/ui/messages/html/horizontalline.go
index 32761aa..ff82397 100644
--- a/ui/messages/html/horizontalline.go
+++ b/ui/messages/html/horizontalline.go
@@ -36,6 +36,11 @@ func NewHorizontalLineEntity() *HorizontalLineEntity {
}}
}
+func (he *HorizontalLineEntity) AdjustStyle(fn AdjustStyleFunc) Entity {
+ he.BaseEntity = he.BaseEntity.AdjustStyle(fn).(*BaseEntity)
+ return he
+}
+
func (he *HorizontalLineEntity) Clone() Entity {
return NewHorizontalLineEntity()
}
diff --git a/ui/messages/html/list.go b/ui/messages/html/list.go
index 22b969a..c0042d9 100644
--- a/ui/messages/html/list.go
+++ b/ui/messages/html/list.go
@@ -58,6 +58,11 @@ func NewListEntity(ordered bool, start int, children []Entity) *ListEntity {
return entity
}
+func (le *ListEntity) AdjustStyle(fn AdjustStyleFunc) Entity {
+ le.BaseEntity = le.BaseEntity.AdjustStyle(fn).(*BaseEntity)
+ return le
+}
+
func (le *ListEntity) Clone() Entity {
return &ListEntity{
ContainerEntity: le.ContainerEntity.Clone().(*ContainerEntity),
diff --git a/ui/messages/html/text.go b/ui/messages/html/text.go
index ea8f737..9501cab 100644
--- a/ui/messages/html/text.go
+++ b/ui/messages/html/text.go
@@ -44,6 +44,11 @@ func NewTextEntity(text string) *TextEntity {
}
}
+func (te *TextEntity) AdjustStyle(fn AdjustStyleFunc) Entity {
+ te.BaseEntity = te.BaseEntity.AdjustStyle(fn).(*BaseEntity)
+ return te
+}
+
func (te *TextEntity) Clone() Entity {
return &TextEntity{
BaseEntity: te.BaseEntity.Clone().(*BaseEntity),