Andrew Arrow
Andrew Arrow

Reputation: 4575

how do I control where text is printed to console via fmt?

When running vim if I type : the input cursor goes to bottom row of the screen and I can type a command, then go back to the top of the screen. Arrow keys let me move around, all that jazz. In Golang using the fmt package how can I do this?

Upvotes: 0

Views: 481

Answers (1)

photoionized
photoionized

Reputation: 5232

I think you're kind of confused. What fmt is essentially equivalent to are C's printf and scanf family of functions. The complexity of controlling the screen buffer is quite a bit more complex than just printing some stuff in a terminal output.

The behavior you're talking about is a result of vim's integration with the ncurses library (or something similar to it). Haven't ever used this, but here's a link to an ncurses wrapper in cgo, which you could probably use to do something like vim does.

Upvotes: 3

Related Questions