I'm studying termcap library. And I'm trying to do a line editor in the terminal. I have a cursor that can move on the line. Everything works great with one line. But if my line is bigger than terminal width, I can't return my cursor from the second line to the first using le
command (move cursor to the left). I need to set bw
flag to do this. function tgetflag()
only return a value. I think that I need to set this flag using tcsetsttr()
but can't find the right flag-macro. How can I set bw
flag?
struct termios stored_settings;
struct termios new_settings;
tcgetattr(0, &stored_settings);
new_settings = stored_settings;
new_settings.c_lflag &= (~ICANON & ~ECHO);
new_settings.c_cc[VTIME] = 0;
new_settings.c_cc[VMIN] = 1;
tcsetattr(0, TCSANOW, &new_settings);