當前位置: 首頁>>代碼示例>>Golang>>正文


Golang C.noecho函數代碼示例

本文整理匯總了Golang中C.noecho函數的典型用法代碼示例。如果您正苦於以下問題:Golang noecho函數的具體用法?Golang noecho怎麽用?Golang noecho使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了noecho函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Init

func Init(theme *ColorTheme, black bool, mouse bool) {
	{
		in, err := os.OpenFile("/dev/tty", syscall.O_RDONLY, 0)
		if err != nil {
			panic("Failed to open /dev/tty")
		}
		_in = in
		// Break STDIN
		// syscall.Dup2(int(in.Fd()), int(os.Stdin.Fd()))
	}

	C.setlocale(C.LC_ALL, C.CString(""))
	_screen = C.newterm(nil, C.stderr, C.stdin)
	if _screen == nil {
		fmt.Println("Invalid $TERM: " + os.Getenv("TERM"))
		os.Exit(2)
	}
	C.set_term(_screen)
	if mouse {
		C.mousemask(C.ALL_MOUSE_EVENTS, nil)
	}
	C.noecho()
	C.raw() // stty dsusp undef

	if theme != nil {
		C.start_color()
		initPairs(theme, black)
		_color = attrColored
	} else {
		_color = attrMono
	}
}
開發者ID:ralphtheninja,項目名稱:fzf,代碼行數:32,代碼來源:curses.go

示例2: Echo

// Echo turns on/off the printing of typed characters
func Echo(on bool) {
	if on {
		C.echo()
		return
	}
	C.noecho()
}
開發者ID:apcera,項目名稱:sample-apps,代碼行數:8,代碼來源:ncurses.go

示例3: initCurses

func initCurses() {
	C.initscr()
	C.cbreak()
	C.noecho()
	C.nonl()
	C.intrflush(C.stdscr, true)
	C.keypad(C.stdscr, false)
}
開發者ID:jameseb7,項目名稱:roguelike,代碼行數:8,代碼來源:main.go

示例4: Noecho

func Noecho() os.Error {
	in()
	defer out()
	if int(C.noecho()) == 0 {
		return CursesError{"Noecho failed"}
	}
	return nil
}
開發者ID:serraavenger,項目名稱:gocurses,代碼行數:8,代碼來源:curses.go

示例5: Init

func Init(theme *ColorTheme, black bool, mouse bool) {
	C.setlocale(C.LC_ALL, C.CString(""))
	tty := C.c_tty()
	if tty == nil {
		fmt.Println("Failed to open /dev/tty")
		os.Exit(2)
	}
	_screen = C.c_newterm(tty)
	if _screen == nil {
		fmt.Println("Invalid $TERM: " + os.Getenv("TERM"))
		os.Exit(2)
	}
	C.set_term(_screen)
	if mouse {
		C.mousemask(C.ALL_MOUSE_EVENTS, nil)
		C.mouseinterval(0)
	}
	C.noecho()
	C.raw() // stty dsusp undef
	C.nonl()
	C.keypad(C.stdscr, true)

	delay := 50
	delayEnv := os.Getenv("ESCDELAY")
	if len(delayEnv) > 0 {
		num, err := strconv.Atoi(delayEnv)
		if err == nil && num >= 0 {
			delay = num
		}
	}
	C.set_escdelay(C.int(delay))

	_color = theme != nil
	if _color {
		C.start_color()
		InitTheme(theme, black)
		initPairs(theme)
		C.bkgd(C.chtype(C.COLOR_PAIR(C.int(ColNormal))))
		_colorFn = attrColored
	} else {
		_colorFn = attrMono
	}

	C.nodelay(C.stdscr, true)
	ch := C.getch()
	if ch != C.ERR {
		C.ungetch(ch)
	}
	C.nodelay(C.stdscr, false)
}
開發者ID:robertmeta,項目名稱:vimfiles,代碼行數:50,代碼來源:ncurses.go

示例6: Init

func (r *FullscreenRenderer) Init() {
	C.setlocale(C.LC_ALL, C.CString(""))
	tty := C.c_tty()
	if tty == nil {
		errorExit("Failed to open /dev/tty")
	}
	_screen = C.c_newterm(tty)
	if _screen == nil {
		errorExit("Invalid $TERM: " + os.Getenv("TERM"))
	}
	C.set_term(_screen)
	if r.mouse {
		C.mousemask(C.ALL_MOUSE_EVENTS, nil)
		C.mouseinterval(0)
	}
	C.noecho()
	C.raw() // stty dsusp undef
	C.nonl()
	C.keypad(C.stdscr, true)

	delay := 50
	delayEnv := os.Getenv("ESCDELAY")
	if len(delayEnv) > 0 {
		num, err := strconv.Atoi(delayEnv)
		if err == nil && num >= 0 {
			delay = num
		}
	}
	C.set_escdelay(C.int(delay))

	if r.theme != nil {
		C.start_color()
		initTheme(r.theme, r.defaultTheme(), r.forceBlack)
		initPairs(r.theme)
		C.bkgd(C.chtype(C.COLOR_PAIR(C.int(ColNormal.index()))))
		_colorFn = attrColored
	} else {
		initTheme(r.theme, nil, r.forceBlack)
		_colorFn = attrMono
	}

	C.nodelay(C.stdscr, true)
	ch := C.getch()
	if ch != C.ERR {
		C.ungetch(ch)
	}
	C.nodelay(C.stdscr, false)
}
開發者ID:junegunn,項目名稱:fzf,代碼行數:48,代碼來源:ncurses.go

