/****************************************************************************
- * Copyright 2018-2020,2021 Thomas E. Dickey *
+ * Copyright 2018-2022,2023 Thomas E. Dickey *
* Copyright 1998-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
#define CUR SP_TERMTYPE
#endif
-MODULE_ID("$Id: lib_mvcur.c,v 1.156 2021/09/04 10:29:15 tom Exp $")
+MODULE_ID("$Id: lib_mvcur.c,v 1.161 2023/09/16 16:29:02 tom Exp $")
#define WANT_CHAR(sp, y, x) NewScreen(sp)->_line[y].text[x] /* desired state */
/* extract padding, either mandatory or required */
if (cp[0] == '$' && cp[1] == '<' && strchr(cp, '>')) {
float number = 0.0;
+ int state = 0;
for (cp += 2; *cp != '>'; cp++) {
- if (isdigit(UChar(*cp)))
- number = number * 10 + (float) (*cp - '0');
- else if (*cp == '*')
- number *= (float) affcnt;
- else if (*cp == '.' && (*++cp != '>') && isdigit(UChar(*cp)))
- number += (float) ((*cp - '0') / 10.0);
+ if (isdigit(UChar(*cp))) {
+ switch (state) {
+ case 0:
+ number = number * 10 + (float) (*cp - '0');
+ break;
+ case 2:
+ number += (float) ((*cp - '0') / 10.0);
+ ++state;
+ break;
+ }
+ } else if (*cp == '*') {
+ /* padding is always a suffix */
+ if (state < 4) {
+ number *= (float) affcnt;
+ state = 4;
+ }
+ } else if (*cp == '.') {
+ /* a single decimal point is allowed */
+ state = (state == 0) ? 2 : 3;
+ }
+ if (number > MAX_DELAY_MSECS) {
+ number = MAX_DELAY_MSECS;
+ break;
+ }
}
#if NCURSES_NO_PADDING
1);
SP_PARM->_hpa_ch_cost = NormalizedCost(TIPARM_1(column_address, 23), 1);
SP_PARM->_cuf_ch_cost = NormalizedCost(TIPARM_1(parm_right_cursor, 23), 1);
- SP_PARM->_inline_cost = min(SP_PARM->_cup_ch_cost,
- min(SP_PARM->_hpa_ch_cost,
+ SP_PARM->_inline_cost = Min(SP_PARM->_cup_ch_cost,
+ Min(SP_PARM->_hpa_ch_cost,
SP_PARM->_cuf_ch_cost));
/*
NCURSES_SP_NAME(_nc_mvcur_wrap) (NCURSES_SP_DCL0)
/* wrap up cursor-addressing mode */
{
- /* leave cursor at screen bottom */
- TINFO_MVCUR(NCURSES_SP_ARGx -1, -1, screen_lines(SP_PARM) - 1, 0);
-
if (!SP_PARM || !IsTermInfo(SP_PARM))
return;
+ /* leave cursor at screen bottom */
+ TINFO_MVCUR(NCURSES_SP_ARGx -1, -1, screen_lines(SP_PARM) - 1, 0);
+
/* set cursor to normal mode */
if (SP_PARM->_cursor != -1) {
int cursor = SP_PARM->_cursor;
* and the time the structure WANT_CHAR would access has been
* updated.
*/
- if (ovw) {
+ if (ovw && to_y >= 0) {
int i;
for (i = 0; i < n; i++) {
}
}
}
- if (ovw) {
+ if (ovw && to_y >= 0) {
int i;
for (i = 0; i < n; i++)