39
void RichString_attrOn(int attrs) {
40
wattron(workArea, attrs);
43
void RichString_attrOff(int attrs) {
44
wattroff(workArea, attrs);
47
39
void RichString_write(RichString* this, int attrs, char* data) {
49
41
RichString_append(this, attrs, data);
52
void RichString_append(RichString* this, int attrs, char* data) {
44
inline void RichString_append(RichString* this, int attrs, char* data) {
45
RichString_appendn(this, attrs, data, strlen(data));
48
inline void RichString_appendn(RichString* this, int attrs, char* data, int len) {
54
50
workArea = newpad(1, RICHSTRING_MAXLEN);
57
wattron(workArea, attrs);
58
int len = strlen(data);
53
wattrset(workArea, attrs);
59
54
int maxToWrite = (RICHSTRING_MAXLEN - 1) - this->len;
60
55
int wrote = MIN(maxToWrite, len);
61
56
mvwaddnstr(workArea, 0, 0, data, maxToWrite);
75
70
void RichString_applyAttr(RichString *this, int attrs) {
76
for (int i = 0; i < this->len; i++) {
71
for (int i = 0; i < this->len - 1; i++) {
77
72
this->chstr[i] |= attrs;
76
RichString RichString_quickString(int attrs, char* data) {
77
RichString str = RichString_new();
78
RichString_write(&str, attrs, data);