示例#1
0
文件: amua.go 项目: deweerdt/amua
func drawKnownMaildirs(amua *Amua, g *gocui.Gui, v *gocui.View) error {
	v.Clear()
	v.Frame = false
	w, h := v.Size()
	displayed := len(amua.knownMaildirs)
	if len(amua.knownMaildirs) > h {
		displayed = h
	}
	fillers := h - displayed
	space := 1
	for i := 0; i < displayed; i++ {
		current := amua.knownMaildirs[i].maildir == amua.curMaildirView.md
		nrMsgs := fmt.Sprintf("(%d)", len(amua.knownMaildirs[i].maildir.messages))
		availableWidth := w - space - len(nrMsgs) - 3
		strfmt := fmt.Sprintf(" %%-%ds %s ", availableWidth, nrMsgs)
		str := fmt.Sprintf(strfmt, util.TruncateString(amua.knownMaildirs[i].path, availableWidth))
		if current {
			colorstring.Fprintf(v, "[bold]%s", str)
		} else {
			fmt.Fprint(v, str)
		}
		fmt.Fprintf(v, strings.Repeat(" ", space-1))
		fmt.Fprintln(v, "|")
	}
	for i := 0; i < fillers; i++ {
		fmt.Fprintf(v, strings.Repeat(" ", w-1))
		fmt.Fprintln(v, "|")
	}
	return nil
}
示例#2
0
文件: amua.go 项目: deweerdt/amua
func (amua *Amua) sendMailDraw(v *gocui.View) error {
	v.Clear()
	v.Frame = false
	v.Highlight = false
	v.Wrap = true
	v.SetOrigin(0, 0)

	tos := util.ConcatAddresses(amua.newMail.to)
	ccs := util.ConcatAddresses(amua.newMail.cc)
	bccs := util.ConcatAddresses(amua.newMail.bcc)
	fmt.Fprintf(v, "y: send, Ctrl+G: cancel, q: move to drafts, t: tos, c: ccs, b: bccs\n")
	fmt.Fprintf(v, "To: %s\n", tos)
	fmt.Fprintf(v, "Cc: %s\n", ccs)
	fmt.Fprintf(v, "Bcc: %s\n", bccs)
	fmt.Fprintf(v, "Subject: %s\n", amua.newMail.subject)
	fmt.Fprintf(v, "\n")
	return nil
}