From 1285c36f8c3ee5777cff76ebdcbb9e0ed932bbaf Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Sun, 21 Mar 2004 23:25:53 +0000 Subject: [PATCH] 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 --- kernel/chario.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/kernel/chario.c b/kernel/chario.c index eaf3d92..84a0f27 100644 --- a/kernel/chario.c +++ b/kernel/chario.c @@ -386,7 +386,7 @@ void read_line(int sft_in, int sft_out, keyboard FAR * kp) unsigned cu_pos = scr_pos; unsigned count = 0, stored_pos = 0; unsigned size = kp->kb_size, stored_size = kp->kb_count; - BOOL insert = FALSE; + BOOL insert = FALSE, first = TRUE; if (size == 0) 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; 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: - continue; + break; case RIGHT: case F1: @@ -515,6 +524,7 @@ void read_line(int sft_in, int sft_out, keyboard FAR * kp) stored_pos++; break; } + first = FALSE; } while (c != CR); fmemcpy(kp->kb_buf, local_buffer, count); /* if local_buffer overflows into the CON default buffer we