diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2008-04-02 18:23:42 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2008-04-02 18:23:42 +0000 |
commit | 8de0baae0b3400bbb9ae44325cc83c122f41ca15 (patch) | |
tree | 6e5ecb5cc450299bb0be2cb292a650423f4597a8 /desktop | |
parent | 7b1c0bde453a20c32fd3ca70bfac74fcfad7f043 (diff) | |
download | netsurf-8de0baae0b3400bbb9ae44325cc83c122f41ca15.tar.gz netsurf-8de0baae0b3400bbb9ae44325cc83c122f41ca15.tar.bz2 |
Improve formatting of copied/saved text from text selections in PREs. Improve formatting in other odd cases too.
svn path=/trunk/netsurf/; revision=4071
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/selection.c | 21 |
1 files changed, 16 insertions, 5 deletions
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) { |