Handle \r\n at EOL properly.

This commit is contained in:
Nicholas Marriott 2007-10-12 11:44:30 +00:00
parent ad4a7423c0
commit ffa8dcc4da
1 changed files with 11 additions and 10 deletions

21
input.c
View File

@ -1,4 +1,4 @@
/* $Id: input.c,v 1.22 2007-10-10 19:45:20 nicm Exp $ */ /* $Id: input.c,v 1.23 2007-10-12 11:44:30 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -357,20 +357,21 @@ input_handle_character(u_char ch, struct input_ctx *ictx)
{ {
log_debug2("-- ch %zu: %hhu (%c)", ictx->off, ch, ch); log_debug2("-- ch %zu: %hhu (%c)", ictx->off, ch, ch);
if (ictx->s->cx > ictx->s->sx - 1 || ictx->s->cy > ictx->s->sy - 1) if (ictx->s->cx > ictx->s->sx || ictx->s->cy > ictx->s->sy - 1)
return; return;
if (ictx->s->cx == ictx->s->sx) {
input_store8(ictx->b, '\r');
input_store8(ictx->b, '\n');
ictx->s->cx = 0;
screen_cursor_down_scroll(ictx->s);
}
screen_write_character(ictx->s, ch); screen_write_character(ictx->s, ch);
input_store8(ictx->b, ch); input_store8(ictx->b, ch);
if (ictx->s->cx == ictx->s->sx - 1) { ictx->s->cx++;
ictx->s->cx = 0;
screen_cursor_down_scroll(ictx->s);
input_store8(ictx->b, '\r');
input_store8(ictx->b, '\n');
} else
ictx->s->cx++;
} }
void void