/****************************************************************************
- * Copyright (c) 1998-2014,2015 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2016,2017 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 *
*
*-----------------------------------------------------------------*/
+#define NEW_PAIR_INTERNAL 1
+
#include <curses.priv.h>
#ifndef CUR
#include <ctype.h>
-MODULE_ID("$Id: tty_update.c,v 1.282 2015/12/20 00:59:09 tom Exp $")
+MODULE_ID("$Id: tty_update.c,v 1.287 2017/02/28 22:13:45 tom Exp $")
/*
* This define controls the line-breakout optimization. Every once in a
if (!SP_PARM->_default_color)
return FALSE;
- if (SP_PARM->_default_fg != C_MASK || SP_PARM->_default_bg != C_MASK)
+ if (!(isDefaultColor(SP_PARM->_default_fg) &&
+ isDefaultColor(SP_PARM->_default_bg)))
return FALSE;
if ((pair = GetPair(CHDEREF(ch))) != 0) {
NCURSES_COLOR_T fg, bg;
if (NCURSES_SP_NAME(pair_content) (NCURSES_SP_ARGx
(short) pair,
&fg, &bg) == ERR
- || (fg != C_MASK || bg != C_MASK)) {
+ || !(isDefaultColor(fg) && isDefaultColor(bg))) {
return FALSE;
}
}
TPARM_2(repeat_char,
CharOf(ntext0),
rep_count),
- rep_count,
+ 1,
NCURSES_SP_NAME(_nc_outch));
SP_PARM->_curscol += rep_count;
int row,
int first, int last)
{
- int i, j, same;
int rc;
TR(TRACE_CHARPUT, ("PutRange(%p, %p, %p, %d, %d, %d)",
if (otext != ntext
&& (last - first + 1) > SP_PARM->_inline_cost) {
+ int i, j, same;
+
for (j = first, same = 0; j <= last; j++) {
if (!same && isWidecExt(otext[j]))
continue;
static void
ClrToEOL(NCURSES_SP_DCLx NCURSES_CH_T blank, int needclear)
{
- int j;
-
if (CurScreen(SP_PARM) != 0
&& SP_PARM->_cursrow >= 0) {
+ int j;
+
for (j = SP_PARM->_curscol; j < screen_columns(SP_PARM); j++) {
if (j >= 0) {
NCURSES_CH_T *cp =
static int
ClrBottom(NCURSES_SP_DCLx int total)
{
- int row;
- int col;
int top = total;
int last = min(screen_columns(SP_PARM), NewScreen(SP_PARM)->_maxx + 1);
NCURSES_CH_T blank = NewScreen(SP_PARM)->_line[total - 1].text[last - 1];
- bool ok;
if (clr_eos && can_clear_with(NCURSES_SP_ARGx CHREF(blank))) {
+ int row;
for (row = total - 1; row >= 0; row--) {
+ int col;
+ bool ok;
+
for (col = 0, ok = TRUE; ok && col < last; col++) {
ok = (CharEq(NewScreen(SP_PARM)->_line[row].text[col], blank));
}
&& unColor(oldLine[n]) == unColor(newLine[n])) {
if (oldPair < SP_PARM->_pair_limit
&& newPair < SP_PARM->_pair_limit
- && (SP_PARM->_color_pairs[oldPair] ==
- SP_PARM->_color_pairs[newPair])) {
+ && (isSamePair(SP_PARM->_color_pairs[oldPair],
+ SP_PARM->_color_pairs[newPair]))) {
SetPair(oldLine[n], GetPair(newLine[n]));
}
}
TPUTS_TRACE("parm_ich");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
TPARM_1(parm_ich, count),
- count,
+ 1,
NCURSES_SP_NAME(_nc_outch));
- while (count) {
+ while (count > 0) {
PutAttrChar(NCURSES_SP_ARGx CHREF(*line));
line++;
count--;
}
} else if (enter_insert_mode && exit_insert_mode) {
NCURSES_PUTP2("enter_insert_mode", enter_insert_mode);
- while (count) {
+ while (count > 0) {
PutAttrChar(NCURSES_SP_ARGx CHREF(*line));
if (insert_padding) {
NCURSES_PUTP2("insert_padding", insert_padding);
}
NCURSES_PUTP2("exit_insert_mode", exit_insert_mode);
} else {
- while (count) {
+ while (count > 0) {
NCURSES_PUTP2("insert_character", insert_character);
PutAttrChar(NCURSES_SP_ARGx CHREF(*line));
if (insert_padding) {
static void
DelChar(NCURSES_SP_DCLx int count)
{
- int n;
-
TR(TRACE_UPDATE, ("DelChar(%p, %d) called, position = (%ld,%ld)",
(void *) SP_PARM, count,
(long) NewScreen(SP_PARM)->_cury,
TPUTS_TRACE("parm_dch");
NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
TPARM_1(parm_dch, count),
- count,
+ 1,
NCURSES_SP_NAME(_nc_outch));
} else {
+ int n;
+
for (n = 0; n < count; n++) {
NCURSES_PUTP2("delete_character", delete_character);
}