/****************************************************************************
- * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include "form.priv.h"
-MODULE_ID("$Id: frm_driver.c,v 1.95 2009/12/05 21:45:58 Rafael.Garrido.Fernandez Exp $")
+MODULE_ID("$Id: frm_driver.c,v 1.99 2011/09/17 22:12:10 tom Exp $")
/*----------------------------------------------------------------------------
This is the core module of the form library. It contains the majority
field->opts = oldopts;
returnCode(E_CURRENT);
}
- if ((form->curpage == field->page))
+ if (form->curpage == field->page)
{
if (changed_opts & O_VISIBLE)
{
* field->cols))))
RETURN(E_SYSTEM_ERROR);
+#if !USE_WIDEC_SUPPORT
len = vlen;
+#endif
}
}
}
len = Buffer_Length(field);
wclear(field->working);
- mvwaddstr(field->working, 0, 0, value);
+ (void)mvwaddstr(field->working, 0, 0, value);
if ((widevalue = typeCalloc(FIELD_CELL, len + 1)) == 0)
{
{
for (i = 0; i < (unsigned)field->drows; ++i)
{
- mvwin_wchnstr(field->working, 0, i * field->dcols,
- widevalue + (i * field->dcols),
- field->dcols);
+ (void)mvwin_wchnstr(field->working, 0, i * field->dcols,
+ widevalue + (i * field->dcols),
+ field->dcols);
}
for (i = 0; i < len; ++i)
{
/* determine the number of bytes needed to store the expanded string */
for (n = 0; n < size; ++n)
{
- if (!isWidecExt(data[n]))
+ if (!isWidecExt(data[n]) && data[n].chars[0] != L'\0')
{
mbstate_t state;
size_t next;
free(field->expanded[buffer]);
field->expanded[buffer] = typeMalloc(char, need + 1);
- /* expand the multibyte data */
+ /*
+ * Expand the multibyte data.
+ *
+ * It may also be multi-column data. In that case, the data for a row
+ * may be null-padded to align to the dcols/drows layout (or it may
+ * contain embedded wide-character extensions). Change the null-padding
+ * to blanks as needed.
+ */
if ((result = field->expanded[buffer]) != 0)
{
wclear(field->working);
- mvwadd_wchnstr(field->working, 0, 0, data, size);
- mvwinnstr(field->working, 0, 0, result, (int)need);
+ wmove(field->working, 0, 0);
+ for (n = 0; n < size; ++n)
+ {
+ if (!isWidecExt(data[n]) && data[n].chars[0] != L'\0')
+ wadd_wch(field->working, &data[n]);
+ }
+ wmove(field->working, 0, 0);
+ winnstr(field->working, result, (int)need);
}
#else
result = Address_Of_Nth_Buffer(field, buffer);