mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Merge with http://elinks.cz/elinks.git
This commit is contained in:
commit
d66ed0e76d
@ -643,7 +643,13 @@ del_chars(struct html_context *html_context, int x, int y)
|
||||
move_links(html_context, x, y, -1, -1);
|
||||
}
|
||||
|
||||
#define overlap(x) int_max((x).width - (x).rightmargin, 0)
|
||||
#if TABLE_LINE_PADDING < 0
|
||||
# define overlap_width(x) (x).width
|
||||
#else
|
||||
# define overlap_width(x) int_min((x).width, \
|
||||
html_context->options->box.width - TABLE_LINE_PADDING)
|
||||
#endif
|
||||
#define overlap(x) int_max(overlap_width(x) - (x).rightmargin, 0)
|
||||
|
||||
static int inline
|
||||
split_line_at(struct html_context *html_context, int width)
|
||||
@ -1380,7 +1386,7 @@ put_chars(struct html_context *html_context, unsigned char *chars, int charslen)
|
||||
part->cx += charslen;
|
||||
renderer_context.nobreak = 0;
|
||||
|
||||
if (!html_is_preformatted()) {
|
||||
if (!(html_context->options->wrap || html_is_preformatted())) {
|
||||
while (part->cx > overlap(par_format)
|
||||
&& part->cx > par_format.leftmargin) {
|
||||
int x = split_line(html_context);
|
||||
|
@ -447,16 +447,18 @@ add_document_lines(struct plain_renderer *renderer)
|
||||
unsigned char *source = renderer->source;
|
||||
int length = renderer->length;
|
||||
int was_empty_line = 0;
|
||||
int was_wrapped = 0;
|
||||
|
||||
for (; length > 0; renderer->lineno++) {
|
||||
unsigned char *xsource;
|
||||
int width, added, only_spaces = 1, spaces = 0, was_spaces = 0;
|
||||
int last_space = 0;
|
||||
int tab_spaces = 0;
|
||||
int step = 0;
|
||||
int doc_width = int_min(renderer->max_width, length);
|
||||
|
||||
/* End of line detection: We handle \r, \r\n and \n types. */
|
||||
for (width = 0; width < doc_width; width++) {
|
||||
for (width = 0; width + tab_spaces < doc_width; width++) {
|
||||
if (source[width] == ASCII_CR)
|
||||
step++;
|
||||
if (source[width + step] == ASCII_LF)
|
||||
@ -469,6 +471,8 @@ add_document_lines(struct plain_renderer *renderer)
|
||||
spaces++;
|
||||
else
|
||||
was_spaces++;
|
||||
if (source[width] == '\t')
|
||||
tab_spaces += 7 - ((width + tab_spaces) % 8);
|
||||
} else {
|
||||
only_spaces = 0;
|
||||
was_spaces = 0;
|
||||
@ -476,7 +480,7 @@ add_document_lines(struct plain_renderer *renderer)
|
||||
}
|
||||
|
||||
if (only_spaces && step) {
|
||||
if (renderer->compress && was_empty_line) {
|
||||
if (was_wrapped || (renderer->compress && was_empty_line)) {
|
||||
/* Successive empty lines will appear as one. */
|
||||
length -= step + spaces;
|
||||
source += step + spaces;
|
||||
@ -493,6 +497,7 @@ add_document_lines(struct plain_renderer *renderer)
|
||||
|
||||
} else {
|
||||
was_empty_line = 0;
|
||||
was_wrapped = !step;
|
||||
|
||||
if (was_spaces && step) {
|
||||
/* Drop trailing whitespaces. */
|
||||
|
@ -106,4 +106,8 @@
|
||||
#define DEFAULT_TERMINAL_WIDTH 80
|
||||
#define DEFAULT_TERMINAL_HEIGHT 25
|
||||
|
||||
/* If this is non-negative, lines in extra-wide table cells will be wrapped
|
||||
* to fit in the screen, with this much extra space. Try 4. */
|
||||
#define TABLE_LINE_PADDING -1
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user