From 08b72b8f1a54d84a06924f40ca973826190c215b Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Fri, 28 Mar 2014 23:26:25 +0000 Subject: Allow leading and trailing vertical lines, 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). --- tbl_layout.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tbl_layout.c') diff --git a/tbl_layout.c b/tbl_layout.c index c30ea25b..94a48d18 100644 --- a/tbl_layout.c +++ b/tbl_layout.c @@ -1,7 +1,7 @@ -/* $Id: tbl_layout.c,v 1.24 2014/03/23 11:25:26 schwarze Exp $ */ +/* $Id: tbl_layout.c,v 1.25 2014/03/28 23:26:25 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons - * Copyright (c) 2012 Ingo Schwarze + * Copyright (c) 2012, 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -100,6 +100,8 @@ mod: case (','): /* FALLTHROUGH */ case ('.'): + /* FALLTHROUGH */ + case ('|'): return(1); default: break; @@ -218,6 +220,13 @@ cell(struct tbl_node *tbl, struct tbl_row *rp, while (' ' == p[*pos]) (*pos)++; + /* Handle trailing vertical lines */ + + if ('.' == p[*pos] || '\0' == p[*pos]) { + rp->vert = vert; + return(1); + } + /* Parse the column position (`c', `l', `r', ...). */ for (i = 0; i < KEYS_MAX; i++) -- cgit v1.2.3