[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev [PATCH 2.8.5-dev15] table indentation
From: |
Ilya Zakharevich |
Subject: |
lynx-dev [PATCH 2.8.5-dev15] table indentation |
Date: |
Sun, 28 Sep 2003 15:47:58 -0700 |
User-agent: |
Mutt/1.4i |
It turned out that the indentation parameters were used many times
inside a table - once inside a cell, then inside the cell of enclosing
table etc - and then for the toplevel table as a whole.
This patch may also fix irregularities when a cell layout is
influenced by the <center> surrounding the table.
Enjoy,
Ilya
--- ./src/GridText.c-pre Sun Sep 28 13:12:38 2003
+++ ./src/GridText.c Sun Sep 28 15:34:02 2003
@@ -2907,8 +2907,9 @@ PRIVATE void split_line ARGS2(
{
HTStyle * style = text->style;
int spare;
- int indent = text->in_line_1 ?
+ int indent = text->stbl ? 0 : text->in_line_1 ?
text->style->indent1st : text->style->leftIndent;
+ int extra_space = indent + (text->stbl ? 0 : text->style->rightIndent);
short alignment;
TextAnchor * a;
int CurLine = text->Lines;
@@ -3000,7 +3001,7 @@ PRIVATE void split_line ARGS2(
text->permissible_split = 0; /* 12/13/93 */
line->data[0] = '\0';
- alignment = style->alignment;
+ alignment = text->stbl ? HT_LEFT : style->alignment;
if (split > 0) { /* Restore flags to the value at the splitting point */
if (!(dump_output_immediately && use_underscore))
@@ -3256,8 +3257,7 @@ PRIVATE void split_line ARGS2(
ctrl_chars_on_previous_line--;
/* @@ first line indent */
- spare = (WRAP_COLS(text)-1) -
- (int)style->rightIndent - indent +
+ spare = (WRAP_COLS(text)-1) - extra_space +
ctrl_chars_on_previous_line - previous->size;
if (spare < 0 && LYwideLines) /* Can be wider than screen */
spare = 0;
@@ -3431,8 +3431,7 @@ PRIVATE void split_line ARGS2(
&& justify_max_void_percent <= 100
&& justify_max_void_percent >= ((100*spare)
/ ((WRAP_COLS(text) - 1)
- - (int)style->rightIndent
- - indent
+ - extra_space
+ ctrl_chars_on_previous_line))) {
/* this is the only case when we need justification*/
char* jp = previous->data + justify_start_position;
@@ -3715,8 +3714,10 @@ PUBLIC void HText_appendCharacter ARGS2(
int, ch)
{
HTLine * line;
- HTStyle * style;
- int indent;
+ HTStyle * style = text->style;
+ int indent = text->stbl ? 0
+ : text->in_line_1 ? (int)style->indent1st : (int)style->leftIndent;
+ int right_indent = text->stbl ? 0 : text->style->rightIndent;
int limit = 0;
int actual;
int flush_cell = 1;
@@ -3942,9 +3943,6 @@ PUBLIC void HText_appendCharacter ARGS2(
}
line = text->last_line;
- style = text->style;
-
- indent = text->in_line_1 ? (int)style->indent1st : (int)style->leftIndent;
if (HTCJK != NOCJK) {
switch(text->state) {
@@ -4363,7 +4361,7 @@ PUBLIC void HText_appendCharacter ARGS2(
else
target_cu = target + (here_cu - here);
- if (target > (WRAP_COLS(text)-1) - (int)style->rightIndent &&
+ if (target > (WRAP_COLS(text)-1) - right_indent &&
HTOutputFormat != WWW_SOURCE) {
new_line(text);
} else {
@@ -4394,7 +4392,7 @@ check_WrapSource:
*/
int target = (int)(line->offset + line->size) - ctrl_chars_on_this_line;
int target_cu = target + UTFXTRA_ON_THIS_LINE;
- if (target >= (WRAP_COLS(text)-1) - style->rightIndent -
+ if (target >= (WRAP_COLS(text)-1) - right_indent -
(((HTCJK != NOCJK) && text->kanji_buf) ? 1 : 0) ||
(text->T.output_utf8 &&
target_cu + UTF_XLEN(ch) >= (LYcols_cu(text)-1))) {
@@ -4451,7 +4449,7 @@ check_WrapSource:
? 2
: 1))))) + 2;
}
- if ((nominal + (int)style->rightIndent) >= limit
+ if ((nominal + right_indent) >= limit
|| (nominal + UTFXTRA_ON_THIS_LINE) >= (LYcols_cu(text) - 1)) {
return;
}
@@ -4470,7 +4468,7 @@ check_WrapSource:
limit = (LYcols_cu(text) - 1);
} else {
actual +=
- (int)style->rightIndent - ctrl_chars_on_this_line +
+ right_indent - ctrl_chars_on_this_line +
(((HTCJK != NOCJK) && text->kanji_buf) ? 1 : 0);
limit = (WRAP_COLS(text) - 1);
}
@@ -4785,12 +4783,13 @@ PRIVATE int HText_insertBlanksInStblLine
#endif
int added_chars_before = 0;
int lines_changed = 0;
- int max_width = 0, indent, spare, table_offset;
+ int max_width = 0, indent, spare, table_offset, right_indent;
HTStyle *style;
short alignment;
int i = 0, prevline_len = -1, do_unsplit, deleted = 0;
int row_start_line = -1, cur_col = -1, cell_line_count = -1;
int last_row_start_line, startrow_deleted, vert_move = 1;
+ STable_info *enclosing;
lineno = first_lineno = Stbl_getStartLine(me->stbl);
if (lineno < 0 || lineno > me->Lines)
@@ -4997,21 +4996,22 @@ PRIVATE int HText_insertBlanksInStblLine
* HTML_TABLE should take care of this.
*/
style = me->style;
- alignment = Stbl_getAlignment(me->stbl);
+ enclosing = Stbl_get_enclosing(me->stbl);
+ alignment = enclosing ? HT_LEFT : Stbl_getAlignment(me->stbl);
if (alignment == HT_ALIGN_NONE)
alignment = style->alignment;
- indent = style->leftIndent;
+ indent = enclosing ? 0 : style->leftIndent;
+ right_indent = enclosing ? 0 : style->rightIndent;
/* Calculate spare character positions */
- spare = (WRAP_COLS(me)-1) -
- (int)style->rightIndent - indent - max_width;
- if (spare < 0 && (int)style->rightIndent + spare >= 0) {
+ spare = (WRAP_COLS(me)-1) - right_indent - indent - max_width;
+ if (spare < 0 && right_indent + spare >= 0) {
/*
* Not enough room! But we can fit if we ignore right indentation,
* so let's do that.
*/
spare = 0;
} else if (spare < 0) {
- spare += style->rightIndent; /* ignore right indent, but need more */
+ spare += right_indent; /* ignore right indent, but need more */
}
if (spare < 0 && indent + spare >= 0) {
/*
; To UNSUBSCRIBE: Send "unsubscribe lynx-dev" to address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- lynx-dev [PATCH 2.8.5-dev15] table indentation,
Ilya Zakharevich <=