Echo input LF as CR-LF unless it's the first character. Never store LF

in the buffer.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@810 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2004-03-21 23:25:53 +00:00
parent 43ca8741b0
commit 1285c36f8c

View File

@ -386,7 +386,7 @@ void read_line(int sft_in, int sft_out, keyboard FAR * kp)
unsigned cu_pos = scr_pos; unsigned cu_pos = scr_pos;
unsigned count = 0, stored_pos = 0; unsigned count = 0, stored_pos = 0;
unsigned size = kp->kb_size, stored_size = kp->kb_count; unsigned size = kp->kb_size, stored_size = kp->kb_count;
BOOL insert = FALSE; BOOL insert = FALSE, first = TRUE;
if (size == 0) if (size == 0)
return; return;
@ -404,8 +404,17 @@ void read_line(int sft_in, int sft_out, keyboard FAR * kp)
c = (unsigned)read_char_check_break(sft_in) << 8; c = (unsigned)read_char_check_break(sft_in) << 8;
switch (c) switch (c)
{ {
case LF:
/* show LF if it's not the first character. Never store it */
if (!first)
{
write_char(CR, sft_out);
write_char(LF, sft_out);
}
break;
case CTL_F: case CTL_F:
continue; break;
case RIGHT: case RIGHT:
case F1: case F1:
@ -515,6 +524,7 @@ void read_line(int sft_in, int sft_out, keyboard FAR * kp)
stored_pos++; stored_pos++;
break; break;
} }
first = FALSE;
} while (c != CR); } while (c != CR);
fmemcpy(kp->kb_buf, local_buffer, count); fmemcpy(kp->kb_buf, local_buffer, count);
/* if local_buffer overflows into the CON default buffer we /* if local_buffer overflows into the CON default buffer we