aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term_ascii.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-07-17 22:38:29 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-07-17 22:38:29 +0000
commit7221f76a236baf4056bfe1c909f3c978a4a94349 (patch)
treeeed560ed48c0b821fddc22bf6623153f70031431 /term_ascii.c
parente1c3bf5030411d1b27f5509c2027238b63c1a49e (diff)
downloadmandoc-7221f76a236baf4056bfe1c909f3c978a4a94349.tar.gz
mandoc-7221f76a236baf4056bfe1c909f3c978a4a94349.tar.zst
mandoc-7221f76a236baf4056bfe1c909f3c978a4a94349.zip
Initial, still somewhat experimental implementation to leverage
less(1) -T and :t ctags(1)-like functionality to jump to the definitions of various terms inside manual pages. To be polished in the tree, so bear with me and report issues. Technically, if less(1) is used as a pager, information is collected by the mdoc(7) terminal formatter, first stored using the ohash library, then ultimately written to a temporary file which is passed to less via -T. No change intended for other output formatters or when running without a pager. Based on an idea from Kristaps using feedback from many, in particular phessler@ nicm@ millert@ halex@ doug@ kspillner@ deraadt@.
Diffstat (limited to 'term_ascii.c')
-rw-r--r--term_ascii.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/term_ascii.c b/term_ascii.c
index a66fa77a..b7c69d7e 100644
--- a/term_ascii.c
+++ b/term_ascii.c
@@ -1,4 +1,4 @@
-/* $Id: term_ascii.c,v 1.46 2015/06/10 19:17:15 schwarze Exp $ */
+/* $Id: term_ascii.c,v 1.47 2015/07/17 22:38:29 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -70,6 +70,7 @@ ascii_init(enum termenc enc, const struct mchars *mchars,
p = mandoc_calloc(1, sizeof(struct termp));
p->symtab = mchars;
+ p->line = 1;
p->tabwidth = 5;
p->defrmargin = p->lastrmargin = 78;
p->fontq = mandoc_reallocarray(NULL,
@@ -163,6 +164,7 @@ ascii_sepline(void *arg)
size_t i;
p = (struct termp *)arg;
+ p->line += 3;
putchar('\n');
for (i = 0; i < p->defrmargin; i++)
putchar('-');
@@ -209,6 +211,7 @@ static void
ascii_endline(struct termp *p)
{
+ p->line++;
putchar('\n');
}
@@ -365,6 +368,7 @@ static void
locale_endline(struct termp *p)
{
+ p->line++;
putwchar(L'\n');
}