Changeset 9efa5bd for owl.c


Ignore:
Timestamp:
May 1, 2011, 5:29:25 PM (13 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.8, release-1.9
Children:
7b4f3be
Parents:
4fd211f
git-author:
David Benjamin <davidben@mit.edu> (04/26/11 21:07:08)
git-committer:
David Benjamin <davidben@mit.edu> (05/01/11 17:29:25)
Message:
Clamp the number of color pairs to 256 without ext-color

Debian doesn't build their ncurses with ext-color support, so it only
supports 256 colorpairs. However, ncurses still reports the full 32768
value, and color pairs end up trampling over each other.

When 256 is exceeded, the existing colorpair reset logic will now kick
in and fix things. Reword a comment accordingly.

While I'm here, get rid of the colorpairs member in owl_global. ncurses'
works just fine.

Reported-by: Mats Ahlgren <mats_a@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    ra2a8833 r9efa5bd  
    444444  /* update the terminal if we need to */
    445445  owl_window_redraw_scheduled();
    446   /* On colorpair shortage, reset and redraw /everything/. NOTE: if
    447    * the current screen uses too many colorpairs, this draws
    448    * everything twice. But this is unlikely; COLOR_PAIRS is 64 with
    449    * 8+1 colors, and 256^2 with 256+1 colors. (+1 for default.) */
     446  /* On colorpair shortage, reset and redraw /everything/. NOTE: if we
     447   * still overflow, this be useless work. With 8-colors, we get 64
     448   * pairs. With 256-colors, we get 32768 pairs with ext-colors
     449   * support and 256 otherwise. */
    450450  cpmgr = owl_global_get_colorpair_mgr(&g);
    451451  if (cpmgr->overflow) {
    452     owl_function_debugmsg("colorpairs: color shortage; reset pairs and redraw. COLOR_PAIRS = %d", COLOR_PAIRS);
     452    owl_function_debugmsg("colorpairs: used all %d pairs; reset pairs and redraw.",
     453                          owl_util_get_colorpairs());
    453454    owl_fmtext_reset_colorpairs(cpmgr);
    454455    owl_function_full_redisplay();
Note: See TracChangeset for help on using the changeset viewer.