[英]Termcaps underlining change character
I am currently learning the Termcaps Library
and i want to underline a line. 我目前正在学习
Termcaps Library
并且想在一行下划线。 My problem, when i do it, my character becomes a C
. 我的问题是,当我这样做时,我的角色变成了
C
Does someone have an idea why ? 有人知道为什么吗? I compiled with
-lcurses
This is how I initialized my termcaps : 我使用
-lcurses
编译这是初始化termcaps的方式:
void init_termcaps(t_env *e)
{
char *name_term;
int ierror[2];
name_term = getenv("TERM");
ierror[0] = tgetent(NULL, name_term);
ierror[1] = tcgetattr(0, &e->term);
print_termcaps_error(ierror);
e->term.c_lflag &= ~(ECHO | ICANON);
e->term.c_cc[VMIN] = 1;
e->term.c_cc[VTIME] = 0;
if (tcsetattr(0, TCSANOW, &e->term) == -1)
ft_printexit("ERROR init termcaps\n", 1);
else
ft_putendl("termcaps init done.");
}
and this is how I underlined : 这就是我强调的方式:
void underline_line(t_llist *tmp)
{
int i;
i = 0;
tputs(ft_tgetstr("us"), AFFCNT, ft_iputchar);
while (CONTENT->word[i])
{
tputs(ft_tgetstr("kr"), AFFCNT, ft_iputchar);
i++;
}
tputs(ft_tgetstr("ue"), AFFCNT, ft_iputchar);
while (i-- >= 0)
tputs(ft_tgetstr("le"), AFFCNT, ft_iputchar);
}
Your example tries to underline existing text on the screen by 您的示例尝试通过以下方式在屏幕上对现有文本加下划线:
As a rule, terminals do not work that way. 通常,终端不能以这种方式工作。 Your example should simply (re)print the word to be underlined rather than moving the cursor.
您的示例应仅(重新)打印要加下划线的单词,而不要移动光标。 Video attributes are applied to text as it is printed, and cannot be modified except by rewriting the text.
视频属性将在打印时应用于文本,除非重写文本,否则无法修改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.