1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-02 02:15:28 +00:00
Commit Graph

227 Commits

Author SHA1 Message Date
Kalle Olavi Niemitalo
ca60a69b57 UTF-8, set_screen_driver_opt: Don't test driver->opt.utf8 after utf8_io.
They have the same value so one test will suffice.
2007-05-19 14:48:10 +03:00
Kalle Olavi Niemitalo
8369e9bd66 UTF-8, set_screen_driver_opt: Shrink #ifdef CONFIG_UTF8 regions. 2007-05-19 14:46:41 +03:00
Kalle Olavi Niemitalo
ac74e2db60 UTF-8, set_screen_driver_opt: Duplicate CONFIG_UTF8 code. 2007-05-19 14:46:19 +03:00
Kalle Olavi Niemitalo
e7eecbfa70 UTF-8: Change type of constants to struct screen_driver_opt.
We don't need a full struct screen_driver here.
2007-05-19 14:31:24 +03:00
Kalle Olavi Niemitalo
ce8096e5ec UTF-8: Leave driver->opt initialization to set_screen_driver_opt.
Don't bother to initialize driver->opt with memcpy in add_screen_driver.
2007-05-19 14:25:34 +03:00
Kalle Olavi Niemitalo
62ef1e8684 UTF-8: Rename update_screen_driver to set_screen_driver_opt. 2007-05-19 14:24:41 +03:00
Kalle Olavi Niemitalo
93974d653e UTF-8, update_screen_driver: Restore all original options. 2007-05-19 14:24:23 +03:00
Kalle Olavi Niemitalo
883920ba68 UTF-8: New struct screen_driver_opt engulfs most of struct screen_driver.
No behaviour changes yet, although padding may differ.
2007-05-19 14:24:00 +03:00
Kalle Olavi Niemitalo
609b4f652e UTF-8, update_screen_driver: First read the "charset" option. 2007-05-19 14:23:16 +03:00
Kalle Olavi Niemitalo
7a1304677a UTF-8, update_screen_driver: A small rearrangement.
This does not change the behaviour but will help later changes.
2007-05-19 14:23:00 +03:00
Laurent MONIN
3ae299c3ca Prevent internal errors when terminal width or height are very small
(1x1 was fatal).
2007-04-27 17:55:12 +02:00
Kalle Olavi Niemitalo
443db69980 Don't mark undisplayed names of modules for translation.
Exclude unneeded header files.  This partially reverts commit
90980a944e, with permission.
2007-03-23 00:51:56 +02:00
Laurent MONIN
90980a944e Mark all module names for translation and include needed header files. 2007-03-21 11:01:06 +01:00
Kalle Olavi Niemitalo
44adb76799 Use add_string_to_string where applicable. 2007-03-18 20:29:08 +02:00
Kalle Olavi Niemitalo
801d520ddd Fix compiler errors without HAVE_VARIADIC_MACROS. 2007-03-11 12:22:02 +02:00
Kalle Olavi Niemitalo
2b7788614f Type-check button arguments of msg_box.
Don't cast function pointers; calling functions via pointers of
incorrect types is not guaranteed to work.  Instead, define the
functions with the desired types, and make them cast the incoming
parameters.  Or define wrapper functions if the return types don't
match.

