aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tbl_term.c
Commit message (Collapse)AuthorAgeFilesLines
* Correctly handle horizontal spans at the beginning of rows,Ingo Schwarze2017-07-081-9/+10
| | | | | | | | fixing an assertion failure found by jsg@ with afl(1). While here, also drop printing of whitespace in tbl_data() which makes no difference because column positioning code in term_tbl() already takes care of that.
* Implement spacing of columns as defined in the table layout;Ingo Schwarze2017-06-271-21/+28
| | | | | this is for example used by lftp(1) and, ironically, misused by our very own tbl(7) manual...
* tables leak tab settings to subsequent textIngo Schwarze2017-06-171-1/+12
|
* Multiple tbl(7) improvements:Ingo Schwarze2017-06-161-63/+176
| | | | | | | | | | | | * Do not discard data that lacks a matching layout cell but remains within the number of columns of the table as a whole. * Do not insert dummy data rows for any layout row starting with a horizontal line, but only for layout rows that would discard all the data on a matching non-empty data row. * Print horizontal lines specified in the layout even if there is no matching data cell. * Improve the logic for extending vertical lines to adjacent rows, for choosing cross marks versus line segments, and some related details.
* improve rounding rules for scaling unitsIngo Schwarze2017-06-141-2/+2
| | | | in horizontal orientation in the terminal formatter
* fix the interaction of the allbox option with spanned cells in the layoutIngo Schwarze2017-06-131-17/+32
|
* Two minor fixes for the "allbox" modifier:Ingo Schwarze2017-06-121-3/+6
| | | | | | 1. It does not reduce explicit "||" in the layout to "|". 2. It does not cause three horizontal lines at the end of a table, even if the table ends with an explicit "_" data line.
* implement the tbl(7) "allbox" option;Ingo Schwarze2017-06-121-2/+8
| | | | used for example by curs_getch(3) and GLwDrawingArea(3)
* fix column width calculation for text block cellsIngo Schwarze2017-06-121-2/+2
|
* Implement automatic line breakingIngo Schwarze2017-06-121-57/+157
| | | | | inside individual table cells that contain text blocks. This cures overlong lines in various Xenocara manuals.
* Implement w layout specifier (minimum column width).Ingo Schwarze2017-06-081-3/+9
| | | | | Improve width calculation of text blocks. Reduces the groff/mandoc diff in Base+Xenocara by about 800 lines.
* Prepare the terminal driver for filling multiple columns in parallel,Ingo Schwarze2017-06-071-7/+7
| | | | | | first step: split column data out of the terminal state struct into a new column state struct and use an array of such column state structs. No functional change.
* Implement the roff(7) .mc (right margin character) request.Ingo Schwarze2017-06-041-18/+9
| | | | | | The Tcl/Tk manual pages use this extensively. Delete the TERM_MAXMARGIN hack, it breaks .mc inside .nf; instead, implement a proper TERMP_BRNEVER flag.
* To make the code more readable, delete 283 /* FALLTHROUGH */ commentsIngo Schwarze2015-10-121-6/+1
| | | | | | that were right between two adjacent case statement. Keep only those 24 where the first case actually executes some code before falling through to the next case.
* modernize style: "return" is not a functionIngo Schwarze2015-10-061-3/+3
|
* /* NOTREACHED */ after abort() is silly, delete itIngo Schwarze2015-09-261-2/+1
|
* Fix vertical spacing at the beginning of tables.Ingo Schwarze2015-03-061-4/+1
| | | | | | man(7) always prints a blank line, mdoc(7) doesn't. Problem in mdoc(7) reported by kristaps@. mdoc(7) part of the patch tested by kristaps@.
* Flush the line preceding a table before clearing the right margin,Ingo Schwarze2015-03-061-3/+4
| | | | | such that that line isn't output with unlimited width. Problem reported and fix OK by kristaps@.
* Use relative offsets instead of absolute pointers for the terminalIngo Schwarze2015-01-311-3/+3
| | | | | | font stack. The latter fail after the stack is grown with realloc(). Fixing an assertion failure found by jsg@ with afl some time ago (test case number 51).
* Delete the redundant tbl span flags, just inspect the actual dataIngo Schwarze2015-01-301-3/+3
| | | | | | | | where needed, which is less fragile. This fixes a subtle NULL pointer access to tp->tbl.cols: Due to a bug in the man(7) parser, the first span of a table can end up in a .TP head, in which case tblcalc() was never called. Found by jsg@ with afl.
* Abolish struct tbl_head and replace it by an "int col" member inIngo Schwarze2015-01-301-21/+16
| | | | struct tbl_cell. No functional change, minus 40 lines of code.
* Auditing the tbl(7) code for more NULL pointer accesses, i came outIngo Schwarze2015-01-301-5/+3
| | | | | empty-handed; so this is just KNF and some code simplifications, no functional change.
* implement the tbl(7) "center" layout optionIngo Schwarze2015-01-281-3/+19
|
* Multiple parser and formatter fixes for line drawing in tbl(7).Ingo Schwarze2015-01-271-124/+97
| | | | | | | | | | | | * Allow mixing vertical line bars with the layout options of the preceding layout cell. * Correctly combine box options with layout lines. * Correctly print vertical lines in data rows, with the right spacing. * Correctly print cross markers and left and right ends of horizontal lines even if vertical lines differ above and below. * Avoid the bogus error message "no table data cells" when a table data section starts with a horizontal line. No increase in code size.
* Prevent unsigned integer underflow when a number is too wideIngo Schwarze2014-12-241-4/+8
| | | | | for a table cell with an "nz" layout specification, causing essentially infinite output as found by jsg@ with afl.
* even if a table has zero columns, do not segfault in the formatter;Ingo Schwarze2014-10-141-2/+2
| | | | bug reported by bentley@
* Rudimentary implementation of the e, x, and z table layout modifiersIngo Schwarze2014-10-141-2/+2
| | | | | | | to equalize, maximize, and ignore the width of columns. Does not yet take vertical rulers into account, and does not do line breaks within table cells. Considerably improves the lftp(1) manual; issue noticed by sthen@.
* implement font modifiers in table layoutsIngo Schwarze2014-10-131-3/+19
|
* Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.Ingo Schwarze2014-08-101-3/+3
| | | | | | Include <sys/types.h> where needed, it does not belong in config.h. Remove <stdio.h> from config.h; if it is missing somewhere, it should be added, but i cannot find a *.c file where it is missing.
* KNF: case (FOO): -> case FOO:, remove /* LINTED */ and /* ARGSUSED */,Ingo Schwarze2014-04-201-33/+33
| | | | | remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
* Allow leading and trailing vertical lines,Ingo Schwarze2014-03-281-4/+6
| | | | | | | and format them in the same way as groff. While here, do not require whitespace before vertical lines in layout specifications. Issues found by bentley@ in mpv(1).
* The name "struct tbl" was badly misleading for two reasons:Ingo Schwarze2013-05-311-17/+17
| | | | | | | 1) This struct almost exclusively contains the table options. 2) Information about the table as a whole is actually in "struct tbl_node". Besides, "struct tbl" was almost impossible to search for. So rename it to "struct tbl_opts". No functional change.
* Fix the vertical spacing around tbl(7) instances in man(7).Ingo Schwarze2012-05-271-3/+7
| | | | | | | | | | | | | | | Groff forces the document author to manually request sufficient spacing after .TE - that is, at least .sp 1v after a table with the "box" option and at least .sp 2v after a table with the "doublebox" option - or else it clobbers the box. I consider that insane, so i'm not imitating groff in that respect. Instead, i add at least as much vertical space as groff, or more where required to avoid clobbering the box. Consequently, output will be identical for input that looks sane with groff, and mandoc will make output look better for input that looks bad with groff. "Please check them in and I'll look into them later!" kristaps@
* Correct width of horizontal spans; relevant in case of centered orIngo Schwarze2012-05-271-4/+12
| | | | | | | | flush right text, for boxes, and when more columns follow the span. Issue found by sthen@ in the net/arp-scan(1) port manual. "Please check them in and I'll look into them later!" kristaps@
* Do not handle vertical lines as additional tbl(7) columns,Ingo Schwarze2012-05-271-60/+28
| | | | | | | | | | | | | | | | instead save their properties with the following column. This simplifies layout parsing and saves a lot of code related to column handling. At output time, print all white space and vertical lines separating columns before printing the following column, and none after printing the preceding column, considerably simplifying white space handling and width calculations. No functional change, but it saves 150 lines of code, and it allows the next patch to tbl_term.c, tbl_literal(). "Please check them in and I'll look into them later!" kristaps@
* Major rewrite of the horizontal spacing of tablesIngo Schwarze2011-09-201-96/+101
| | | | | to work both with and without frames and rulers. ok kristaps@
* Fix copyright email.Kristaps Dzonsons2011-07-171-2/+2
|
* correct horizontal spacing of data cellsIngo Schwarze2011-01-251-8/+11
| | | | | | correct alignment of centered cells adjust horizontal rule width to the new spacing ok kristaps@
* Add support for "^" vertical spanners. Unlike GNU tbl, raiseKristaps Dzonsons2011-01-111-1/+4
| | | | | | | error-class messages when data is being ignored by specifying it in "^" cells (either as-is or in blocks). Also note again that horizontal spanners aren't really supported...
* Make dp->string always consist of a value.Kristaps Dzonsons2011-01-101-15/+13
|
* First, make extra data cells be thrown away. This makes "dp->layout"Kristaps Dzonsons2011-01-101-13/+26
| | | | | | | | | | | | always hold, which cleans up the table stuff a bit. Second, set a "spans" value per data cell consisting of the number of skipped TBL_CELL_SPAN layout cells. Third, make tbl_term.c understand how to skip over spanned sections when iterating over the header queue. What remains is to calculate the widths of spanned cells.
* The numerical column type centres on the *last* decimal point.Kristaps Dzonsons2011-01-081-2/+2
|
* Give the "n" cell type knowledge of its spacing.Kristaps Dzonsons2011-01-081-4/+1
|
* Fixes: T} can be followed by a delimiter then more data. Make thisKristaps Dzonsons2011-01-071-12/+13
| | | | | | | | | work and add documentation for it. Also make tbl_term() not puke if the number of data cells is less than the number of layout cells (which happens from time to time). This still needs work because we should pad out empty cells so that the borders all work out.
* Quiesce lint with some type handling. Does not change anything.Kristaps Dzonsons2011-01-071-9/+12
|
* Stuff tbl_calc() into out.c so that it can be shared by all output modesKristaps Dzonsons2011-01-051-249/+101
| | | | | | | | | | | | | | | | (isn't now, but will need to be, used by -T[x]html also). Necessitated a lot of churn in getting tbl_calc* code out of tbl_term.c and into out.c, including renaming some structures and so on. The abstraction is in having a pointer to a wrapper function for calculating string widths. The char devices use term_strlen and term_len; the others will probably just use strlen(). While at it, remove some superfluous assertions in the tbl code. This allows all tbl manuals to clear. Lastly, set the right-margin to be the maximum margin for each table span. This allows big, complicated tbl-pages like terminfo to be displayed. They're ugly, but they work.
* Support `T{' and `T}' data blocks. When a standalone `T{' isKristaps Dzonsons2011-01-041-8/+6
| | | | | | | encountered as a line's last data cell, move into TBL_PART_CDATA mode whilst leaving the cell's designation as TBL_DATA_NONE. When new data arrives that's not a standalone `T}', append it to the cell contends. Close out and warn appropriately.
* Have horizontal spanner not clobber pre-set width.Kristaps Dzonsons2011-01-041-2/+5
|
* Fix spacing for tables to use term_len(). Also make term.c properlyKristaps Dzonsons2011-01-041-10/+10
| | | | recode ASCII_HYPHEN and ASCII_NBRSP before passing back for widths.
* Fix to make horizontal spanners in the layout be properly printed.Kristaps Dzonsons2011-01-041-29/+10
| | | | | | | mandoc also now warns (so does tbl(1)) if a horizontal spanner is specified along with data. While here, fix up some documentation and uncomment the tbl reference.