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

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

Decrypt the constant values by proper enum names. This time in csi_K().
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-16-jirislaby@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8e6bd49a
...@@ -1542,6 +1542,12 @@ static void csi_J(struct vc_data *vc, enum CSI_J vpar) ...@@ -1542,6 +1542,12 @@ static void csi_J(struct vc_data *vc, enum CSI_J vpar)
vc->vc_need_wrap = 0; vc->vc_need_wrap = 0;
} }
enum {
CSI_K_CURSOR_TO_LINEEND = 0,
CSI_K_LINESTART_TO_CURSOR = 1,
CSI_K_LINE = 2,
};
static void csi_K(struct vc_data *vc) static void csi_K(struct vc_data *vc)
{ {
unsigned int count; unsigned int count;
...@@ -1549,15 +1555,15 @@ static void csi_K(struct vc_data *vc) ...@@ -1549,15 +1555,15 @@ static void csi_K(struct vc_data *vc)
int offset; int offset;
switch (vc->vc_par[0]) { switch (vc->vc_par[0]) {
case 0: /* erase from cursor to end of line */ case CSI_K_CURSOR_TO_LINEEND:
offset = 0; offset = 0;
count = vc->vc_cols - vc->state.x; count = vc->vc_cols - vc->state.x;
break; break;
case 1: /* erase from start of line to cursor */ case CSI_K_LINESTART_TO_CURSOR:
offset = -vc->state.x; offset = -vc->state.x;
count = vc->state.x + 1; count = vc->state.x + 1;
break; break;
case 2: /* erase whole line */ case CSI_K_LINE:
offset = -vc->state.x; offset = -vc->state.x;
count = vc->vc_cols; count = vc->vc_cols;
break; break;
......
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