Changeset 0331c8f
- Timestamp:
- Jan 24, 2007, 2:23:32 AM (18 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 99c7549
- Parents:
- eeeef20
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fmtext.c
reeeef20 r0331c8f 663 663 // This could be a bitarray if we wanted to save memory. 664 664 int i, j, colors; 665 cpmgr->used = owl_malloc(COLOR_PAIRS * sizeof(char)); 666 memset(cpmgr->used, 0, COLOR_PAIRS * sizeof(char)); 665 cpmgr->next = COLORS; 667 666 668 667 colors = COLORS + 1; // 1 to account for "default". … … 683 682 int i, j, colors; 684 683 owl_colorpair_mgr *cpmgr = owl_global_get_colorpair_mgr(&g); 685 memset(cpmgr->used, 0, COLOR_PAIRS * sizeof(char));684 cpmgr->next = COLORS; 686 685 687 686 colors = COLORS + 1; // 1 to account for "default". … … 715 714 cpmgr = owl_global_get_colorpair_mgr(&g); 716 715 pair = cpmgr->pairs[fg+1][bg]; 717 if (!(pair != -1 && cpmgr->used[pair])) {716 if (!(pair != -1 && pair < cpmgr->next)) { 718 717 // If we didn't find a pair, search for a free one to assign. 719 718 // Skip the first COLORS, since they're static. 720 719 // If we ever get 256 color curses, this will need more thought. 721 for(i = COLORS; i < COLOR_PAIRS; i++) { 722 if (!cpmgr->used[i]) { 723 // Found a free pair 724 pair = i; 725 break; 726 } 727 } 720 pair = (cpmgr->next < COLOR_PAIRS) ? cpmgr->next : -1; 728 721 if (pair != -1) { 729 722 // We found a free pair, initialize it. 730 723 init_pair(pair, fg, bg); 731 724 cpmgr->pairs[fg+1][bg] = pair; 732 cpmgr-> used[pair] = 1;725 cpmgr->next++; 733 726 } else { 734 727 // We still don't have a pair, drop the background color. Too bad.
Note: See TracChangeset
for help on using the changeset viewer.