really_exit_prog wasn't being used outside src/dialogs/menu.c,
and I had to change its parameter type, so it's now static.
2007-03-10 23:50:56 +02:00
Laurent MONIN
f2916d8646 unblock_itrm(),block_itrm(): drop unused parameter fd. 2007-03-05 22:54:24 +01:00
Kalle Olavi Niemitalo
3602899e3e palette.inc: Comment fixes. 2007-03-03 09:46:51 +02:00
Kalle Olavi Niemitalo
0bd0dd160e palette256: Comment about "web-safe" colors. 2007-02-27 10:31:18 +02:00
Kalle Olavi Niemitalo
76be98030a Bug 890, palette256: Change colors 0-15 to match xterm defaults. 2007-02-27 03:56:43 +02:00
Witold Filipczyk
b81bcd8307 Removed the buggy code. 2007-01-28 17:45:24 +02:00
Kalle Olavi Niemitalo
f4709c3794 Bug 882: Replace C1 controls with spaces in UTF-8 to the terminal. 2007-01-27 11:12:22 +02:00
Kalle Olavi Niemitalo
564a6b9602 Bug 882, add_char_data: Document the charsets being used. 2007-01-27 10:25:51 +02:00
Kalle Olavi Niemitalo
5882ec0ce7 Make color256_seqs and color_true_seqs const. 2007-01-25 01:04:19 +02:00
Kalle Olavi Niemitalo
61520b9040 Make inactive screen drivers const. 2007-01-25 00:21:45 +02:00
Kalle Olavi Niemitalo
11006800b5 Make struct strings const in underline mode setup and teardown. 2007-01-25 00:11:38 +02:00
Kalle Olavi Niemitalo
c62e23c161 Make struct strings const in frame mode setup and teardown. 2007-01-25 00:09:07 +02:00
Kalle Olavi Niemitalo
8dd400d49f Make frame translation tables const. 2007-01-25 00:05:36 +02:00
Kalle Olavi Niemitalo
34c636026d draw_line: Make it more obvious that line points into an array. 2007-01-24 23:15:07 +02:00
Kalle Olavi Niemitalo
3b7c021254 Comment changes only (about charsets in terminals). 2007-01-24 23:11:17 +02:00
Kalle Olavi Niemitalo
448f1b55cd Make some small arrays const. 2007-01-24 23:08:25 +02:00
Kalle Olavi Niemitalo
ef96caad01 Make u2cp and u2cp_no_nbsp return a pointer to const. 2007-01-02 20:08:59 +02:00
Kalle Olavi Niemitalo
b586bd99bc Bug 871, 752: Lock down enum color_mode and change option help to match.
The numbering of document.dump.color_mode and terminal._template_.colors
is now the same regardless of compile-time options, unlike in previous
versions.  Therefore this version of ELinks may interpret a configuration
file differently from previous versions even if compiled with the same
options.  This is unfortunate but the alternatives (keeping the numbering
dependent on configuration options; defining separate options that use
the new numbering; starting the numbers from 10 or so and recognizing the
previous ones only for compatibility) seem even worse.
2006-12-25 11:51:24 +02:00
Kalle Olavi Niemitalo
c56fb7d630 Bug 871: Fall back to 16 colors if color_mode is unsupported.
There may currently be no way to select an unsupported mode,
but the next commit will change that.
2006-12-25 11:25:06 +02:00
Kalle Olavi Niemitalo
2aad5c7d09 fg_color[][] is const. 2006-12-25 11:04:16 +02:00
Kalle Olavi Niemitalo
45f39847c3 color_modes[] is const. 2006-12-25 11:03:51 +02:00
Kalle Olavi Niemitalo
5ae8721ebd color_mode_infos are const. 2006-12-25 11:02:01 +02:00
Kalle Olavi Niemitalo
39673505c8 set_term_color: Fix a typo in a comment. 2006-12-25 10:56:15 +02:00
Kalle Olavi Niemitalo
cae9b720bc Palettes are const.
This does not conflict with querying the palette from xterm (bug 890)
because although those palettes would have to be modifiable, they
would be terminal-specific rather than global.
2006-12-25 10:54:54 +02:00
Kalle Olavi Niemitalo
b4359e0445 Explicitly compare to COLOR_MODE_MONO where appropriate. 2006-12-25 10:27:23 +02:00
Kalle Olavi Niemitalo
9efc661384 Bug 827: Force UTF-8 I/O on if the UTF-8 charset is selected. 2006-12-09 21:13:13 +02:00
Kalle Olavi Niemitalo
bddafe5f7e Document how timer callbacks erase timer IDs; add some assertions.
Tangential to bug 868.
2006-12-02 18:35:03 +02:00
Kalle Olavi Niemitalo
8b8cd57941 Use new macro UCS_ORPHAN_CELL for broken double-cell characters.
UCS_ORPHAN_CELL is currently defined as U+0020 SPACE, which was
already used before this macro, so the behaviour does not change,
but the code seems clearer now.

