aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix spacing for tables to use term_len(). Also make term.c properlyKristaps Dzonsons2011-01-041-1/+7
| | | | recode ASCII_HYPHEN and ASCII_NBRSP before passing back for widths.
* Track down a bug of empty `de XX' macros causing uncertain behaviour byKristaps Dzonsons2010-12-061-2/+2
| | | | | | | | | | returning empty strings in roff_getstrn() instead of NULL. This caused maddeningly irregular segfaults in the pod2man preamble for `de IX'. But only on DEC alpha. Also integrate the kinda-probably-safe assertion relaxation in term.c, field-tested by schwarze@. This allows ALL [unpreprocessed] base and xenocara manuals for all BSD systems to run without segfault.
* style cleanup, no functional change:Ingo Schwarze2010-10-021-23/+15
| | | | | | | | * make the initial maxvis/mmax calculation easier to understand * where real, non-indexing casts happen, make them explicit * avoid a few lint warnings that can easily be fixed * remove one needless LINTED comment "I like this" kristaps@
* * need a space before .No even if it starts with a closing delimiterIngo Schwarze2010-10-011-2/+2
| | | | | | | * slightly simplify .Pf *_IGNDELIM code, and share part of it with .No * do not let opening delimiters fall out of the front of .Ns (from kristaps@) This fixes a few spacing issues in csh(1) and ksh(1). OK kristaps@
* Count trailing escaped blanks correctly;Ingo Schwarze2010-09-231-3/+5
| | | | | those ruined the alignment of columns. Tested by jmc@, and kristaps@ agrees with the direction.
* Allow string lengths to account for escapes. Now all calls to calculateKristaps Dzonsons2010-09-151-7/+43
| | | | | | | | | | | | | | | | | | | | | column width in -Tascii, -Tpdf, and -Tps will account for "more real" string lengths. Example: .Bl -tag -width \s[+123424]foo .It bar baz .El The size escape will be correctly tossed. .Bl -tag -width \(aqbar .It \(aqbar baz .El The \(aq will be correctly handled.
* Churny commit to quiet lint. No functional changes.Kristaps Dzonsons2010-09-041-3/+3
|
* Centralize handling of literal tabs in term_flushln() in one place,Ingo Schwarze2010-08-201-11/+4
| | | | | making the code simpler and easier to understand. No functional change.
* When a column contains trailing spaces, calculate the paddingIngo Schwarze2010-08-201-1/+7
| | | | | to the start of the next column correctly. Fixing a problem found by jmc@ in sysctl(3), reminded by kettenis@.
* Implement a simple, consistent user interface for error handling.Ingo Schwarze2010-08-201-3/+3
| | | | | | | | | | | | | | | | | We now have sufficient practical experience to know what we want, so this is intended to be final: - provide -Wlevel (warning, error or fatal) to select what you care about - provide -Wstop to stop after parsing a file with warnings you care about - provide consistent exit status codes for those warnings you care about - fully document what warnings, errors and fatal errors mean - remove all other cruft from the user interface, less is more: - remove all -f knobs along with the whole -f option - remove the old -Werror because calling warnings "fatal" is silly - always finish parsing each file, unless fatal errors prevent that This commit also includes a couple of related simplifications behind the scenes regarding error handling. Feedback and OK kristaps@; Joerg Sonnenberger (NetBSD) and Sascha Wildner (DragonFly BSD) agree with the general direction.
* Make `Sm' start no-spacing after the first output word. Fix in bothKristaps Dzonsons2010-07-261-1/+3
| | | | -T[x]html and -T{pdf,ps,ascii}. Reported by Jason McIntyre.
* Clean up some tight spots in mandoc's default mode: pessimisticallyKristaps Dzonsons2010-07-261-20/+15
| | | | | pre-allocate the output buffer for words and in-line the buffera() function, which was only called in one place anyway.
* Avoid running the "width" termp callback for each whitespace.Kristaps Dzonsons2010-07-251-4/+4
|
* Accomodate for groff's crappy behaviour wherein an unrecognisedKristaps Dzonsons2010-07-211-4/+9
| | | | | | | | | | | | | single-character escape (and ONLY this type of escape) will map back into itself: "If a backslash is followed by a character that does not constitute a defined escape sequence the backslash is silently ignored and the character maps to itself." (From groff.7.) Found by Jason McIntyre.
* Avoid letter-by-letter encoding by using strcspn() in term_word().Kristaps Dzonsons2010-07-171-8/+7
|
* Change chars.in HTML encoding to be a Unicode codepoint (int), which isKristaps Dzonsons2010-07-161-3/+3
| | | | later formatted in html.c.
* Re-constitution of `ds' symbol processing. First, push theKristaps Dzonsons2010-07-071-7/+1
| | | | | | | | | roff_getstr() family of functions into roff.c with the "first_string" directly in struct roff. Second, pre-process each line for reserved words in libroff, splicing and re-running a line if it has one (this allows defined symbols to be macros). Remove term.c's invocation of the roff_getstrn() function. Removed function documentation in roff.3 and added roff.7 `ds' documentation.
* Assert my copyright, making it explicit that i'm granting the same licenseIngo Schwarze2010-07-041-2/+3
| | | | | on those parts of the code and text that i have written as Kristaps is. "fine with me" kristaps@
* Rudimentary implementation of user-defined strings;Ingo Schwarze2010-07-031-1/+7
| | | | | | no time for more refinement right now. In particular, fixes terminfo(3) and mdoc.samples(7). ok kristaps@, who will add the HTML frontend bits
* Lint tweak.Kristaps Dzonsons2010-07-021-1/+2
|
* Pushed normalisation of scaling units into term_hspan().Kristaps Dzonsons2010-06-301-2/+7
|
* Move term_hspan() calculation into the output devices, where it belongs.Kristaps Dzonsons2010-06-301-35/+2
|
* Clean-up of variable-width glyph support. Adds no new code; onlyKristaps Dzonsons2010-06-281-16/+19
| | | | | restructured to make a bit more readable. Also removed an unused entry in the PS engine structure.
* This enables variable glyph-width output. The checkin will be followedKristaps Dzonsons2010-06-281-12/+15
| | | | | | by a [functionless] clean-up in term_ps.c, but this makes the appropriate changes to "enable" initial proportional-width functionality in term.c and fixes some areas of term_ps.c that were causing errors.
* Tiny commit clarifying flushln() documentation as to what refers toKristaps Dzonsons2010-06-281-4/+5
| | | | | visual screen output and what's an array index (getting closer to variable-width fonting).
* Basic implementation of .Bk/.Ek; from OpenBSD.Ingo Schwarze2010-06-271-3/+8
| | | | OK and one stylistic tweak by kristaps@.
* Churn-ish check-in getting mdoc_parseln() and man_parseln() to accept aKristaps Dzonsons2010-06-261-3/+1
| | | | const struct regset pointer. No functionality.
* Initial chunks for variable-width fonts. Pushes all width calculationsKristaps Dzonsons2010-06-251-5/+23
| | | | | | | | in mdoc_term.c and man_term.c down into term.c. This is still not implemented in term.c, although stubs for width calculations are in place. From now on, offset, rmargin, and other layout variables are abstract screen widths. They will resolve to the the familiar values for -Tascii but -Tps will eventually use points instead of chars.
* Churn as I finish email address migration kth.se -> bsd.lv.Kristaps Dzonsons2010-06-191-2/+2
|
* Teach -Tps to ignore backspace-encoding by using a one-char buffer and aKristaps Dzonsons2010-06-111-5/+2
| | | | simple state machine. This paves the way for decorated text.
* Broke ascii_*() functions into term_ascii.cKristaps Dzonsons2010-06-081-242/+13
| | | | Made low-level engine functions into function pointers.
* No functionality changes: just restructuring. DeprecatedKristaps Dzonsons2010-06-081-36/+29
| | | | | terminal_free() in favour of ps_free() and ascii_free(). Moved ps_*() functions into term_ps.c so that they don't clutter up term.c.
* Missing prototype for getsubopt() on NetBSD fixed.VERSION_1_10_1Kristaps Dzonsons2010-06-081-1/+2
|
* Lint fix.Kristaps Dzonsons2010-06-071-2/+2
| | | | Added J.C. Roberts' TODO note.
* First check-in of PostScript output. This does not change any logicKristaps Dzonsons2010-06-071-20/+236
| | | | | | within term.c, but does add a small shim over putchar() that switches on the output engine. Prints, for this initial version, only monospace and without font decorations. It's a start.
* Add -Owidth=width option to mandoc -Tascii. Asked for by joerg@ about aKristaps Dzonsons2010-06-071-6/+25
| | | | thousand years ago. Note that this is normalised to >=60.
* Modified version of Ingo Schwarze's patch for hyphen-breaking.Kristaps Dzonsons2010-05-251-7/+18
| | | | | | | Breakable hyphens are cued in the back-ends (with ASCII_HYPH) and acted upon in term.c or ignored in html.c. Also cleaned up XML decl printing (no need for extra vars).
* sync to OpenBSD:Ingo Schwarze2010-05-241-4/+12
| | | | | | | save the visual cursor position in term_flushln() and use that to avoid multiple blank lines in nested lists while still putting subsequent empty list tags each on their own line; "go ahead" kristaps@
* Handle literal tab characters both in literal context (.Bd -literal)Ingo Schwarze2010-05-241-3/+23
| | | | | | | | and outside. In literal context, tab stops are at each eigth column; outside, they are at each fifth column. from OpenBSD mdoc_term.c rev. 1.75; "commit" kristaps@
* Enable the unified error/warning enumeration in mandoc.h that'sKristaps Dzonsons2010-05-171-1/+2
| | | | | | | | | | | stringified in main.c. Allow `An' to handle an argument and child (with a warning). Allow `Rv' and `Ex' to work without a prior `Nm' as groff does (with a warning). Allow inconsistent column syntax to only raise a warning.
* The function term_flushln() had effectively forked in OpenBSD.Ingo Schwarze2010-05-171-45/+42
| | | | | | | | | | | | | | | | This is the bsd.lv part of the main step to bring it back in sync. At the same time, this prevents trailing whitespace in the output: We delay writing blanks until we are sure printable characters follow. This is achieved by * remembering the end of the word instead of its length * and not using vbl any longer for the control of line breaking * such that vbl can sum up all kinds of white space * before writing a word, printing all the blanks collected in vbl * within the word, adding NBSP chars to vbl, then continuing with the word * after the word, adding blanks to vbl, then starting the next word "looks good" kristaps@
* sync to OpenBSD:Ingo Schwarze2010-05-161-2/+2
| | | | | | introduce a #define to get rid of the magic number describing the ASCII character used to represent non-breaking space; ok kristaps
* Make the output width an option for ascii_alloc and use that to computeJoerg Sonnenberger2010-05-151-5/+9
| | | | the default margin. Hard-code 80 chars/line for now.
* Tiny EOS patch. Back-end cues front-end through flag. Front-end cues ↵Kristaps Dzonsons2010-05-121-2/+7
| | | | output engine with flag.
* Backed out break-at-hyphen changes.Kristaps Dzonsons2010-05-071-39/+4
|
* Removed pipe from front-end ("typographic") recognition as punctuation ↵Kristaps Dzonsons2010-04-081-3/+5
| | | | (noted by Ingo Schwarze).
* Removed erroneous `{' and `}' as punctuation (see mdoc.samples "General ↵Kristaps Dzonsons2010-04-031-22/+53
| | | | | | Syntax" for why this mistake was made). Noted by Ingo Schwarze. Lines of text now break at a hyphen, unless the hyphen is the first or second subsequent in a word. Inspired by a Ingo Schwarze's patch.
* Fixed two very subtle bugs in retaining overstep and maxrmargin widths ↵Kristaps Dzonsons2010-03-231-16/+14
| | | | between parse sequences.
* Big check-in of compatibility layer. This should work on most major ↵Kristaps Dzonsons2010-01-011-1/+5
| | | | architectures. Thanks to Joerg Sonnenberger.
* Fixed \c support for all input and output modes (documented in mandoc_char.7).Kristaps Dzonsons2009-11-121-1/+4
|