func readAddr(win *acme.Win) (q0, q1 int, err error) { if _, _, err := win.ReadAddr(); err != nil { return 0, 0, err } if err := win.Ctl("addr=dot"); err != nil { return 0, 0, err } return win.ReadAddr() }
func readAddr(win *acme.Win) (q0, q1 int, err error) { // This first read is bogus. // Acme zeroes the win's address the first time addr is opened. // So, we need to open it before setting addr=dot, // lest we just read back a zero address. if _, _, err := win.ReadAddr(); err != nil { return 0, 0, err } if err := win.Ctl("addr=dot\n"); err != nil { return 0, 0, err } return win.ReadAddr() }
func selection(win *acme.Win, body []byte) (int, int, error) { if _, _, err := win.ReadAddr(); err != nil { return 0, 0, err } if err := win.Ctl("addr=dot"); err != nil { return 0, 0, err } q0, q1, err := win.ReadAddr() if err != nil { return 0, 0, err } off0, err := byteOff(q0, bytes.NewReader(body)) if err != nil { return 0, 0, err } off1, err := byteOff(q1, bytes.NewReader(body)) if err != nil { return 0, 0, err } return off0, off1, nil }