示例7: Init

func Init(theme *ColorTheme, black bool, mouse bool) {
	{
		in, err := os.OpenFile("/dev/tty", syscall.O_RDONLY, 0)
		if err != nil {
			panic("Failed to open /dev/tty")
		}
		_in = in
		// Break STDIN
		// syscall.Dup2(int(in.Fd()), int(os.Stdin.Fd()))
	}

	C.setlocale(C.LC_ALL, C.CString(""))
	_screen = C.newterm(nil, C.stderr, C.stdin)
	C.set_term(_screen)
	if mouse {
		C.mousemask(C.ALL_MOUSE_EVENTS, nil)
	}
	C.cbreak()
	C.noecho()
	C.raw() // stty dsusp undef

	intChan := make(chan os.Signal, 1)
	signal.Notify(intChan, os.Interrupt, os.Kill)
	go func() {
		<-intChan
		Close()
		os.Exit(1)
	}()

	if theme != nil {
		C.start_color()
		initPairs(theme, black)
		_color = attrColored
	} else {
		_color = attrMono
	}
}
開發者ID:blakejennings,項目名稱:fzf,代碼行數:37,代碼來源:curses.go

示例8: Init

func Init(color bool, color256 bool, black bool, mouse bool) {
	{
		in, err := os.OpenFile("/dev/tty", syscall.O_RDONLY, 0)
		if err != nil {
			panic("Failed to open /dev/tty")
		}
		_in = in
		// Break STDIN
		// syscall.Dup2(int(in.Fd()), int(os.Stdin.Fd()))
	}

	C.swapOutput()

	C.setlocale(C.LC_ALL, C.CString(""))
	C.initscr()
	if mouse {
		C.mousemask(C.ALL_MOUSE_EVENTS, nil)
	}
	C.cbreak()
	C.noecho()
	C.raw() // stty dsusp undef

	intChan := make(chan os.Signal, 1)
	signal.Notify(intChan, os.Interrupt, os.Kill)
	go func() {
		<-intChan
		Close()
		os.Exit(1)
	}()

	if color {
		C.start_color()
		var bg C.short
		if black {
			bg = C.COLOR_BLACK
		} else {
			C.use_default_colors()
			bg = -1
		}
		if color256 {
			DarkBG = 236
			C.init_pair(ColPrompt, 110, bg)
			C.init_pair(ColMatch, 108, bg)
			C.init_pair(ColCurrent, 254, DarkBG)
			C.init_pair(ColCurrentMatch, 151, DarkBG)
			C.init_pair(ColSpinner, 148, bg)
			C.init_pair(ColInfo, 144, bg)
			C.init_pair(ColCursor, 161, DarkBG)
			C.init_pair(ColSelected, 168, DarkBG)
		} else {
			DarkBG = C.COLOR_BLACK
			C.init_pair(ColPrompt, C.COLOR_BLUE, bg)
			C.init_pair(ColMatch, C.COLOR_GREEN, bg)
			C.init_pair(ColCurrent, C.COLOR_YELLOW, DarkBG)
			C.init_pair(ColCurrentMatch, C.COLOR_GREEN, DarkBG)
			C.init_pair(ColSpinner, C.COLOR_GREEN, bg)
			C.init_pair(ColInfo, C.COLOR_WHITE, bg)
			C.init_pair(ColCursor, C.COLOR_RED, DarkBG)
			C.init_pair(ColSelected, C.COLOR_MAGENTA, DarkBG)
		}
		_color = attrColored
	} else {
		_color = attrMono
	}
}
開發者ID:zennro,項目名稱:fzf,代碼行數:65,代碼來源:curses.go

示例9: EnableEcho

func EnableEcho() error {
	if int(C.noecho()) == C.ERR {
		return CursesError{"Echo failed"}
	}
	return nil
}
開發者ID:jncorpron,項目名稱:gocurse,代碼行數:6,代碼來源:curses.go

示例10: Echo

func Echo() os.Error {
	if int(C.noecho()) == 0 {
		return CursesError{"Echo failed"}
	}
	return nil
}
開發者ID:AaronO,項目名稱:lightwave,代碼行數:6,代碼來源:curses.go

示例11: Noecho

func Noecho() os.Error {
	if int(C.noecho()) == C.ERR {
		return CursesError{"Noecho failed"}
	}
	return nil
}
開發者ID:akrennmair,項目名稱:gocurse,代碼行數:6,代碼來源:curses.go

示例12: Noecho

func Noecho() error {
	if int(C.noecho()) == 0 {
		return CursesError{"Noecho failed"}
	}
	return nil
}
開發者ID:mpatraw,項目名稱:gocurse,代碼行數:6,代碼來源:curses.go

示例13: Noecho

func Noecho() error {
	if int(C.noecho()) == 0 {
		return ErrorNoEcho
	}
	return nil
}
開發者ID:zozor,項目名稱:gocurse,代碼行數:6,代碼來源:curses.go

示例14: Noecho

// Disables character echoing while reading.
func Noecho() {
	C.noecho()
}
開發者ID:tncardoso,項目名稱:gocurses,代碼行數:4,代碼來源:curses.go

示例15: Noecho

func Noecho() error {
	if C.noecho() == C.ERR {
		return CursesError{"noecho failed"}
	}
	return nil
}
開發者ID:zyxar,項目名稱:gocurse,代碼行數:6,代碼來源:curses.go


注:本文中的C.noecho函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。