Example #1
0
func (w *Window) Print(text string) {
	C.waddstr(w.win, C.CString(strings.Map(func(r rune) rune {
		if r < 32 {
			return -1
		}
		return r
	}, text)))
}
Example #2
0
func (win *Window) Addstr(str string) error {
	s := C.CString(str)
	defer C.free(unsafe.Pointer(s))
	if C.waddstr((*C.WINDOW)(win), s) == C.ERR {
		return CursesError{"waddstr failed"}
	}
	return nil
}
Example #3
0
// Printf functions the same as the stardard library's fmt package. See Print
// for more details.
func (w *Window) Printf(format string, args ...interface{}) {
	cstr := C.CString(fmt.Sprintf(format, args...))
	defer C.free(unsafe.Pointer(cstr))

	C.waddstr(w.win, cstr)
}
Example #4
0
func (w *Window) Fill(str string) bool {
	return C.waddstr(w.win, C.CString(str)) == C.OK
}
Example #5
0
func (window *Window) Addstr(str ...interface{}) {
	res := (*C.char)(C.CString(fmt.Sprint(str...)))
	defer C.free(unsafe.Pointer(res))
	C.waddstr(window.cwin, res)
}
Example #6
0
/* Prints at the cursor location string s. */
func (w *Window) Print(s string) {
	C.waddstr((*C.WINDOW)(w), C.CString(s))
}
Example #7
0
func (w *CursesWindow) Fill(str string) FillReturn {
	if C.waddstr(w.impl, C.CString(str)) == C.OK {
		return FillContinue
	}
	return FillSuspend
}