summaryrefslogtreecommitdiffstats
path: root/man_term.c
Commit message (Collapse)AuthorAgeFilesLines
* add support for the MT and ME mailto macros, used for example in wg(8);Ingo Schwarze2017-06-251-0/+2
| | | | patch from bentley@
* correct handling of blank lines after \cIngo Schwarze2017-06-171-1/+4
|
* properly set the default indentationIngo Schwarze2017-06-171-4/+4
| | | | such that even pages without any .SH macros get it
* improve rounding rules for scaling unitsIngo Schwarze2017-06-141-5/+5
| | | | in horizontal orientation in the terminal formatter
* make the internal a2roffsu() interface more powerful by returningIngo Schwarze2017-06-081-6/+6
| | | | | a pointer to the end of the parsed data, making it easier to parse subsequent bytes
* Prepare the terminal driver for filling multiple columns in parallel,Ingo Schwarze2017-06-071-58/+60
| | | | | | 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-11/+6
| | | | | | 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.
* Make term_flushln() simpler and more robust:Ingo Schwarze2017-06-041-1/+0
| | | | | | Eliminate the "overstep" state variable. The information is already contained in "viscol". Minus 60 lines of code, no functional change intended.
* Trailing \c suppresses the output line break even ifIngo Schwarze2017-05-091-2/+3
| | | | | the next line is a text line starting with whitespace. Quirk found in the sysutils/rancid port.
* implement .DT in terms of .ta; needed for print/ghostview, for exampleIngo Schwarze2017-05-071-1/+11
|
* Basic implementation of the roff(7) .ta (define tab stops) request.Ingo Schwarze2017-05-071-1/+3
| | | | | | This is the first feature made possible by the parser reorganization. Improves the formatting of the SYNOPSIS in many Xenocara GL manuals. Also important for ports, as reported by many, including naddy@.
* Move .sp to the roff modules. Enough infrastructure is in placeIngo Schwarze2017-05-051-51/+0
| | | | now that this actually saves code: -70 LOC.
* move .ll to the roff modulesIngo Schwarze2017-05-051-10/+0
|
* Move handling of the roff(7) .ft request from the man(7)Ingo Schwarze2017-05-051-37/+0
| | | | | modules to the new roff(7) modules. As a side effect, mdoc(7) now handles .ft, too. Of course, do not use that.
* Start roff formatter modules for HTML and termininal output,Ingo Schwarze2017-05-041-10/+2
| | | | | | | used by both the mdoc and man formatters, with the ultimate goal of reducing code duplication between the two macro formatters. Made possible by the parser unification. Add the first formatting function (for the .br request).
* Parser reorg:Ingo Schwarze2017-05-041-2/+13
| | | | | Generate the first node on the roff level: .br Fix some column numbers in diagnostic messages while here.
* Continue parser unification:Ingo Schwarze2017-04-241-2/+3
| | | | | | | | * Make enum rofft an internal interface as enum roff_tok in "roff.h". * Represent mdoc and man macros in enum roff_tok. * Make TOKEN_NONE a proper enum value and use it throughout. * Put the prologue macros first in the macro tables. * Unify mdoc_macroname[] and man_macroname[] into roff_name[].
* Fix previous: I forgot that i had to change the convention howIngo Schwarze2017-02-151-1/+1
| | | | | a node is marked as "not a macro" when unifying the parsers. Confirmed to work by Sevan Janiyan.
* Do not read one element past the end of the static const termacts array.Ingo Schwarze2017-02-111-1/+2
| | | | | | | Bug found by Sevan Janiyan <venture37 at geeklan dot co dot uk> who ran the OpenBSD mandoc test suite on Ubuntu on POWER8 (sic!) and reported that mdoc/Sh/before.in failed in -Tman mode. If that isn't power testing, i don't know...
* Do not fix the default indent for all subsequent files; some may useIngo Schwarze2017-02-041-1/+4
| | | | | a different macro language and hence require a different indent. You can see the effect with "man -a 1 host hostname".
* unify names of AST node flags; no change of cpp outputIngo Schwarze2017-01-101-8/+8
|
* Delete the redundant "nchild" member of struct roff_node, replacingIngo Schwarze2016-01-081-1/+1
| | | | | | | | most uses by one, a few by two pointer checks, and only one by a tiny loop - not only making data smaller, but code shorter as well. This gets rid of an implicit invariant that confused both static analysis tools and human auditors. No functional change.
* To make the code more readable, delete 283 /* FALLTHROUGH */ commentsIngo Schwarze2015-10-121-10/+0
| | | | | | 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-32/+32
|
* Trailing whitespace is significant when determining the width of a tagIngo Schwarze2015-09-211-2/+2
| | | | | in mdoc(7) .Bl -tag and man(7) .TP, but not in man(7) .IP. Quirk reported by Jan Stary <hans at stare dot cz> on ports@.
* If an explicit line break request (.br or .sp) occurs within an .HP block,Ingo Schwarze2015-04-191-0/+11
| | | | | | | the next line doesn't hang, but is simply indented. Issue found by Christian Neukirchen <chneukirchen at gmail dot com> in the dmsetup(8) manual on Linux. This patch also improves the indentation of XDGA(3) and XrmGetResource(3).
* Decouple the token code for "no request or macro" from the individualIngo Schwarze2015-04-191-1/+1
| | | | | | high-level parsers to allow further unification of functions that only need to recognize this code, but that don't care about different high-level macrosets beyond that.
* Delete the wrapper functions mdoc_meta(), man_meta(), mdoc_node(),Ingo Schwarze2015-04-181-9/+5
| | | | | | man_node() from the mandoc(3) semi-public interface and the internal wrapper functions print_mdoc() and print_man() from the HTML formatters. Minus 60 lines of code, no functional change.
* Replace the structs mdoc and man by a unified struct roff_man.Ingo Schwarze2015-04-181-1/+1
| | | | | Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15.
* Do not mistreat empty arguments to font alternating macrosIngo Schwarze2015-04-061-1/+4
| | | | as vertical spacing requests. Bug found with xmahjongg(6).
* On a new RS nesting level, the saved width starts from the defaultIngo Schwarze2015-04-061-1/+1
| | | | | width, not from the saved width of the previous level. Improves xterm(1) and XSetEventQueueOwner(3); found in transcode_filter(1).
* Use the default width for .RS without arguments.Ingo Schwarze2015-04-061-1/+3
| | | | | Reduces groff-mandoc differences in base and Xenocara by about 4%. Found while looking at wpa_supplicant(8).
* Give man(7) section and subsection headers hanging indentation.Ingo Schwarze2015-04-041-0/+12
| | | | | | Reduces groff-mandoc differences in base by about 2.5% due to various Perl manuals having long section titles. Quirk found in argtable2(3).
* Rounding rules for horizontal scaling widths are more complicated.Ingo Schwarze2015-04-041-5/+5
| | | | | | | | | | | | | There is a first rounding to basic units on the input side. After that, rounding rules differ between requests and macros. Requests round to the nearest possible character position. Macros round to the next character position to the left. Implement that by changing the return value of term_hspan() to basic units and leaving the second scaling and rounding stage to the formatters instead of doing it in the terminal handler. Improves for example argtable2(3).
* Fix a quirk with respect to empty .HP.Ingo Schwarze2015-04-041-0/+11
| | | | | Found while writing a regression test for man_macro.c rev. 1.66. Incidentally, this brings rendering of XFreeEventData(3) closer to groff.
* Third step towards parser unification:Ingo Schwarze2015-04-021-17/+15
| | | | | Replace struct mdoc_meta and struct man_meta by a unified struct roff_meta. Written of the train from London to Exeter on the way to p2k15.
* Second step towards parser unification:Ingo Schwarze2015-04-021-8/+8
| | | | | | | | | Replace struct mdoc_node and struct man_node by a unified struct roff_node. To be able to use the tok member for both mdoc(7) and man(7) without defining all the macros in roff.h, sacrifice a tiny bit of type safety and make tok an int rather than an enum. Almost mechanical, no functional change. Written on the Eurostar from Bruxelles to London on the way to p2k15.
* First step towards parser unification:Ingo Schwarze2015-04-021-46/+47
| | | | | | Replace enum mdoc_type and enum man_type by a unified enum roff_type. Almost mechanical, no functional change. Written on the ICE train from Frankfurt to Bruxelles on the way to p2k15.
* Avoid off-by-one read access to the termacts array, which couldIngo Schwarze2015-03-151-1/+2
| | | | | sometimes result in missing line breaks before subsection headers. Found by carsten dot kunze at arcor dot de on SuSE 13.2.
* Fix vertical spacing at the beginning of tables.Ingo Schwarze2015-03-061-6/+2
| | | | | | 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@.
* Have pity on the poor stack.Ingo Schwarze2015-01-301-5/+5
| | | | | Replace tail recursion by iteration when walking the syntax trees. No functional change.
* Delete the redundant tbl span flags, just inspect the actual dataIngo Schwarze2015-01-301-1/+1
| | | | | | | | 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.
* Strangely, ignoring the roff(7) .na request was implemented in the man(7)Ingo Schwarze2015-01-241-1/+0
| | | | | parser. Simplify the code by moving it into the roff(7) parser, also making it work for mdoc(7).
* For .RS, we need to save the information how much we actually indentedIngo Schwarze2014-12-241-27/+13
| | | | | | | because negative indents can get truncated, in which case we no longer know how to restore the original indent at the end of the block. This also solves another case of effectively infinite output found by jsg@ with afl, triggered by very large negative indents.
* When a man(7) document contains unreasonably large numbers forIngo Schwarze2014-12-241-9/+18
| | | | | | | | | | | indentations or paragraph distances, large output may be generated, which is practically the same as an endless loop; found by jsg@ with afl. Reject such unreasonably large numbers beyond arbitrary limits similar to those used by groff (max. 65 blank lines between paragraphs and max. SHRT_MAX characters per output line) and fall back to defaults when exceeded. Having the limits behave in exactly the same way is not relevant.
* support negative horizontal widths in man(7);Ingo Schwarze2014-12-231-105/+71
| | | | minus twenty lines of code in spite of enhanced functionality
* some scaling unit fixes:Ingo Schwarze2014-12-231-14/+4
| | | | | - .sp with an invalid argument is .sp 1v, not .sp 0v - in man(1), trailing garbage doesn't make scaling units invalid
* even if the second argument to .IP is invalid, don't print itIngo Schwarze2014-12-231-3/+2
|
* correctly handle scaling units after .PDIngo Schwarze2014-12-231-2/+4
|
* fix handling of roff requests having a default scale other than "n",Ingo Schwarze2014-12-041-1/+1
| | | | | in particular .sp which uses "v", when the scale is not specified; cures groff-mandoc differences in about a dozen Xenocara manuals