Jonas Fonseca <[EMAIL PROTECTED]> writes: > I don't know if you could post a patch so it would be possible to > test it.
Display U+303F rather than U+0020 if a double-cell character doesn't fit.
I searched for ' ' and 32 and 0x20 and \x20, and replaced with
UCS_ORPHAN_CELL wherever UCS_NO_CHAR was involved. However,
this doesn't seem to suffice for BFU input fields.
---
commit 6db67602339517bf1966de0d3720094f7c3df688
tree 1d8ad0d3088ee9378e05f2462707ca603319b03c
parent cb02b46154a178fccbe4a3ac0170d6823dadaa83
author Kalle Olavi Niemitalo <[EMAIL PROTECTED]> Sun, 12 Nov 2006 19:53:31 +0200
committer Kalle Olavi Niemitalo <[EMAIL PROTECTED]> Sun, 12 Nov 2006 19:53:31 +0200
src/bfu/menu.c | 8 ++++----
src/intl/charsets.h | 6 ++++++
src/terminal/draw.c | 22 +++++++++++-----------
src/viewer/text/form.c | 9 +++++----
4 files changed, 26 insertions(+), 19 deletions(-)
diff --git a/src/bfu/menu.c b/src/bfu/menu.c
index 3bbfbc9..2bee057 100644
--- a/src/bfu/menu.c
+++ b/src/bfu/menu.c
@@ -483,7 +483,7 @@ #endif /* CONFIG_DEBUG */
UCS_NO_CHAR, 0, hk_color);
} else {
draw_char(term, xbase + x - 1, y,
- ' ', 0, hk_color);
+ UCS_ORPHAN_CELL, 0, hk_color);
}
} else {
#ifdef CONFIG_DEBUG
@@ -508,7 +508,7 @@ #endif /* CONFIG_DEBUG */
y, UCS_NO_CHAR, 0, color);
} else {
draw_char(term, xbase + x - !!hk_state,
- y, ' ', 0, color);
+ y, UCS_ORPHAN_CELL, 0, color);
}
} else {
draw_char(term, xbase + x - !!hk_state,
@@ -1171,10 +1171,10 @@ #ifdef CONFIG_UTF8
/* Is second cell of double-width char on the place where
* first char of the R_MAINMENU_SPACE will be displayed? */
if (schar->data == UCS_NO_CHAR) {
- /* Replace double-width char with ' '. */
+ /* Replace double-width char with UCS_ORPHAN_CELL. */
schar++;
draw_char_data(term, term->width - R_MAINMENU_SPACE - 1,
- 0, ' ');
+ 0, UCS_ORPHAN_CELL);
}
}
#endif
diff --git a/src/intl/charsets.h b/src/intl/charsets.h
index 25e14a3..4a9422e 100644
--- a/src/intl/charsets.h
+++ b/src/intl/charsets.h
@@ -16,6 +16,12 @@ #define UCS_REPLACEMENT_CHARACTER ((unic
* for the second cell of a double-cell character. */
#define UCS_NO_CHAR ((unicode_val_T) 0xFFFFFFFD)
+/* If ELinks should display a double-cell character but there is only
+ * one cell available, it displays this character instead. This must
+ * be a single-cell character but need not be unique. Possible values
+ * might be U+0020 SPACE or U+303F IDEOGRAPHIC HALF FILL SPACE. */
+#define UCS_ORPHAN_CELL ((unicode_val_T) 0x303F)
+
/* replacement character. See u2cp(). */
#define NBSP_CHAR ((unsigned char) 1)
#define NBSP_CHAR_STRING "\001"
diff --git a/src/terminal/draw.c b/src/terminal/draw.c
index e3ba499..5e81e2b 100644
--- a/src/terminal/draw.c
+++ b/src/terminal/draw.c
@@ -160,7 +160,7 @@ #ifdef CONFIG_UTF8
sc = line;
data_save = sc->data;
- sc->data = ' ';
+ sc->data = UCS_ORPHAN_CELL;
copy_screen_chars(screen_char, line, 1);
sc->data = data_save;
size--;
@@ -169,13 +169,13 @@ #ifdef CONFIG_UTF8
}
/* Instead of displaying double-width character at last column
- * display only space. */
+ * display only UCS_ORPHAN_CELL. */
if (size - 1 > 0 && unicode_to_cell(line[size - 1].data) == 2) {
unicode_val_T data_save;
sc = &line[size - 1];
data_save = sc->data;
- sc->data = ' ';
+ sc->data = UCS_ORPHAN_CELL;
copy_screen_chars(screen_char, line, size);
sc->data = data_save;
} else {
@@ -256,7 +256,7 @@ draw_border(struct terminal *term, struc
#ifdef CONFIG_UTF8
/* Checks cells left and right to the box for broken double-width chars.
- * Replace it with ' '.
+ * Replace it with UCS_ORPHAN_CELL.
* 1+---+3
* 1|box|##4
* 1| |##4
@@ -284,7 +284,7 @@ fix_dwchar_around_box(struct terminal *t
schar = get_char(term, x, y);
for (;height--; schar += term->width)
if (unicode_to_cell(schar->data) == 2)
- schar->data = ' ';
+ schar->data = UCS_ORPHAN_CELL;
}
/* 2 */
@@ -296,7 +296,7 @@ fix_dwchar_around_box(struct terminal *t
schar = get_char(term, x, y);
for (;height--; schar += term->width)
if (unicode_to_cell(schar->data) == 2)
- schar->data = ' ';
+ schar->data = UCS_ORPHAN_CELL;
}
/* 3 */
@@ -308,7 +308,7 @@ fix_dwchar_around_box(struct terminal *t
schar = get_char(term, x, y);
for (;height--; schar += term->width)
if (schar->data == UCS_NO_CHAR)
- schar->data = ' ';
+ schar->data = UCS_ORPHAN_CELL;
}
/* 4 */
@@ -320,7 +320,7 @@ fix_dwchar_around_box(struct terminal *t
schar = get_char(term, x, y);
for (;height--; schar += term->width)
if (schar->data == UCS_NO_CHAR)
- schar->data = ' ';
+ schar->data = UCS_ORPHAN_CELL;
}
}
#endif
@@ -437,7 +437,7 @@ draw_text_utf8(struct terminal *term, in
}
if (start->data == UCS_NO_CHAR && x - 1 > 0)
- draw_char_data(term, x - 1, y, ' ');
+ draw_char_data(term, x - 1, y, UCS_ORPHAN_CELL);
pos = start;
@@ -451,7 +451,7 @@ draw_text_utf8(struct terminal *term, in
pos->data = UCS_NO_CHAR;
pos->attr = 0;
} else {
- pos->data = (unicode_val_T)' ';
+ pos->data = UCS_ORPHAN_CELL;
}
} else {
pos->data = data;
@@ -474,7 +474,7 @@ draw_text_utf8(struct terminal *term, in
pos->data = UCS_NO_CHAR;
pos->attr = 0;
} else {
- pos->data = (unicode_val_T)' ';
+ pos->data = UCS_ORPHAN_CELL;
}
} else {
pos->data = data;
diff --git a/src/viewer/text/form.c b/src/viewer/text/form.c
index fa43052..83d904f 100644
--- a/src/viewer/text/form.c
+++ b/src/viewer/text/form.c
@@ -412,13 +412,14 @@ retry_after_scroll:
}
/* The character does not fit completely.
- * Write spaces to the cells that do fit. */
+ * Write UCS_ORPHAN_CELL to the cells that
+ * do fit. */
for (cell = 0; cell < cells; cell++) {
if (col_is_in_box(box, x + i + cell)
&& i + cell < fc->size)
draw_char_data(term,
- x + i + cell,
- y, ' ');
+ x + i + cell, y,
+ UCS_ORPHAN_CELL);
}
drew_char:
@@ -538,7 +539,7 @@ utf8_select:
data = UCS_NO_CHAR;
i++;
} else if (cell == 2) {
- data = ' ';
+ data = UCS_ORPHAN_CELL;
}
} else
data = '_';
pgpuJvtPxPV5E.pgp
Description: PGP signature
_______________________________________________ elinks-users mailing list [email protected] http://linuxfromscratch.org/mailman/listinfo/elinks-users
