提交 f1869a89 编写于 作者: L Linus Torvalds

tty: vt: fix up tabstops properly

Tabs on a console with long lines do not wrap properly, so correctly
account for the line length when computing the tab placement location.
Reported-by: NJames Holderness <j4_james@hotmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 e43d40b3
...@@ -1727,7 +1727,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear) ...@@ -1727,7 +1727,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear)
default_attr(vc); default_attr(vc);
update_attr(vc); update_attr(vc);
vc->vc_tab_stop[0] = 0x01010100; vc->vc_tab_stop[0] =
vc->vc_tab_stop[1] = vc->vc_tab_stop[1] =
vc->vc_tab_stop[2] = vc->vc_tab_stop[2] =
vc->vc_tab_stop[3] = vc->vc_tab_stop[3] =
...@@ -1771,7 +1771,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) ...@@ -1771,7 +1771,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
vc->vc_pos -= (vc->vc_x << 1); vc->vc_pos -= (vc->vc_x << 1);
while (vc->vc_x < vc->vc_cols - 1) { while (vc->vc_x < vc->vc_cols - 1) {
vc->vc_x++; vc->vc_x++;
if (vc->vc_tab_stop[vc->vc_x >> 5] & (1 << (vc->vc_x & 31))) if (vc->vc_tab_stop[7 & (vc->vc_x >> 5)] & (1 << (vc->vc_x & 31)))
break; break;
} }
vc->vc_pos += (vc->vc_x << 1); vc->vc_pos += (vc->vc_x << 1);
...@@ -1831,7 +1831,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) ...@@ -1831,7 +1831,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
lf(vc); lf(vc);
return; return;
case 'H': case 'H':
vc->vc_tab_stop[vc->vc_x >> 5] |= (1 << (vc->vc_x & 31)); vc->vc_tab_stop[7 & (vc->vc_x >> 5)] |= (1 << (vc->vc_x & 31));
return; return;
case 'Z': case 'Z':
respond_ID(tty); respond_ID(tty);
...@@ -2024,7 +2024,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) ...@@ -2024,7 +2024,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
return; return;
case 'g': case 'g':
if (!vc->vc_par[0]) if (!vc->vc_par[0])
vc->vc_tab_stop[vc->vc_x >> 5] &= ~(1 << (vc->vc_x & 31)); vc->vc_tab_stop[7 & (vc->vc_x >> 5)] &= ~(1 << (vc->vc_x & 31));
else if (vc->vc_par[0] == 3) { else if (vc->vc_par[0] == 3) {
vc->vc_tab_stop[0] = vc->vc_tab_stop[0] =
vc->vc_tab_stop[1] = vc->vc_tab_stop[1] =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册