fn main args-on-stack: (addr array addr array byte) -> exit-status/ebx: int { var args/eax: (addr array addr array byte) <- copy args-on-stack var tmp/ecx: int <- length args $main-body: { # if (len(args) <= 1) print usage and exit compare tmp, 1 { break-if-> print-string-to-real-screen "usage: browse [filename]\n" print-string-to-real-screen " or browse test\n" exit-status <- copy 1 break $main-body } # if (args[1] == "test") run-tests() var tmp2/ecx: (addr addr array byte) <- index args, 1 var tmp3/eax: boolean <- string-equal? *tmp2, "test" compare tmp3, 0 { break-if-= run-tests exit-status <- copy 0 # TODO: get at Num-test-failures somehow break $main-body } # otherwise interactive mode exit-status <- interactive args-on-stack } } fn interactive args: (addr array addr array byte) -> exit-status/ebx: int { # initialize fs from args[1] var filename/eax: (addr array byte) <- first-arg args var file-storage: (handle buffered-file) var file-storage-addr/esi: (addr handle buffered-file) <- address file-storage open filename, 0, file-storage-addr var _fs/eax: (addr buffered-file) <- lookup file-storage var fs/esi: (addr buffered-file) <- copy _fs # enable-screen-grid-mode enable-keyboard-immediate-mode # initialize screen state var paginated-screen-storage: paginated-screen var paginated-screen/eax: (addr paginated-screen) <- address paginated-screen-storage initialize-paginated-screen paginated-screen, 0x40, 2, 5 normal-text paginated-screen # { render paginated-screen, fs var key/eax: byte <- read-key compare key, 0x71 # 'q' loop-if-!= } enable-keyboard-type-mode enable-screen-type-mode exit-status <- copy 0 } fn render screen: (addr paginated-screen), fs: (addr buffered-file) { start-drawing screen render-normal screen, fs } fn test-render-multicolumn-text { # input text var input-storage: (handle buffered-file) var input-ah/eax: (addr handle buffered-file) <- address input-storage populate-buffered-file-containing "abcdefgh", input-ah var in/eax: (addr buffered-file) <- lookup input-storage # output screen var pg: paginated-screen var pg-addr/ecx: (addr paginated-screen) <- address pg initialize-fake-paginated-screen pg-addr, 3, 6, 2, 1, 1 # 3 rows, 6 columns, 2 pages * 2 columns each # render pg-addr, in var screen-ah/eax: (addr handle screen) <- get pg, screen var screen/eax: (addr screen) <- lookup *screen-ah check-screen-row screen, 1, " ", "F - test-render-multicolumn-text/row1" check-screen-row screen, 2, " ab ef", "F - test-render-multicolumn-text/row2" check-screen-row screen, 3, " cd gh", "F - test-render-multicolumn-text/row3" } fn test-render-heading-text { # input text var input-storage: (handle buffered-file) var input-ah/eax: (addr handle buffered-file) <- address input-storage populate-buffered-file-containing "# abc\n\ndef", input-ah var in/eax: (addr buffered-file) <- lookup input-storage # output screen var pg: paginated-screen var pg-addr/ecx: (addr paginated-screen) <- address pg initialize-fake-paginated-screen pg-addr, 8, 6, 5, 1, 1 # 6 columns, single page # render pg-addr, in var screen-ah/eax: (addr handle screen) <- get pg, screen var screen/eax: (addr screen) <- lookup *screen-ah check-screen-row screen, 1, " ", "F - test-render-heading-text/row1" check-screen-row-in-color screen, 0xa0, 2, " abc ", "F - test-render-heading-text/heading" check-screen-row screen, 3, " ", "F - test-render-heading-text/row3" check-screen-row screen, 4, " def ", "F - test-render-heading-text/row4" } fn test-render-bold-text { # input text var input-storage: (handle buffered-file) var input-ah/eax: (addr handle buffered-file) <- address input-storage populate-buffered-file-containing "a *b* c", input-ah var in/eax: (addr buffered-file) <- lookup input-storage # output screen var pg: paginated-screen var pg-add
package commands

import (
	"fmt"

	"git.sr.ht/~sircmpwn/aerc/widgets"
)

type PinTab struct{}

func init() {
	register(PinTab{})
}

func (PinTab) Aliases() []string {
	return []string{"pin-tab", "unpin-tab"}
}

func (PinTab) Complete(aerc *widgets.Aerc, args []string) []string {
	return nil
}

func (PinTab) Execute(aerc *widgets.Aerc, args []string) error {
	if len(args) != 1 {
		return fmt.Errorf("Usage: %s",