[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev current_codepage in WIN_EX&&CJK_EX (was: Lynx .IDE file for Bor
From: |
Hataguchi Takeshi |
Subject: |
lynx-dev current_codepage in WIN_EX&&CJK_EX (was: Lynx .IDE file for Borland C ++) |
Date: |
Mon, 10 Jan 2000 11:10:19 +0900 (JST) |
On Thu, 6 Jan 2000, Klaus Weide wrote:
> On Wed, 5 Jan 2000, Hiroyuki Senshu wrote:
> > Klaus Weide wrote:
> > >On Sat, 8 Jan 2000, Vlad Harchev wrote:
> > >
> > >> The 'current_codepage' is referenced in the following code fragement in
> > >> LYCurses.c:
> > >>
> > >> #if defined(WIN_EX) && defined(CJK_EX) /* 1999/08/26 (Thu) 17:53:38 */
> > >> {
> > >> extern int current_codepage; /* PDCurses lib. */
> > >>
> > >> if (current_codepage == 932)
> > >> LYcols = COLS - 1;
> > >> }
> > >> #endif
[snip]
> If character writing doesn't stop before the 80th column, (by
> breaking/wrapping the line or truncating the displayed contents or
> *something*,) then bad things may happen. That's apparently what you
> are running into in some CJK modus, and what you are trying to avoid.
I wrote a patch for dev18. The main changes are:
o wrap a long text which includes only CJK characters in source mode.
o avoid to write CJK characters at the 80th column.
A text which includes only CJK characters was never wrapped in
source mode before. So I changed "goto check_IgnoreExcess;" to
"goto check_Tab;". But I'm not sure this is an appropriate way.
I've only tested long texts in PRE and in source mode. It seems
to work fine. I think the fragments, which includes current_codepage,
should be removed.
> It is HText_appendCharacter's responsibility to split lines early
> enough (if lines are to be split). It is display_line's
> responsibility to not actually output something into the 80th column,
> even if the line structure should be longer than displayable. That
I changed only HText_appendCharacter, but didn't change display_line.
Though display_line should be changed also, I don't know how to change it.
--
Takeshi Hataguchi
E-mail: address@hidden
--- GridText.c.org Fri Jan 7 12:02:22 2000
+++ GridText.c Mon Jan 10 09:09:36 2000
@@ -3677,7 +3677,7 @@
}
}
} else {
- goto check_IgnoreExcess;
+ goto check_Tab;
}
} else if (ch == CH_ESC) { /* S/390 -- gil -- 1587 */
return;
@@ -3882,6 +3882,7 @@
/*
* Tabs.
*/
+check_Tab:
if (ch == '\t') {
CONST HTTabStop * Tab;
int target, target_cu; /* Where to tab to */
@@ -3959,13 +3960,21 @@
*/
int target = (int)(line->offset + line->size) - ctrl_chars_on_this_line;
int target_cu = target + utfxtra_on_this_line;
- if (target >= (LYcols-1) - style->rightIndent ||
+ if (target >= (LYcols-1) - style->rightIndent -
+ ((HTCJK != NOCJK) && text->kanji_buf) ? 1 : 0 ||
(text->T.output_utf8 &&
target_cu + UTF_XLEN(ch) >= (LYcols_cu-1))
) {
+ int save_kanji_buf = text->kanji_buf;
+ int save_state = text->state;
+
+ text->kanji_buf = '\0';
+ text->state = S_text;
new_line(text);
line = text->last_line;
HText_appendCharacter (text, LY_SOFT_NEWLINE);
+ text->kanji_buf = save_kanji_buf;
+ text->state = save_state;
}
}
@@ -3998,6 +4007,7 @@
*/
if (((indent + (int)line->offset + (int)line->size) +
(int)style->rightIndent - ctrl_chars_on_this_line +
+ (((HTCJK != NOCJK) && text->kanji_buf) ? 1 : 0) +
((line->size > 0) &&
(int)(line->data[line->size-1] ==
LY_SOFT_HYPHEN ?
- lynx-dev current_codepage in WIN_EX&&CJK_EX (was: Lynx .IDE file for Borland C ++),
Hataguchi Takeshi <=