Commit 4b8f9361 authored by Jiri Slaby (SUSE)'s avatar Jiri Slaby (SUSE) Committed by Greg Kroah-Hartman

tty: vt: define an enum for CSI+J codes

Decrypt the constant values by proper enum names. This time in csi_J().
Signed-off-by: default avatar"Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Tested-by: Helge Deller <deller@gmx.de> # parisc STI console
Link: https://lore.kernel.org/r/20240122110401.7289-12-jirislaby@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 76ec3a7a
...@@ -1498,13 +1498,20 @@ static inline void del(struct vc_data *vc) ...@@ -1498,13 +1498,20 @@ static inline void del(struct vc_data *vc)
/* ignored */ /* ignored */
} }
static void csi_J(struct vc_data *vc, int vpar) enum CSI_J {
CSI_J_CURSOR_TO_END = 0,
CSI_J_START_TO_CURSOR = 1,
CSI_J_VISIBLE = 2,
CSI_J_FULL = 3,
};
static void csi_J(struct vc_data *vc, enum CSI_J vpar)
{ {
unsigned int count; unsigned int count;
unsigned short * start; unsigned short * start;
switch (vpar) { switch (vpar) {
case 0: /* erase from cursor to end of display */ case CSI_J_CURSOR_TO_END:
vc_uniscr_clear_line(vc, vc->state.x, vc_uniscr_clear_line(vc, vc->state.x,
vc->vc_cols - vc->state.x); vc->vc_cols - vc->state.x);
vc_uniscr_clear_lines(vc, vc->state.y + 1, vc_uniscr_clear_lines(vc, vc->state.y + 1,
...@@ -1512,16 +1519,16 @@ static void csi_J(struct vc_data *vc, int vpar) ...@@ -1512,16 +1519,16 @@ static void csi_J(struct vc_data *vc, int vpar)
count = (vc->vc_scr_end - vc->vc_pos) >> 1; count = (vc->vc_scr_end - vc->vc_pos) >> 1;
start = (unsigned short *)vc->vc_pos; start = (unsigned short *)vc->vc_pos;
break; break;
case 1: /* erase from start to cursor */ case CSI_J_START_TO_CURSOR:
vc_uniscr_clear_line(vc, 0, vc->state.x + 1); vc_uniscr_clear_line(vc, 0, vc->state.x + 1);
vc_uniscr_clear_lines(vc, 0, vc->state.y); vc_uniscr_clear_lines(vc, 0, vc->state.y);
count = ((vc->vc_pos - vc->vc_origin) >> 1) + 1; count = ((vc->vc_pos - vc->vc_origin) >> 1) + 1;
start = (unsigned short *)vc->vc_origin; start = (unsigned short *)vc->vc_origin;
break; break;
case 3: /* include scrollback */ case CSI_J_FULL:
flush_scrollback(vc); flush_scrollback(vc);
fallthrough; fallthrough;
case 2: /* erase whole display */ case CSI_J_VISIBLE:
vc_uniscr_clear_lines(vc, 0, vc->vc_rows); vc_uniscr_clear_lines(vc, 0, vc->vc_rows);
count = vc->vc_cols * vc->vc_rows; count = vc->vc_cols * vc->vc_rows;
start = (unsigned short *)vc->vc_origin; start = (unsigned short *)vc->vc_origin;
...@@ -2110,7 +2117,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear) ...@@ -2110,7 +2117,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear)
gotoxy(vc, 0, 0); gotoxy(vc, 0, 0);
save_cur(vc); save_cur(vc);
if (do_clear) if (do_clear)
csi_J(vc, 2); csi_J(vc, CSI_J_VISIBLE);
} }
static void vc_setGx(struct vc_data *vc, unsigned int which, int c) static void vc_setGx(struct vc_data *vc, unsigned int which, int c)
...@@ -2526,7 +2533,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) ...@@ -2526,7 +2533,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
/* DEC screen alignment test. kludge :-) */ /* DEC screen alignment test. kludge :-) */
vc->vc_video_erase_char = vc->vc_video_erase_char =
(vc->vc_video_erase_char & 0xff00) | 'E'; (vc->vc_video_erase_char & 0xff00) | 'E';
csi_J(vc, 2); csi_J(vc, CSI_J_VISIBLE);
vc->vc_video_erase_char = vc->vc_video_erase_char =
(vc->vc_video_erase_char & 0xff00) | ' '; (vc->vc_video_erase_char & 0xff00) | ' ';
do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2); do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2);
...@@ -3498,7 +3505,7 @@ static int __init con_init(void) ...@@ -3498,7 +3505,7 @@ static int __init con_init(void)
set_origin(vc); set_origin(vc);
save_screen(vc); save_screen(vc);
gotoxy(vc, vc->state.x, vc->state.y); gotoxy(vc, vc->state.x, vc->state.y);
csi_J(vc, 0); csi_J(vc, CSI_J_CURSOR_TO_END);
update_screen(vc); update_screen(vc);
pr_info("Console: %s %s %dx%d\n", pr_info("Console: %s %s %dx%d\n",
vc->vc_can_do_color ? "colour" : "mono", vc->vc_can_do_color ? "colour" : "mono",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment