--------------------------------------------------------------------------- | Facility : libnform | Function : static int FE_New_Line(FORM * form) | | Description : Perform a new line request. This is rather complex | compared to other routines in this code due to the | rather difficult to understand description in the |
| 2222 | | Function : static int FE_New_Line(FORM * form) |
| 2223 | | |
| 2224 | | Description : Perform a new line request. This is rather complex |
| 2225 | | compared to other routines in this code due to the |
| 2226 | | rather difficult to understand description in the |
| 2227 | | manuals. |
| 2228 | | |
| 2229 | | Return Values : E_OK - success |
| 2230 | | E_REQUEST_DENIED - new line not allowed |
| 2231 | | E_SYSTEM_ERROR - system error |
| 2232 | +--------------------------------------------------------------------------*/ |
| 2233 | static int FE_New_Line(FORM * form) |
| 2234 | { |
| 2235 | FIELD *field = form->current; |
| 2236 | char *bp, *t; |
| 2237 | bool Last_Row = ((field->drows - 1)==form->currow); |
| 2238 | |
| 2239 | if (form->status & _OVLMODE) |
| 2240 | { |
| 2241 | if (Last_Row && |
| 2242 | (!(Growable(field) && !Single_Line_Field(field)))) |
| 2243 | { |
| 2244 | if (!(form->opts & O_NL_OVERLOAD)) |
| 2245 | return(E_REQUEST_DENIED); |
| 2246 | wclrtoeol(form->w); |
| 2247 | /* we have to set this here, although it is also |
| 2248 | handled in the generic routine. The reason is, |
| 2249 | that FN_Next_Field may fail, but the form is |
| 2250 | definitively changed */ |
| 2251 | form->status |= _WINDOW_MODIFIED; |
| 2252 | return Inter_Field_Navigation(FN_Next_Field,form); |
| 2253 | } |
| 2254 | else |
| 2255 | { |
| 2256 | if (Last_Row && !Field_Grown(field,1)) |
| 2257 | { /* N.B.: due to the logic in the 'if', LastRow==TRUE |
| 2258 | means here that the field is growable and not |
| 2259 | a single-line field */ |
| 2260 | return(E_SYSTEM_ERROR); |
| 2261 | } |
| 2262 | wclrtoeol(form->w); |
| 2263 | form->currow++; |
| 2264 | form->curcol = 0; |
| 2265 | form->status |= _WINDOW_MODIFIED; |
| 2266 | return(E_OK); |
| 2267 | } |
| 2268 | } |
| 2269 | else |
| 2270 | { /* Insert Mode */ |
| 2271 | if (Last_Row && |
| 2272 | !(Growable(field) && !Single_Line_Field(field))) |
| 2273 | { |
| 2274 | if (!(form->opts & O_NL_OVERLOAD)) |
| 2275 | return(E_REQUEST_DENIED); |
| 2276 | return Inter_Field_Navigation(FN_Next_Field,form); |
| 2277 | } |
| 2278 | else |
| 2279 | { |
| 2280 | bool May_Do_It = !Last_Row && Is_There_Room_For_A_Line(form); |
| 2281 |
nothing calls this directly
no test coverage detected
searching dependent graphs…