I searched for ' ' and 32 and 0x20 and \x20, and replaced with
UCS_ORPHAN_CELL wherever UCS_NO_CHAR was involved.  However,
some BFU widgets first draw spaces and then overwrite with text;
those will require a more complex fix if UCS_ORPHAN_CELL is ever
changed to some other character.
2006-11-13 00:49:59 +02:00
Kalle Olavi Niemitalo
97f2ca5166 draw_char_data: Document the dubious unicode_to_cell call.
This was found while examining bug 821.
2006-11-02 09:23:59 +02:00
Kalle Olavi Niemitalo
a0ed52e699 Bug 724: Quadruple ITRM_IN_QUEUE_SIZE from 16 to 64 bytes.
DEC VT510 can apparently send 46 bytes of device attributes.
2006-10-30 23:15:43 +02:00
Kalle Olavi Niemitalo
b7319a75db Bug 724: terminal: Correct parsing of ECMA-48 control sequences.
The previous version assumed the first non-digit after the CSI was the
Final Byte, for example the first semicolon in the "\E[?1;2c" report.
It then treated all subsequent bytes as typed characters.
According to Standard ECMA-48 (Fifth Edition - June 1991), there may
be any number of Parameter Bytes in the range 0x30 to 0x3F, and then
any number of Intermediate Bytes in the range 0x20 to 0x2F, between
the CSI and the Final Byte.

This version still does not support control sequences longer than
ITRM_IN_QUEUE_SIZE bytes.
2006-10-29 18:41:16 +02:00
Kalle Olavi Niemitalo
23ca645054 terminal: Treat ESC O as Alt-O if the next byte is unsuitable for SS3. 2006-10-29 18:27:54 +02:00
Kalle Olavi Niemitalo
1c5db85b1a Bug 821: Document the charsets of buffers for BFU and form input fields. 2006-10-25 19:46:01 +03:00
Miciah Dashiel Butler Masters
5605a046a7 handle_interlink_event: don't check whether key <= 0xFF
This is a given, because any value >= 0x100 is negated.
2006-10-20 23:10:34 +00:00
Petr Baudis
10d72cae7e Revert cfce869a69 (The UTF-8 detection reactivated.)
Total crap - spits out garbage on random terminals when attaching instances
and sometimes hang the attached instance.
2006-10-16 23:12:35 +02:00
Jonas Fonseca
9b5446a025 Fix warning about undefined sscanf on Mac OS X 2006-10-14 05:12:23 +02:00
Witold Filipczyk
cfce869a69 The UTF-8 detection reactivated. It trashes slightly screen,
but works probably.
2006-10-12 13:13:10 +02:00
Witold Filipczyk
eef961e206 Detection of UTF-8 mode doesn't work well on slave terminals. 2006-10-11 21:13:43 +02:00
Laurent MONIN
0b58b99d30 Use @current_tab for current tab. 2006-09-28 23:58:26 +02:00
Laurent MONIN
3f94687e28 Use @tabs_count instead of mixed tabs_count, num_tabs or tabs. 2006-09-28 23:50:46 +02:00
Kalle Olavi Niemitalo
bac6e76c23 switch_to_tab: Prevent "tab number out of range" assertion failure.
To reproduce:
- Start ELinks.
- Enable the ui.tabs.wraparound option.
- Press t to open a second tab.
- Go to http://elinks.cz/ in the second tab.
- Press 3< to step three tabs to the left.

In the statement "tab = tabs + tab % tabs;", tab == -2 and tabs == 2.
So tab % tabs == 0 and tab becomes 2, which is out of range.

The new version calls get_opt_bool even if the tab parameter is already in
range, but the cost should be negligible compared to the redraw_terminal()
call that follows.
2006-09-27 21:29:27 +03:00
Kalle Olavi Niemitalo
92cb452a9e Rename CONFIG_UTF_8 to CONFIG_UTF8.
The configure script no longer recognizes "CONFIG_UTF_8=yes" lines
in custom features.conf files.  They will have to be changed to
"CONFIG_UTF8=yes".  This incompatibility was deemed acceptable
because no released version of ELinks supports CONFIG_UTF_8.

The --enable-utf-8 option was not renamed.
2006-09-17 16:12:47 +03:00
Kalle Olavi Niemitalo
e8462980e5 Change "utf_8" to "utf8" in most identifiers.
Suggested by Miciah on #elinks.

