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);
How can i set
bw
flag?
auto_left_margin
(bw
) is one of the terminal capabilities, i. e. it only indicates whether cub1
wraps from column 0 to last column. You cannot change that behavior of the terminal, you can only query it and adapt your program appropriately, e. g. by positioning one line up and to its end with other capabilities.