X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=form%2Ffrm_data.c;h=940c32db99c60d23bf3a3e01e6661267f99924a0;hp=61ee30bb75f9a2dfecff171cccb744495e6efdce;hb=643ec2bf782cd02efafe3ccdeaea8920a404645e;hpb=04d942c3d98cf0a929c6afb17be8c10d4ae39af0 diff --git a/form/frm_data.c b/form/frm_data.c index 61ee30bb..940c32db 100644 --- a/form/frm_data.c +++ b/form/frm_data.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020 Thomas E. Dickey * + * Copyright 2020,2021 Thomas E. Dickey * * Copyright 1998-2010,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -33,12 +33,12 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_data.c,v 1.18 2020/05/24 01:40:20 anonymous.maarten Exp $") +MODULE_ID("$Id: frm_data.c,v 1.21 2021/06/17 21:11:08 tom Exp $") /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : bool data_behind(const FORM *form) -| +| | Description : Check for off-screen data behind. This is nearly trivial | because the beginning of a field is fixed. | @@ -70,12 +70,12 @@ data_behind(const FORM *form) } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static char * Only_Padding( | WINDOW *w, | int len, | int pad) -| +| | Description : Test if 'length' cells starting at the current position | contain a padding character. | @@ -104,7 +104,7 @@ Only_Padding(WINDOW *w, int len, int pad) } } #else - cell = (FIELD_CELL) winch(w); + cell = (FIELD_CELL)winch(w); if (ChCharOf(cell) != ChCharOf(pad)) { result = FALSE; @@ -123,11 +123,11 @@ Only_Padding(WINDOW *w, int len, int pad) } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : bool data_ahead(const FORM *form) -| +| | Description : Check for off-screen data ahead. This is more difficult -| because a dynamic field has a variable end. +| because a dynamic field has a variable end. | | Return Values : TRUE - there are off-screen data ahead | FALSE - there are no off-screen data ahead @@ -150,12 +150,11 @@ data_ahead(const FORM *form) if (Single_Line_Field(field)) { - int check_len; - pos = form->begincol + field->cols; while (pos < field->dcols) { - check_len = field->dcols - pos; + int check_len = field->dcols - pos; + if (check_len >= field->cols) check_len = field->cols; cursor_moved = TRUE;