about summary refs log tree commit diff stats
path: root/commands/account
diff options
context:
space:
mode:
Diffstat (limited to 'commands/account')
-rw-r--r--commands/account/compose.go14
-rw-r--r--commands/account/view-message.go5
2 files changed, 10 insertions, 9 deletions
diff --git a/commands/account/compose.go b/commands/account/compose.go
index 10be9ae..8097d10 100644
--- a/commands/account/compose.go
+++ b/commands/account/compose.go
@@ -3,8 +3,6 @@ package account
 import (
 	"errors"
 
-	"github.com/mattn/go-runewidth"
-
 	"git.sr.ht/~sircmpwn/aerc2/widgets"
 )
 
@@ -19,9 +17,15 @@ func Compose(aerc *widgets.Aerc, args []string) error {
 	}
 	acct := aerc.SelectedAccount()
 	composer := widgets.NewComposer(aerc.Config(), acct.AccountConfig())
-	// TODO: Change tab name when message subject changes
-	aerc.NewTab(composer, runewidth.Truncate(
-		"New email", 32, "…"))
+	tab := aerc.NewTab(composer, "New email")
+	composer.OnSubjectChange(func(subject string) {
+		if subject == "" {
+			tab.Name = "New email"
+		} else {
+			tab.Name = subject
+		}
+		tab.Content.Invalidate()
+	})
 	return nil
 }
 
diff --git a/commands/account/view-message.go b/commands/account/view-message.go
index ea6addc..3697aa7 100644
--- a/commands/account/view-message.go
+++ b/commands/account/view-message.go
@@ -3,8 +3,6 @@ package account
 import (
 	"errors"
 
-	"github.com/mattn/go-runewidth"
-
 	"git.sr.ht/~sircmpwn/aerc2/widgets"
 )
 
@@ -26,8 +24,7 @@ func ViewMessage(aerc *widgets.Aerc, args []string) error {
 		return nil
 	}
 	viewer := widgets.NewMessageViewer(aerc.Config(), store, msg)
-	aerc.NewTab(viewer, runewidth.Truncate(
-		msg.Envelope.Subject, 32, "…"))
+	aerc.NewTab(viewer, msg.Envelope.Subject)
 	return nil
 }
 
light .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# To check our support for keyboards in scenarios, rewrite tests from
# scenario_keyboard.mu
# Tests for keyboard interface.

scenario read-key-in-mu [
  assume-keyboard [abc]
  run [
    1:character, 2:boolean, keyboard:address <- read-key keyboard:address
    3:character, 4:boolean, keyboard:address <- read-key keyboard:address
    5:character, 6:boolean, keyboard:address <- read-key keyboard:address
    7:character, 8:boolean, keyboard:address <- read-key keyboard:address
  ]
  memory-should-contain [
    1 <- 97  # 'a'
    2 <- 1  # first read-key call found a character
    3 <- 98  # 'b'
    4 <- 1  # second read-key call found a character
    5 <- 99  # 'c'
    6 <- 1  # third read-key call found a character
    7 <- 0
    8 <- 0  # fourth read-key call didn't find a character
  ]
]