diff --git a/src/boxes.c b/src/boxes.c index 42a1261..9963c3c 100644 --- a/src/boxes.c +++ b/src/boxes.c @@ -1488,7 +1488,6 @@ static int read_all_input(const int use_stdin) */ input.lines[input.anz_lines].text = NULL; /* we haven't used it yet! */ analyze_line_ascii(input.lines + input.anz_lines); - input.lines[input.anz_lines].num_leading_blanks = 0; ++input.anz_lines; } diff --git a/src/boxes.in.h b/src/boxes.in.h index 46d60c6..52b887f 100644 --- a/src/boxes.in.h +++ b/src/boxes.in.h @@ -164,7 +164,6 @@ typedef struct { size_t *tabpos; /* tab positions in expanded work strings, or NULL if not needed */ size_t tabpos_len; /* number of tabs in a line */ - size_t num_leading_blanks; /* number of spaces at the start of the line after justification */ size_t *posmap; /* for each character in `text`, position of corresponding char in `mbtext`. Needed for box removal. */ } line_t; diff --git a/src/generate.c b/src/generate.c index 7a26432..a3f53cc 100644 --- a/src/generate.c +++ b/src/generate.c @@ -718,11 +718,9 @@ static int justify_line(line_t *line, int skew) */ { if (empty_line(line)) { - line->num_leading_blanks = SIZE_MAX; return 0; } if (opt.justify == '\0') { - line->num_leading_blanks = 0; return 0; } @@ -742,11 +740,9 @@ static int justify_line(line_t *line, int skew) case 'l': if (opt.design->indentmode == 't') { /* text indented inside of box */ - line->num_leading_blanks = input.indent; result = (int) input.indent - (int) initial_space_size; } else { - line->num_leading_blanks = 0; result = -1 * (int) initial_space_size; } break; @@ -766,24 +762,21 @@ static int justify_line(line_t *line, int skew) ++shift; } } - line->num_leading_blanks = shift; result = (int) shift - (int) initial_space_size; break; case 'r': shift = input.maxline - newlen; - line->num_leading_blanks = shift; result = (int) shift - (int) initial_space_size; break; default: fprintf(stderr, "%s: internal error (unknown justify option: %c)\n", PROJECT, opt.justify); - line->num_leading_blanks = 0; result = 0; } #if defined(DEBUG) || 0 - fprintf (stderr, " -> %d (%d leading spaces)\n", result, (int) line->num_leading_blanks); + fprintf (stderr, " -> %d\n", result); #endif return result; } @@ -807,7 +800,7 @@ int output_box(const sentry_t *thebox) size_t nol = thebox[BRIG].height; /* number of output lines */ char *indentspc; int indentspclen; - size_t vfill, vfill1, vfill1_save, vfill2; /* empty lines/columns in box */ + size_t vfill, vfill1, vfill2; /* empty lines/columns in box */ size_t hfill; char *hfill1, *hfill2; /* space before/after text */ size_t hpl, hpr; @@ -818,7 +811,6 @@ int output_box(const sentry_t *thebox) size_t skip_left; /* true if left box part is to be skipped */ int ntabs, nspcs; /* needed for unexpand of tabs */ char *restored_indent; - size_t *contentPos; /* column of first char of input text in output text */ #ifdef DEBUG fprintf (stderr, "Padding used: left %d, top %d, right %d, bottom %d\n", @@ -883,7 +875,6 @@ int output_box(const sentry_t *thebox) vfill1 += opt.design->padding[BTOP]; vfill2 += opt.design->padding[BBOT]; vfill += opt.design->padding[BTOP] + opt.design->padding[BBOT]; - vfill1_save = vfill1; /* * Provide strings for horizontal text alignment. @@ -962,7 +953,6 @@ int output_box(const sentry_t *thebox) /* * Generate actual output */ - contentPos = calloc(input.anz_lines, sizeof(size_t)); for (j = skip_start; j < nol - skip_end; ++j) { if (j < thebox[BTOP].height) { /* box top */ @@ -985,14 +975,6 @@ int output_box(const sentry_t *thebox) if (ti < (long) input.anz_lines) { /* box content (lines) */ int shift = justify_line(input.lines + ti, hpr - hpl); restored_indent = tabbify_indent(ti, indentspc, indentspclen); - if (input.lines[ti].num_leading_blanks == SIZE_MAX) { - contentPos[ti] = SIZE_MAX; - } else { - contentPos[ti] = strlen(restored_indent) - + (skip_left ? 0 : strlen(thebox[BLEF].chars[j])) - + strlen(hfill1) - + input.lines[ti].num_leading_blanks; - } uint32_t *mbtext_shifted = advance32(input.lines[ti].mbtext, shift < 0 ? (size_t) (-shift) : 0); concat_strings(obuf, LINE_MAX_BYTES + 1, 8, restored_indent, skip_left ? "" : thebox[BLEF].chars[j], hfill1, @@ -1033,17 +1015,6 @@ int output_box(const sentry_t *thebox) fprintf(opt.outfile, "%s%s", obuf, (input.final_newline || j < nol - skip_end - 1 ? "\n" : "")); } - /* add info line for web ui if requested with -q */ - if (query_is_undoc()) { - fprintf(opt.outfile, "%d ", (int) (thebox[BTOP].height + vfill1_save - skip_start)); - for (j = 0; j < input.anz_lines; j++) { - fprintf(opt.outfile, "%d%s", - (contentPos[j] == SIZE_MAX ? (int) -1 : (int) contentPos[j]), - j < input.anz_lines - 1 ? " " : "\n"); - } - } - - BFREE (contentPos); BFREE (indentspc); BFREE (hfill1); BFREE (hfill2); diff --git a/test/085_q_option_center.txt b/test/085_q_option_center.txt deleted file mode 100644 index 5f87aee..0000000 --- a/test/085_q_option_center.txt +++ /dev/null @@ -1,13 +0,0 @@ -:ARGS --ac -q (undoc) -s 12 -:INPUT -foo -barf -:OUTPUT-FILTER -:EXPECTED -/**********/ -/* foo */ -/* barf */ -/**********/ -1 4 4 -:EOF diff --git a/test/086_q_option_right.txt b/test/086_q_option_right.txt deleted file mode 100644 index 8bc06b0..0000000 --- a/test/086_q_option_right.txt +++ /dev/null @@ -1,13 +0,0 @@ -:ARGS --ar -q (undoc) -s 12 -:INPUT -foo -barf -:OUTPUT-FILTER -:EXPECTED -/**********/ -/* foo */ -/* barf */ -/**********/ -1 6 5 -:EOF diff --git a/test/087_q_option_left.txt b/test/087_q_option_left.txt deleted file mode 100644 index 33124a0..0000000 --- a/test/087_q_option_left.txt +++ /dev/null @@ -1,13 +0,0 @@ -:ARGS --q (undoc) -s 12 -:INPUT -foo -barf -:OUTPUT-FILTER -:EXPECTED -/**********/ -/* foo */ -/* barf */ -/**********/ -1 3 3 -:EOF diff --git a/test/088_q_option_center_padded.txt b/test/088_q_option_center_padded.txt deleted file mode 100644 index fbe1894..0000000 --- a/test/088_q_option_center_padded.txt +++ /dev/null @@ -1,14 +0,0 @@ -:ARGS --ac -q (undoc) -s 18x5 -p h3 -:INPUT -foo -barf -:OUTPUT-FILTER -:EXPECTED -/****************/ -/* foo */ -/* barf */ -/* */ -/****************/ -1 7 7 -:EOF diff --git a/test/089_q_option_center_padded_indented.txt b/test/089_q_option_center_padded_indented.txt deleted file mode 100644 index a164b97..0000000 --- a/test/089_q_option_center_padded_indented.txt +++ /dev/null @@ -1,19 +0,0 @@ -:ARGS --ac -q (undoc) -s 18 -p a3 -i box -:INPUT - foo - barf -:OUTPUT-FILTER -:EXPECTED - /****************/ - /* */ - /* */ - /* */ - /* foo */ - /* barf */ - /* */ - /* */ - /* */ - /****************/ -4 9 9 -:EOF diff --git a/test/090_q_option_center_padded_indented_bigbox.txt b/test/090_q_option_center_padded_indented_bigbox.txt deleted file mode 100644 index 7206cb1..0000000 --- a/test/090_q_option_center_padded_indented_bigbox.txt +++ /dev/null @@ -1,25 +0,0 @@ -:ARGS --ac -q (undoc) -p a3 -d diamonds -i text -:INPUT - foo - barf -:OUTPUT-FILTER -:EXPECTED - /\ /\ /\ - /\//\\/\ /\//\\/\ /\//\\/\ - /\//\\\///\\/\//\\\///\\/\//\\\///\\/\ -//\\\//\/\\///\\\//\/\\///\\\//\/\\///\\ -\\//\/ \/\\// - \/ \/ - /\ /\ -//\\ foo //\\ -\\// barf \\// - \/ \/ - /\ /\ -//\\/\ /\//\\ -\\///\\/\//\\\///\\/\//\\\///\\/\//\\\// - \/\\///\\\//\/\\///\\\//\/\\///\\\//\/ - \/\\//\/ \/\\//\/ \/\\//\/ - \/ \/ jgs \/ -7 20 20 -:EOF diff --git a/test/091_q_option_left_tabindent.txt b/test/091_q_option_left_tabindent.txt deleted file mode 100644 index 1511a2c..0000000 --- a/test/091_q_option_left_tabindent.txt +++ /dev/null @@ -1,13 +0,0 @@ -:ARGS --q (undoc) -t 8k -:INPUT - foo - barf -:OUTPUT-FILTER -:EXPECTED - /********/ - /* foo */ - /* barf */ - /********/ -1 4 4 -:EOF diff --git a/test/092_q_option_blanklines.txt b/test/092_q_option_blanklines.txt deleted file mode 100644 index 540e034..0000000 --- a/test/092_q_option_blanklines.txt +++ /dev/null @@ -1,21 +0,0 @@ -:ARGS --q (undoc) -s 12 -:INPUT -f -fo - -foo -fooo - -:OUTPUT-FILTER -:EXPECTED -/**********/ -/* f */ -/* fo */ -/* */ -/* foo */ -/* fooo */ -/* */ -/**********/ -1 3 3 -1 3 3 -1 -:EOF diff --git a/test/093_q_option_blanklines_left.txt b/test/093_q_option_blanklines_left.txt deleted file mode 100644 index b94f25e..0000000 --- a/test/093_q_option_blanklines_left.txt +++ /dev/null @@ -1,21 +0,0 @@ -:ARGS --q (undoc) -s 12 -al -:INPUT -f -fo - -foo -fooo - -:OUTPUT-FILTER -:EXPECTED -/**********/ -/* f */ -/* fo */ -/* */ -/* foo */ -/* fooo */ -/* */ -/**********/ -1 3 3 -1 3 3 -1 -:EOF diff --git a/test/094_q_option_emptyboxside.txt b/test/094_q_option_emptyboxside.txt deleted file mode 100644 index bfda664..0000000 --- a/test/094_q_option_emptyboxside.txt +++ /dev/null @@ -1,13 +0,0 @@ -:ARGS --q (undoc) -d right -:INPUT -foo - - bar -:OUTPUT-FILTER -:EXPECTED -foo /* XX */ - /* XX */ - bar /* XX */ -0 0 -1 0 -:EOF