+ add continuous-move "M" to demo_panels to help test refresh changes.
+ improve fix for refresh of window on top of multi-column characters,
taking into account some split characters on left/right window
boundaries.
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1140 2007/06/30 23:37:37 tom Exp $
+-- $Id: NEWS,v 1.1141 2007/07/07 19:55:16 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
+20070707
+ + add continuous-move "M" to demo_panels to help test refresh changes.
+ + improve fix for refresh of window on top of multi-column characters,
+ taking into account some split characters on left/right window
+ boundaries.
+
20070630
+ add "widec" row to _tracedump() output to help diagnose remaining
problems with multi-column characters.
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: dist.mk,v 1.599 2007/06/30 16:01:18 tom Exp $
+# $Id: dist.mk,v 1.600 2007/07/07 16:45:04 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 5
NCURSES_MINOR = 6
-NCURSES_PATCH = 20070630
+NCURSES_PATCH = 20070707
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
#include <curses.priv.h>
-MODULE_ID("$Id: lib_refresh.c,v 1.37 2007/06/30 23:35:43 tom Exp $")
+MODULE_ID("$Id: lib_refresh.c,v 1.40 2007/07/07 22:08:38 tom Exp $")
NCURSES_EXPORT(int)
wrefresh(WINDOW *win)
register struct ldat *oline = &win->_line[src_row];
if (oline->firstchar != _NOCHANGE) {
- int last = oline->lastchar;
+ int last_src = oline->lastchar;
- if (last > limit_x)
- last = limit_x;
+ if (last_src > limit_x)
+ last_src = limit_x;
src_col = oline->firstchar;
dst_col = src_col + begx;
+ if_WIDEC({
+ register int j;
+
+ /*
+ * Ensure that we will copy complete multi-column characters
+ * on the left-boundary.
+ */
+ if (isWidecExt(oline->text[src_col])) {
+ j = 1 + dst_col - WidecExt(oline->text[src_col]);
+ if (j < 0)
+ j = 0;
+ if (dst_col > j) {
+ src_col -= (dst_col - j);
+ dst_col = j;
+ }
+ }
+
+ /*
+ * Ensure that we will copy complete multi-column characters
+ * on the right-boundary.
+ */
+ j = last_src;
+ if (WidecExt(oline->text[j])) {
+ ++j;
+ while (j <= limit_x) {
+ if (isWidecBase(oline->text[j])) {
+ break;
+ } else {
+ last_src = j;
+ }
+ ++j;
+ }
+ }
+ });
+
if_WIDEC({
static cchar_t blank = BLANK;
- int last_col = begx + ((last < win->_maxx)
- ? last
+ int last_dst = begx + ((last_src < win->_maxx)
+ ? last_src
: win->_maxx);
int fix_left = dst_col;
- int fix_right = last_col;
+ int fix_right = last_dst;
register int j;
/*
fix_left = 0; /* only if cell is corrupt */
}
- j = last_col;
+ j = last_dst;
if (WidecExt(nline->text[j]) != 0) {
/*
* On the right, any multi-column character is a problem,
* computation for 'fix_left' accounts for the left-side of
* this character. Find the end of the character.
*/
- fix_right = ++j;
+ ++j;
while (j <= newscr->_maxx && isWidecExt(nline->text[j])) {
fix_right = j++;
}
* The analysis is simpler if we do the clearing afterwards.
* Do that now.
*/
- for (j = fix_left; j < dst_col; ++j) {
- nline->text[j] = blank;
- CHANGED_CELL(nline, j);
- }
- for (j = last_col + 1; j <= fix_right; ++j) {
- nline->text[j] = blank;
- CHANGED_CELL(nline, j);
+ if (fix_left < dst_col || fix_right > last_dst) {
+ for (j = fix_left; j <= fix_right; ++j) {
+ nline->text[j] = blank;
+ CHANGED_CELL(nline, j);
+ }
}
});
/*
* Copy the changed text.
*/
- for (; src_col <= last; src_col++, dst_col++) {
+ for (; src_col <= last_src; src_col++, dst_col++) {
if (!CharEq(oline->text[src_col], nline->text[dst_col])) {
nline->text[dst_col] = oline->text[src_col];
CHANGED_CELL(nline, dst_col);
* authorization. *
****************************************************************************/
/*
- * $Id: demo_panels.c,v 1.22 2007/06/30 21:38:08 tom Exp $
+ * $Id: demo_panels.c,v 1.26 2007/07/07 22:16:33 tom Exp $
*
* Demonstrate a variety of functions from the panel library.
*/
#include <panel.h>
+#define LAST_POS '@'
+#define TEMP_POS '>'
+
typedef void (*InitPanel) (void);
typedef void (*FillPanel) (PANEL *);
{
int result = 0;
int x1, y1;
+ char cmd;
WINDOW *win;
getyx(stdscr, y1, x1);
show_position(text, also, which, y1, x1);
if (log_in != 0) {
- (void) wgetch(stdscr);
- if (fscanf(log_in, "@%d,%d\n", &y1, &x1) == 2) {
- result = 1;
+ if (fscanf(log_in, "%c%d,%d\n", &cmd, &y1, &x1) == 3) {
+ switch (cmd) {
+ case LAST_POS:
+ result = 1;
+ (void) wgetch(stdscr);
+ break;
+ case TEMP_POS:
+ result = 0;
+ wrefresh(stdscr);
+ napms(100);
+ break;
+ default:
+ result = -1;
+ break;
+ }
} else {
result = -1;
}
}
wmove(stdscr, y1, x1);
- if (result > 0) {
+ *ypos = y1;
+ *xpos = x1;
+
+ if (result >= 0) {
if (log_out)
- fprintf(log_out, "@%d,%d\n", y1, x1);
- *ypos = y1;
- *xpos = x1;
+ fprintf(log_out, "%c%d,%d\n",
+ ((result > 0)
+ ? LAST_POS
+ : TEMP_POS),
+ y1, x1);
}
return result;
}
}
static void
-my_move_panel(PANEL ** pans, int which)
+my_move_panel(PANEL ** pans, int which, bool continuous)
{
if (pans[which] != 0) {
int code;
sprintf(also, " (start %d,%d)", y0, x0);
wmove(stdscr, y0, x0);
while ((code = get_position("Move panel", also, which, &x1, &y1)) == 0) {
- ;
+ if (continuous) {
+ move_panel(pans[which], y1, x1);
+ pflush();
+ }
}
if (code > 0) {
move_panel(pans[which], y1, x1);
" c - create the panel",
" d - delete the panel",
" h - hide the panel",
- " m - move the panel",
+ " m - move the panel (M for continuous move)",
" r - resize the panel",
" s - show the panel",
" b - put the panel on the top of the stack"
{
int which = cmd[1] - '0';
+ if (which < 1 || which > MAX_PANELS) {
+ beep();
+ return;
+ }
+
if (log_in != 0) {
pflush();
- (void) wgetch(stdscr);
}
saywhat(cmd);
my_hide_panel(px[which]);
break;
case 'm':
- my_move_panel(px, which);
+ my_move_panel(px, which, FALSE);
+ break;
+ case 'M':
+ my_move_panel(px, which, TRUE);
break;
case 'r':
my_resize_panel(px, which, myFill);
static bool
ok_letter(int ch)
{
- return isalpha(UChar(ch)) && strchr("bcdhmrst", ch) != 0;
+ return isalpha(UChar(ch)) && strchr("bcdhmMrst", ch) != 0;
}
static bool
buffer[length = 0] = '\0';
if (log_in != 0) {
- (void) wgetch(win);
if (fgets(buffer, limit - 3, log_in) != 0) {
length = strlen(buffer);
while (length > 0 && isspace(buffer[length - 1]))
buffer[--length] = '\0';
+ waddstr(win, buffer);
} else {
close_input();
}
+ (void) wgetch(win);
} else {
c0 = 0;
for (;;) {