// strip trailing spaces
for(eol = text->size; eol > offset && isspace((unsigned char) text->text[eol - 1]); eol--);
+ // IS_UNORDERED_LIST_#
if(text->size >= offset + 2 &&
(text->text[offset] == '*' || text->text[offset] == '-') &&
text->text[offset + 1] == ' ') {
- for(i = offset; i<eol; i++)
+ for(i = offset; i<eol; i++) {
if(text->text[i] != '*' &&
text->text[i] != '-' &&
text->text[i] != ' ') {
if(unordered_list_level == 0) {
unordered_list_level = 1;
unordered_list_level_offset[1] = offset;
- }
+ }
switch(unordered_list_level) {
case 1: SET_BIT(bits, IS_UNORDERED_LIST_1); break;
break;
}
+ }
}
if(!CHECK_BIT(bits, IS_UNORDERED_LIST_1) &&
unordered_list_level = 0;
+ // IS_CODE
if(offset >= CODE_INDENT) {
- // IS_CODE
SET_BIT(bits, IS_CODE);
+
} else {
for(i = offset; i < eol; i++) {
if(line->text->text) {
int offset = 0; // text offset
+ // IS_UNORDERED_LIST_3
if(CHECK_BIT(line->bits, IS_UNORDERED_LIST_3)) {
offset = next_nonblank(line->text, 0);
char format_s[15];
- strcpy(&format_s[0], CHECK_BIT(line->bits, IS_UNORDERED_LIST_1)? "| " : " ");
- strcpy(&format_s[4], CHECK_BIT(line->bits, IS_UNORDERED_LIST_2)? "| " : " ");
- strcpy(&format_s[8], line->next && CHECK_BIT(line->next->bits, IS_UNORDERED_LIST_3)? "+-- %s" : "`-- %s");
+ strcpy(&format_s[0], CHECK_BIT(line->bits, IS_UNORDERED_LIST_1)? " | " : " ");
+ strcpy(&format_s[4], CHECK_BIT(line->bits, IS_UNORDERED_LIST_2)? " | " : " ");
+ strcpy(&format_s[8], line->next && CHECK_BIT(line->next->bits, IS_UNORDERED_LIST_3)? " +- %s" : " `- %s");
mvwprintw(window,
y, x,
format_s,
&line->text->text[offset + 2]);
+
+ // IS_UNORDERED_LIST_2
} else if(CHECK_BIT(line->bits, IS_UNORDERED_LIST_2)) {
offset = next_nonblank(line->text, 0);
char format_s[11];
- strcpy(&format_s[0], CHECK_BIT(line->bits, IS_UNORDERED_LIST_1)? "| " : " ");
- strcpy(&format_s[4], line->next && CHECK_BIT(line->next->bits, IS_UNORDERED_LIST_2)? "+-- %s" : "`-- %s");
+ strcpy(&format_s[0], CHECK_BIT(line->bits, IS_UNORDERED_LIST_1)? " | " : " ");
+ strcpy(&format_s[4], line->next && CHECK_BIT(line->next->bits, IS_UNORDERED_LIST_2)? " +- %s" : " `- %s");
mvwprintw(window,
y, x,
format_s,
&line->text->text[offset + 2]);
+
+ // IS_UNORDERED_LIST_1
} else if(CHECK_BIT(line->bits, IS_UNORDERED_LIST_1)) {
offset = next_nonblank(line->text, 0);
char format_s[7];
- strcpy(&format_s[0], line->next && CHECK_BIT(line->next->bits, IS_UNORDERED_LIST_1)? "+-- %s" : "`-- %s");
+ strcpy(&format_s[0], line->next && CHECK_BIT(line->next->bits, IS_UNORDERED_LIST_1)? " +- %s" : " `- %s");
mvwprintw(window,
y, x,
format_s,
&line->text->text[offset + 2]);
- } else
-
// IS_CODE
- if(CHECK_BIT(line->bits, IS_CODE)) {
+ } else if(CHECK_BIT(line->bits, IS_CODE)) {
// set static offset for code
offset = CODE_INDENT;