1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-30 03:26:23 -04:00
Commit Graph

175 Commits

Author SHA1 Message Date
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
Kalle Olavi Niemitalo
ee4c3ee426 terminal doc: Add a comment about $TERM on FreeBSD. 2006-08-01 11:00:22 +00:00
Kalle Olavi Niemitalo
8f99828c75 terminal: Decode ESC O entirely separately from ESC [.
decode_terminal_escape_sequence() used to handle both, but
there is now a separate decode_terminal_application_key()
for ESC O.  I have not yet edited decode_terminal_escape_sequence();
there may be dead code in it.
2006-08-01 11:00:21 +00:00
Kalle Olavi Niemitalo
886dbf64df terminal: Rewrite process_queue. 2006-08-01 11:00:21 +00:00
Kalle Olavi Niemitalo
62c0bff87e terminal: In the ESC timeout, don't assume merely ESC was pressed.
If there is e.g. ESC [ in the input buffer, combine that to Alt-[.
Check the first character too; don't blindly assume it is ESC, as
it can be NUL as well.  Note this means you can no longer activate
the main menu by pressing Ctrl-@ (or Ctrl-Space on some terminals).
2006-08-01 11:00:21 +00:00
Kalle Olavi Niemitalo
fbd84630ac terminal: Move kbd_timeout below set_kbd_event.
This ought to make the diff of the next commit more readable.
2006-08-01 11:00:20 +00:00
Kalle Olavi Niemitalo
539f756438 terminal: Kill the ESC timer when blocking the terminal.
Otherwise, the timeout could cause ELinks to resume reading from
the terminal device while another process is still using it.
This actually happened in a test.

On entry to some functions that could resume reading from the device,
assert that the terminal has not been blocked.
2006-08-01 11:00:20 +00:00
Kalle Olavi Niemitalo
671cbb48e6 terminal doc: More comments about itrm->in.queue and bug 777. 2006-08-01 11:00:19 +00:00
Kalle Olavi Niemitalo
e9216413f2 terminal doc: Clarify itrm.remote and some others; fix grammar. 2006-08-01 11:00:19 +00:00
Kalle Olavi Niemitalo
711d672357 terminal doc: Document struct itrm and related things. 2006-08-01 11:00:18 +00:00
Laurent MONIN
1136aefb71 Trim trailing whitespaces. 2006-07-27 09:51:10 +02:00
Laurent MONIN
a897a95721 Compilation fixes (CONFIG_UTF_8): move variables declarations at start
of blocks. Old compilers do not support in-block declarations.
2006-07-27 09:49:49 +02:00
Pavol Babincak
a7a7984d89 Merge with http://www.fi.muni.cz/~xbabinc/elinks/elinks-utf8.git/
without ucdata stuff. UTF-8 code cleanup. Added Pavol Babincak
to the AUTHORS
2006-07-25 09:59:12 +02:00
Witold Filipczyk
2a6125e3d0 Merge with utf8. src/document/plain/renderer.c replaced by utf8 version 2006-07-21 13:12:06 +02:00
Witold Filipczyk
8fa3a4c88f Use isscreensafe also for UTF-8 2006-07-20 03:42:22 +02:00
Miciah Dashiel Butler Masters
f040b6f100 Fix crash when exiting after disabling the mouse
Add guards to return if the mouse is enabled or disabled in disable_mouse
and enable_mouse, respectively.
2006-07-02 03:28:51 +00:00
Miciah Dashiel Butler Masters
a0bcf254ae Modularise src/terminal 2006-05-20 15:01:24 +00:00
Miciah Dashiel Butler Masters
739298b46d Replace a loop with arithmetic in move_current_tab 2006-05-15 20:00:27 +00:00
Miciah Dashiel Butler Masters
3ee31b956a Fix wraparound behaviour in switch_to_tab 2006-05-15 19:57:46 +00:00
Kalle Olavi Niemitalo
408f9174a8 Use int_bounds in move_current_tab.
Requested by Miciah Dashiel Butler Masters.
2006-05-15 22:20:45 +03:00
Kalle Olavi Niemitalo
2e42b2d4df Fix assertion failure when closing a terminal that has more than one tab.
src/terminal/terminal.c (destroy_terminal): Set term->current_tab = 0
before deleting any windows.
2006-05-14 23:13:51 +03:00
Kalle Olavi Niemitalo
39c157389d Don't let move_current_tab move the tab beyond the main menu.
src/terminal/tab.c (get_tab_by_number): Assert that the returned
struct window * actually points to a struct window.

src/terminal/tab.c (move_current_tab): Keep tabs contiguous in the
stack of windows.  Obey "ui.tabs.wraparound".

src/terminal/terminal.h (struct terminal): Documented that tabs can
move in the stack.

src/terminal/window.c (assert_window_stacking): Check that the main
menu isn't between tabs.
2006-05-14 22:17:26 +03:00
Kalle Olavi Niemitalo
276f723ab7 New tabs always open below dialogs, never above.
This fixes the bug that tabs opened with -remote used to hide existing
dialogs, which then became unusable until the new tabs were closed.

src/terminal/tab.c (init_tab): Put the new tab immediately above
existing ones, or if it's the first one, then at the bottom of the stack.
Added assertions.

src/terminal/terminal.h (struct terminal): Redocumented the stacking
order of windows.

src/terminal/window.c [CONFIG_DEBUG] (assert_window_stacking): New function.

src/terminal/window.h (assert_window_stacking): New function or no-op macro.
2006-05-14 14:03:17 +03:00
Witold Filipczyk
88c146a395 plain_renderer: cg-log -c | elinks works. The code needs cleanup 2006-05-07 15:49:08 +02:00
Pavol Babincak
c8a6a4c44d Fix broken double-width chars when displaying menu or dialog. 2006-04-09 16:59:27 +02:00
Pavol Babincak
69a1c40fbd Replace double-width chars in html renderer with ' ' if there isn't space.
Instead of double-width chars use ' ' in html renderer if there isn't
enought room for it.
2006-04-09 16:58:00 +02:00
Pavol Babincak
20331ffd74 Use unicode_val_T instead of uint16_t for unicode data. 2006-04-09 16:52:23 +02:00
Pavol Babincak
7d4dedcb8d Bug fix: dialog window opened with ELinks start wasn't right encoded.
term->utf8 should be set before computing anything to be written on screen.
But probably this is not the right place.
2006-03-07 00:38:41 +01:00
Pavol Babincak
b356da1850 Added better support for displaying double-width UTF-8 chars. 2006-03-05 00:37:10 +01:00
witekfl
a802f0fb3e Someone, sometime ago wanted always visible menu bar. This is attempt to
handle it. I have no idea where to make initialisation call to
activate_bfu_technology.
2006-03-03 19:01:15 +01:00
witekfl
0a8009c63a mouse: Write disable_mouse sequences only in xterm 2006-02-28 22:52:01 +01:00
Pavol Babincak
c726080def Double-width glyph support in terminal draw
Added unicode_to_cell detect double-width glyphs. Modified terminal draw to
correctly accept double-width glyphs.
2006-02-18 20:28:00 +01:00
Pavol Babincak
f9d67aeb73 Added configure option --enable-utf-8
For enabling better UTF-8 support by Witek and Scrool.
2006-02-18 20:28:00 +01:00
Witold Filipczyk
44a1aa9c87 Witekfl's UTF-8 patch v5. 2006-02-18 20:27:46 +01:00
Kalle Olavi Niemitalo
4217f2c555 Merge with http://elinks.cz/elinks.git 2006-02-18 12:21:47 +02:00
witekfl
fae675316b Let BSD users use DEL on the console 2006-02-15 23:25:54 +01:00
Kalle Olavi Niemitalo
edd087c722 Merge with http://elinks.cz/elinks.git 2006-02-12 17:17:54 +02:00
witekfl
cfbe41aa8a Linux and FreeBSD are not compatible. I prefer Linux 2006-02-12 14:19:39 +01:00
Kalle Olavi Niemitalo
416bd01269 Merge with http://elinks.cz/elinks.git 2006-02-12 00:34:53 +02:00
witekfl
791cab91e7 Make ELinks FreeBSD friendly. Defined keys used on FreeBSD console 2006-02-11 21:37:49 +01:00
Kalle Olavi Niemitalo
b1f8756c59 Merge with http://elinks.cz/elinks.git 2006-02-05 17:48:43 +02:00
Miciah Dashiel Butler Masters
466bb18be0 Move delayed_open to src/terminal/tab.c
The two copies of delayed_open in src/ecmascript/spidermonkey/window.c
and in src/ecmascript/see/window.c are identical, so move them
to src/terminal/tab.c and eliminate the duplication.
2006-01-16 19:28:03 +00:00
Jonas Fonseca
6deb090b48 Blast some more .vimrc files which for some strange reason was uncommitable 2006-01-15 19:14:10 +01:00
Jonas Fonseca
2748d043f9 Autogenerate .vimrc files and put the master in config/vimrc
This changes the init target to be idempotent: most importantly it will now
never overwrite a Makefile if it exists. Additionally 'make init' will
generate the .vimrc files. Yay, no more stupid 'added fairies' commits! ;)
2006-01-15 18:38:58 +01:00
Kalle Olavi Niemitalo
5ab2a1ef6e Merge with 0fae27fc27
(via http://elinks.cz/elinks.git)
Resolved conflicts in src/osdep/newwin.c.
2006-01-14 21:37:33 +02:00
Laurent MONIN
3f9bb0d7f9 CONFIG_BEOS -> CONFIG_OS_BEOS 2006-01-11 20:12:59 +01:00
Laurent MONIN
202965d338 CONFIG_WIN32 -> CONFIG_OS_WIN32 2006-01-11 20:10:27 +01:00
Kalle Olavi Niemitalo
2cfd0a9bb4 Merge with http://elinks.cz/elinks.git 2006-01-09 02:20:27 +02:00
Laurent MONIN
ee0dc57771 exec_on_master_terminal(): tidy up. 2006-01-07 01:57:11 +01:00
Laurent MONIN
2e67ca1df9 exec_on_master_terminal(): drop old commented code. 2006-01-07 01:55:18 +01:00
Laurent MONIN
16e2724c12 exec_on_master_terminal(): move code to caller instead. 2006-01-07 01:54:44 +01:00
Laurent MONIN
df138c775a exec_on_master_terminal(): reduce code redundancy a bit and use
fmem_alloc() instead of mem_alloc().
2006-01-07 01:52:35 +01:00
Laurent MONIN
b09d2c7a3f exec_on_slave_terminal(): reduce indentation level and use fmem_alloc()
instead of mem_alloc().
2006-01-07 01:49:12 +01:00