From 8de0baae0b3400bbb9ae44325cc83c122f41ca15 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 2 Apr 2008 18:23:42 +0000 Subject: Improve formatting of copied/saved text from text selections in PREs. Improve formatting in other odd cases too. svn path=/trunk/netsurf/; revision=4071 --- desktop/selection.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'desktop') diff --git a/desktop/selection.c b/desktop/selection.c index f0b07b95d..d744c3c3e 100644 --- a/desktop/selection.c +++ b/desktop/selection.c @@ -469,15 +469,26 @@ bool traverse_tree(struct box *box, unsigned start_idx, unsigned end_idx, box->type == BOX_TABLE || box->type == BOX_FLOAT_LEFT || box->type == BOX_FLOAT_RIGHT) && - !box->list_marker) { + (!box->list_marker || + box->list_marker && + *before == WHITESPACE_TAB)) { *before = WHITESPACE_TWO_NEW_LINES; } - else if (*before < WHITESPACE_ONE_NEW_LINE && + else if (*before <= WHITESPACE_ONE_NEW_LINE && (box->type == BOX_TABLE_ROW || box->type == BOX_BR || - (box->type != BOX_TABLE_ROW && - box->list_marker))) { - *before = WHITESPACE_ONE_NEW_LINE; + (box->type != BOX_INLINE && + box->list_marker) || + (box->parent->style && + (box->parent->style->white_space == + CSS_WHITE_SPACE_PRE || + box->parent->style->white_space == + CSS_WHITE_SPACE_PRE_WRAP) && + box->type == BOX_INLINE_CONTAINER))) { + if (*before == WHITESPACE_ONE_NEW_LINE) + *before = WHITESPACE_TWO_NEW_LINES; + else + *before = WHITESPACE_ONE_NEW_LINE; } else if (*before < WHITESPACE_TAB && box->type == BOX_TABLE_CELL) { -- cgit v1.2.3