What was renamed:
  add_utf_8                      => add_utf8
  cp2utf_8                       => cp2utf8
  encode_utf_8                   => encode_utf8
  get_translation_table_to_utf_8 => get_translation_table_to_utf8
  goto invalid_utf_8_start_byte  => goto invalid_utf8_start_byte
  goto utf_8                     => goto utf8
  goto utf_8_select              => goto utf8_select
  terminal_interlink.utf_8       => terminal_interlink.utf8
  utf_8_to_unicode               => utf8_to_unicode

What was not renamed:
  terminal._template_.utf_8_io option, TERM_OPT_UTF_8_IO
    Compatibility with existing elinks.conf files would require an alias.
  --enable-utf-8
    Because the name of the charset is UTF-8, --enable-utf-8 looks better
    than --enable-utf8.
  CONFIG_UTF_8
    Will be renamed in a later commit.
  Unicode/utf_8.cp, table_utf_8, aliases_utf_8
    Will be renamed in a later commit.
2006-09-17 16:06:22 +03:00
Kalle Olavi Niemitalo
b42f0ba153 Bug 772: Recognize ESC [ Z as Shift-Tab, and bind it like Alt-Tab by default. 2006-09-17 12:38:23 +03:00
Kalle Olavi Niemitalo
c6f871b3af terminal doc: Explain the "ECMA-48 Terminfo $TERM" comments. 2006-09-17 12:23:34 +03:00
Witold Filipczyk
d9037cc4c3 Small comment about UTF-8 detection. 2006-09-01 21:06:08 +02:00
Witold Filipczyk
c1c494bd4b Preserved Linux console mode. When console was in one char mode, restore it.
When console was in UTF-8 mode, restore it, too.
2006-08-27 14:18:02 +02:00
Kalle Olavi Niemitalo
55212827c7 Outdent labels as instructed in doc/hacking.txt.
Reported by Jonas Fonseca.

Also add an empty line above the label in init_tab; but there are
still several labels elsewhere that don't have empty lines above them.
2006-08-27 10:44:36 +03:00
Witold Filipczyk
d299501076 Avoided white on white and similar cases in true color mode. 2006-08-26 19:21:08 +02:00
Witold Filipczyk
a094bddd1b Removed dead code. Add suffix _256 to TERM_COLOR_(BACK|FORE)GROUND. 2006-08-26 19:05:31 +02:00
Kalle Olavi Niemitalo
be7526d00a terminal UTF-8: Reject code points reserved for UTF-16 surrogates.
Those code points are allowed in CESU-8 but not in UTF-8.
2006-08-25 22:25:55 +03:00
Kalle Olavi Niemitalo
e333fb37ab terminal UTF-8: Have an array for the interlink->utf_8.min values.
The previous scheme incorrectly accepted 0xC1 0x80 as U+0040.
That could have been fixed by tweaking the loop, but the constant
array is surely easier to verify.
2006-08-25 22:20:33 +03:00
Jonas Fonseca
0ae69652dd Define SCREEN_COLOR_SIZE to hold the number of bytes in screen_char->color 2006-08-20 21:24:20 +02:00
Witold Filipczyk
77d7741726 Fixed transparency in true color mode. 2006-08-20 15:19:25 +02:00
Witold Filipczyk
60544f748e Fixed issue with CONFIG_TRUE_COLOR and 16 colors mode. inline functions used
instead of macros. Still problems with transparency in true color mode.
2006-08-20 14:51:06 +02:00
Witold Filipczyk
13dc5f01ea Note about efficiency. I know that normal 16 color mode is broken (menu).
Maybe someone knows how to fix it.
2006-08-19 23:57:50 +02:00
Witold Filipczyk
4f78b0dda1 True color mode. See new konsole.
TODO: dump
2006-08-19 23:39:40 +02:00
Kalle Olavi Niemitalo
0748ee8c92 UTF-8: Split UCS_REPLACEMENT_CHARACTER off UCS_NO_CHAR.
In the previous version, invalid UTF-8 from a terminal caused
UCS_NO_CHAR (0xFFFFFFFD) to be stored in a term_event_key_T, resulting
in -3 which was then incidentally treated as an unassigned special key.

Now, invalid UTF-8 is instead mapped to UCS_REPLACEMENT_CHARACTER
and treated as a character.  The fact that handle_interlink_event
calls term_send_ucs when it receives invalid UTF-8 makes it pretty
clear that this is how it was intended.

src/viewer/text/link.c (not changed in this commit) already referred
to UCS_REPLACEMENT_CHARACTER in a comment even though it was not
previously defined.
2006-08-19 13:35:21 +03:00
Jonas Fonseca
c8c8325092 Fix assertion failure related to closing all tabs but the current
Decrement term->current_tab before calling delete_window() instead of after
deleting all backgrounded tabs, so get_tab_by_number() will see a
consistent value.
2006-08-14 16:12:54 +02:00
Jonas Fonseca
c5005ceeb3 Merge with http://www.iki.fi/kon/2006/elinks.git#ucs_kbdbind 2006-08-14 02:14:04 +02:00
Kalle Olavi Niemitalo
5737cc546b terminal UTF-8: check_kbd_label_key() allows non-ASCII characters again.
All of its callers now use unicode_fold_label_case() rather than toupper(),
if CONFIG_UTF_8 is defined.
2006-08-13 23:48:18 +03:00
Kalle Olavi Niemitalo
3b54979481 terminal doc: More documentation for keyboard event structures. 2006-08-13 23:25:52 +03:00
Kalle Olavi Niemitalo
7ebc8d8281 terminal UTF-8: New type term_event_char_T.
It is either unicode_val_T or unsigned char.
2006-08-13 23:23:54 +03:00
Laurent MONIN
0fdba55e52 Few whitespaces fixes. 2006-08-13 20:57:35 +02:00
Kalle Olavi Niemitalo
c8584a1c7e terminal: New type term_event_modifier_T.
KBD_MOD_NONE and related constants are now also visible in GDB.
2006-08-13 19:41:46 +03:00
Kalle Olavi Niemitalo
f290ff5608 terminal: New enum term_event_special_key.
This makes constants like KBD_ENTER visible to the debugger, at least
when compiled with GCC.
2006-08-13 19:03:09 +03:00
Kalle Olavi Niemitalo
c5c36eba88 terminal: Define term_event_key_T as int32_t, not int.
int might be 16-bit and that is not enough.
2006-08-13 17:16:10 +03:00
Kalle Olavi Niemitalo
de93359a5a Support Ctrl-Alt-letter key combinations.
Actions can now be bound to e.g. Ctrl-Alt-A.  The keybinding code also
supports other combinations of modifiers, like Shift-Ctrl-Up, but the
escape sequence decoder doesn't yet.

Don't let Ctrl-Alt-letter combinations open menus.
2006-08-13 15:32:06 +03:00
Kalle Olavi Niemitalo
6108c3e109 check_kbd_label_key: Allow only the Alt modifier.
Thus, pressing Ctrl-O in the "Terminal options" dialog no longer
triggers the "~OK" button.  One must instead press o, O, Alt-o, or
Alt-O.
2006-08-13 15:27:48 +03:00
Kalle Olavi Niemitalo
a14074a763 try_document_key: Convert the key to UCS-4, resolving the FIXME.
This requires compiling cp2u() in even without CONFIG_UTF_8.
I also added an is_kbd_character macro to make try_document_key
more resilient to changes in the definition of term_event_key_T.
2006-08-12 16:04:21 +03:00
Kalle Olavi Niemitalo
f3b04b8645 terminal: Introduce term_event_key_T. 2006-08-12 14:48:08 +03:00
Miciah Dashiel Butler Masters
cfbf7d1439 Comment the UTF-8 decoding in handle_interlink_event
Thanks to Kalle Olavi Niemitalo for explaining it to me. Any errors,
however, are no doubt my own.
2006-08-06 22:17:20 +00:00
Kalle Olavi Niemitalo
462607416c terminal: Read modifiers from the first UTF-8 byte, not the last.
Previously, ELinks used to silently discard the Alt modifier from
Alt-ö keystrokes when UTF-8 I/O was enabled.  Now, separate actions
can be bound to ö and Alt-ö.

However, if CONFIG_UTF_8 is defined, then actions cannot be bound to
non-ASCII characters, regardless of modifiers.  This is because the
code that handles names of keystrokes assumes a character can only be
a single byte.  This commit does not change that.
2006-08-06 20:51:49 +00:00
Kalle Olavi Niemitalo
a9da075eb5 terminal UTF-8: term_event_keyboard.key is UCS-4, #ifdef CONFIG_UTF_8.
Form fields and BFU text-input widgets then convert from UCS-4 to UTF-8.
If not all UTF-8 bytes fit, they don't insert anything.  Thus it is no
longer possible to get invalid UTF-8 by hitting the length limit.

It is unclear to me which charset is supposed to be used for strings
in internal buffers.  I made BFU insert UTF-8 whenever CONFIG_UTF_8,
but form fields use the charset of the terminal; that may have to be
changed.

As a side effect, this change should solve bug 782, because
term_send_ucs no longer encodes in UTF-8 if CONFIG_UTF_8 is defined.
I think the UTF-8 and codepage encoding calls I added are safe, too.
A similar bug may still surface somewhere else, but 782 could be
closed for now.

This change also lays the foundation for binding actions to non-ASCII
keys, but the keystroke name parser doesn't yet support that.
The CONFIG_UTF_8 mode does not currently support non-ASCII characters
in hot keys, either.
2006-08-06 20:02:43 +00:00
Kalle Olavi Niemitalo
8a1d7e2fa3 terminal UTF-8: Translate all input via UCS-4, #ifdef CONFIG_UTF_8. 2006-08-06 20:02:41 +00:00
Kalle Olavi Niemitalo
1e9f5f6743 terminal: term_send_ucs makes its own struct term_event. 2006-08-06 20:02:40 +00:00
Kalle Olavi Niemitalo
e2a93ac8c3 Renumber special keys to negative values, making room for Unicode.
This version should still be interlink compatible with previous ones.
2006-08-06 20:02:40 +00:00
Kalle Olavi Niemitalo
fde466bde9 terminal: Introduce macros for KBD_F1...KBD_F12 arithmetic. 2006-08-06 20:02:39 +00:00
Kalle Olavi Niemitalo
6052fa12d8 terminal: Define separate structs for events passed via the interlink socket.
This way, struct term_event can be changed without any interprocess
compatibility problems.
2006-08-06 20:02:39 +00:00
Kalle Olavi Niemitalo
51bc99a175 terminal: decode_terminal_escape_sequence ignores previous value of *ev.
There is no need to check whether ev->ev == EVENT_KBD;
if decode_terminal_escape_sequence called
decode_terminal_mouse_escape_sequence, then the former neither modified
kbd.key nor passed &kbd to the latter, so kbd.key remains KBD_UNDEF.

If ev->ev was not checked, then it should not be trusted either.
So reinitialize the whole *ev if a keyboard event was indeed found.
2006-08-06 20:02:38 +00:00
Kalle Olavi Niemitalo
9e30ee631c terminal: Do not call toupper with potentially out-of-range values.
For instance, if Ctrl-F1 were pressed and src/terminal/kbd.c supported it,
then toupper(KBD_F1) would be called, resulting in undefined behaviour.
src/terminal/kbd.c does not support such combinations yet, but it is
safest to fix the bug already.
2006-08-06 20:02:38 +00:00
Kalle Olavi Niemitalo
50603fc66c terminal: Decode UTF-8 only from bytes, not from codes of special keys. 2006-08-06 20:02:37 +00:00
Kalle Olavi Niemitalo
cccab0462a terminal doc: itrm.in.sock == itrm.out.std in the master process.
As already documented at handle_trm().
2006-08-01 11:00:23 +00:00
Kalle Olavi Niemitalo
c04afba4e9 terminal doc: TERM=sun explains 4 ctl seqs. Terminfo u6 is position report. 2006-08-01 11:00:22 +00:00
Kalle Olavi Niemitalo
d5f30e77a5 terminal doc: Try to name one terminal for each keyboard escape sequence.
Also list the capnames with which the escape sequences could be
read from Terminfo, and the ECMA-48 interpretations of the bytes
(parenthesized if they seem unrelated to the keys).  This is in
preparation for fixing bug 96.
2006-08-01 11:00:22 +00:00