1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-25 01:05:37 +00:00
Commit Graph

418 Commits

Author SHA1 Message Date
Witold Filipczyk
ca18522eec Revert "Shorten add_chars. Do not call compare_fg_color and compare_bg_color."
This reverts commit 8132c156dd.
On download dialog cursor jumps too much
2015-09-17 21:38:35 +02:00
Witold Filipczyk
8132c156dd Shorten add_chars. Do not call compare_fg_color and compare_bg_color.
Some sites while scrolling showed "artifacts". For example twojepc.pl.
2015-09-17 21:08:15 +02:00
Kalle Olavi Niemitalo
263c1836cb Don't retry get_window_title
Call get_window_title() at most once per terminal, even if it fails.
If ELinks is configured with X11 support, get_window_title() calls
XOpenDisplay(), which can sleep if $DISPLAY does not respond.
This delay was previously incurred every time ELinks changed the
title.  Besides, if ELinks had already changed the title, setting
ditrm->orig_title = get_window_title(); did not make sense anyway.
(cherry picked from elinks-0.12 commit 5d4beadc4b)

Conflicts:
	src/terminal/kbd.c:
		get_window_title has a codepage parameter in 0.13.GIT.
2012-11-03 22:14:48 +02:00
Kalle Olavi Niemitalo
6f4c95cc7f Bug 943: Refuse user JS actions in unfocused tabs
(cherry picked from elinks-0.12 commit 51dc3beee7)

Conflicts:
	NEWS: Both 0.12pre5.GIT and 0.13.GIT had inserted a new section.
	src/terminal/window.c: Both had inserted a new function.
2012-11-03 22:10:27 +02:00
witekfl
42d2433f4b Color leading spaces with the color of the first non-space character.
Also color trailing spaces with the color of the last character.

See for example gtk-doc.
2012-07-11 11:14:03 +02:00
witekfl
36070d3277 The union of the color and the node_number in the struct screen_char.
The long term goal is good looking of the Python docs in ELinks, especially
background colors. Every start tag and every text node would have associated
a natural number. Those numbers would be "drawn" in the document instead
of colors. Finally, the screen driver would change numbers into colors.

This will be done in small steps. The next step is to implement this change
in the screen driver.
2012-03-03 11:27:58 +01:00
Miciah Dashiel Butler Masters
c74ddb29c5 SMJS: add terminal object
Add terminal_class, which defines a JSObject wrapper for struct terminal.

Add terminal_array_class, which defines a JSObject wrapper for accessing
the "terminals" linked list of struct terminal.

Add session_array_class, which defines a JSObject wrapper for accessing the
tabs (sessions) of a terminal.

Add pointers from struct terminal to the terminal_class object and
the session_array_class object.

Add terminal_props and terminal_get_property for terminal_class.

Add terminal_finalize, which clears the pointers between a struct terminal
and the JSObject wrapper in question.

Add smjs_init_terminal_interface, which creates a terminal_array_class
instance and assigns it to  the "terminal" property on the "elinks" object.
Call smjs_init_terminal_interface from smjs_init_elinks_object.

Add smjs_get_terminal_object and smjs_get_session_array_object to get
the wrapper objects for a given struct terminal, and add
smjs_get_terminal_array_object to get a terminal_array_class object.

Add smjs_detach_terminal_object and smjs_detach_session_array_object, which
clear the pointers between a given struct terminal and its JSObject
wrappers.

Add terminal_array_get_property for terminal_array_class.

Add session_array_get_property for session_array_class.
2011-11-14 04:34:51 +00:00
witekfl
ab8fa8daed Revert "redraw_terminal_cls instead of redraw_terminal in delete_window."
This reverts commit 03c698e926.
2011-07-06 13:23:30 +02:00
witekfl
03c698e926 redraw_terminal_cls instead of redraw_terminal in delete_window.
On http://pcarena.pl/ the msgbox is shown saying,
that document.getElementById is not a function.
The "ghosts" remained after pressing OK.
2011-06-17 14:33:46 +02:00
Kalle Olavi Niemitalo
d1245c73a8 Recode X11 window title when saving and restoring
gnome-terminal 2.30.2 expects UTF-8 in the "OSC Ps ; Pt BEL" sequence
that sets the window title.  However, XGetWMName typically returns the
title in "STRING" (Latin-1) or "COMPOUND_TEXT" (escape sequences)
encoding.  Recode the title to restore it correctly.  This helps
especially in the fi_FI.UTF-8 locale, where gnome-terminal has "Pääte"
as the default title.

Related to bugs 885 and 336.
2011-04-11 22:13:38 +03:00
Miciah Dashiel Butler Masters
af5e54d95f send_kbd_event: Fix accesskeys when priority = 0
With document.browse.accesskey.priority = 0, accesskeys were ignored if
the current tab was not the last (rightmost) tab.  This commit fixes the
problem.

Add a function tabs_are_on_top(struct terminal *) which returns
a Boolean value indicating whether the topmost window is a tab (as
opposed to, e.g., a menu).

This commit fixes commit 1bd498cde9.
2011-01-19 03:44:50 +00:00
Witold Filipczyk
17f82a3e21 Decode ESC color sequences in the plain renderer.
Added functions for screen_char->color -> color_T conversion.
2010-07-31 20:51:24 +02:00
Witold Filipczyk
b456fba69f Compilation fix. 2010-03-21 17:18:32 +01:00
Miciah Dashiel Butler Masters
60c50ea378 Fix a compilation error.
Fix another silly error that I introduced in commit
3334efb32c.
2009-05-22 21:54:47 +00:00
Miciah Dashiel Butler Masters
f1dee0d04f Drop special handling of ctrl-l
Drop special handling of ctrl-l in handle_interlink_event.

To make sure that the 'redraw' action works everywhere, first modify
menu_kbd_handler and mainmenu_kbd_handler to handle ACT_MENU_REDRAW; and
second, drop the ACTION_REQUIRE_VIEW_STATE flag from the 'redraw' action in
the 'main' keymap so that it works even if there is no document loaded.

Ctrl-l is already bound to 'redraw' in all keymaps by default, so the
current default behaviour is preserved.
2009-05-22 19:50:28 +00:00
Miciah Dashiel Butler Masters
3334efb32c Add support for ECMA-48 SGR italic
Add 'Italic' checkbox to Terminal options dialog box.

Enable italic text by default for rxvt-unicode (and also enable
frames, 88-colour mode, and underline).
2009-05-22 19:48:59 +00:00
Witold Filipczyk
7751102ce7 Bug 1070: Support for fbterm.
fbterm uses different 256 color sequences than xterm.
color256_seqs are part of the driver info.
2009-04-26 18:12:00 +03:00
Kalle Olavi Niemitalo
34f8f6a58f Merge branch 'elinks-0.12' into master
Conflicts:
	NEWS (merged)
	configure.in (merged)
	doc/man/man1/elinks.1.in (regenerated)
	doc/man/man5/elinks.conf.5 (regenerated)
	doc/man/man5/elinkskeys.5 (regenerated)
	po/af.po (used elinks-0.12)
	po/be.po (used elinks-0.12)
	po/bg.po (used elinks-0.12)
	po/ca.po (used elinks-0.12)
	po/cs.po (used elinks-0.12)
	po/da.po (used elinks-0.12)
	po/de.po (used elinks-0.12)
	po/el.po (used elinks-0.12)
	po/es.po (used elinks-0.12)
	po/et.po (used elinks-0.12)
	po/fi.po (used elinks-0.12)
	po/fr.po (used master)
	po/gl.po (used elinks-0.12)
	po/hr.po (used elinks-0.12)
	po/hu.po (used elinks-0.12)
	po/id.po (used elinks-0.12)
	po/is.po (used elinks-0.12)
	po/it.po (used elinks-0.12)
	po/lt.po (used elinks-0.12)
	po/nb.po (used elinks-0.12)
	po/nl.po (used elinks-0.12)
	po/pl.po (used master)
	po/pt.po (used elinks-0.12)
	po/pt_BR.po (used elinks-0.12)
	po/ro.po (used elinks-0.12)
	po/ru.po (used elinks-0.12)
	po/sk.po (used elinks-0.12)
	po/sr.po (used elinks-0.12)
	po/sv.po (used elinks-0.12)
	po/tr.po (used elinks-0.12)
	po/uk.po (used elinks-0.12)
2009-03-29 18:26:20 +03:00
Kalle Olavi Niemitalo
d7d18e4e43 bug 1047: inline functions C99 conformance
C99 6.7.4p3 and 6.7.4p6 set some constraints on what can be done in
inline functions and how they can be declared.  In particular, any
function declared inline must also be defined in the same translation
unit.  To comply with that, remove inline specifiers from function
declarations in header files when the functions are not also defined
in those header files.

Sun Studio 11 on Solaris 9 is stricter than C99 and does not allow
references to static identifiers in extern inline functions.  Make the
configure script detect this and define NONSTATIC_INLINE accordingly
in config.h.  Then use that in the definitions of all non-static
inline functions.

Document the restrictions and this scheme in doc/hacking.txt.
2009-03-28 20:15:08 +02:00
Kalle Olavi Niemitalo
d2854dca8d Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	src/bookmarks/backend/default.c
	src/bookmarks/bookmarks.c
	src/session/session.c
	src/terminal/event.c
	src/viewer/text/search.c
2009-02-08 22:02:57 +02:00
Kalle Olavi Niemitalo
30dbe6a2f8 Use get_terminal_codepage in handle_interlink_event.
This should have been in an earlier commit but I somehow missed it.

Related to bug 1064 but does not change visible behaviour yet.
2009-01-01 22:59:11 +00:00
Kalle Olavi Niemitalo
687f19dbde Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	src/bfu/dialog.c
	src/bfu/hotkey.c
	src/bfu/inpfield.c
	src/dialogs/options.c
	src/document/renderer.c
	src/intl/gettext/libintl.h
	src/protocol/http/codes.c
	src/session/task.c
	src/terminal/event.c
	src/terminal/terminal.h
	src/viewer/text/form.c
	src/viewer/text/link.c

And a semantic conflict in src/terminal/terminal.c.
2009-01-01 19:14:01 +00:00
Kalle Olavi Niemitalo
b6dfdf86a6 Bug 885: Proper charset support in xterm window title
When ELinks runs in an X11 terminal emulator (e.g. xterm), or in GNU
Screen, it tries to update the title of the window to match the title
of the current document.  To do this, ELinks sends an "OSC 1 ; Pt BEL"
sequence to the terminal.  Unfortunately, xterm expects the Pt string
to be in the ISO-8859-1 charset, making it impossible to display e.g.
Cyrillic characters.  In xterm patch #210 (2006-03-12) however, there
is a menu item and a resource that can make xterm take the Pt string
in UTF-8 instead, allowing characters from all around the world.
The downside is that ELinks apparently cannot ask xterm whether the
setting is on or off; so add a terminal._template_.latin1_title option
to ELinks and let the user edit that instead.

Complete list of changes:

- Add the terminal._template_.latin1_title option.  But do not add
  that to the terminal options window because it's already rather
  crowded there.

- In set_window_title(), take a new codepage argument.  Use it to
  decode the title into Unicode characters, and remove only actual
  control characters.  For example, CP437 has graphical characters in
  the 0x80...0x9F range, so don't remove those, even though ISO-8859-1
  has control characters in the same range.  Likewise, don't
  misinterpret single bytes of UTF-8 characters as control characters.

- In set_window_title(), do not truncate the title to the width of the
  window.  The font is likely to be different and proportional anyway.
  But do truncate before 1024 bytes, an xterm limit.

- In struct itrm, add a title_codepage member to remember which
  charset the master said it was going to use in the terminal window
  title.  Initialize title_codepage in handle_trm(), update it in
  dispatch_special() if the master sends the new request
  TERM_FN_TITLE_CODEPAGE, and use it in most set_window_title() calls;
  but not in the one that sets $TERM as the title, because that string
  was not received from the master and should consist of ASCII
  characters only.

- In set_terminal_title(), convert the caller-provided title to
  ISO-8859-1 or UTF-8 if appropriate, and report the codepage to the
  slave with the new TERM_FN_TITLE_CODEPAGE request.  The conversion
  can run out of memory, so return a success/error flag, rather than
  void.  In display_window_title(), check this result and don't update
  caches on error.

- Add a NEWS entry for all of this.
2009-01-01 16:17:03 +00:00
Kalle Olavi Niemitalo
ad45176dde Add get_terminal_codepage().
This simplifies the callers a little and may help implement
simultaneous support for different charsets on different terminals
of the same type (bug 1064).
2009-01-01 16:16:17 +00:00
Kalle Olavi Niemitalo
6c0fffb958 Merge branch 'top/0.13/witekfl-scroll-dialog' (early part) into elinks-0.13
Conflicts:
	NEWS
2008-10-15 23:31:17 +03:00
Kalle Olavi Niemitalo
84e19d0e4e bug 1054: Don't abort downloads when closing a terminal.
Except if they have external handlers.

When ELinks receives an event from a terminal, move that terminal to
the beginning of the global "terminals" list, so that the terminals
are always sorted according to the time of the most recent use.  Note,
this affects the numbering of bookmark folders in session snapshots.

Add get_default_terminal(), which returns the most recently used
terminal that is still open.  Use that in various places that
previously used terminals.prev or terminals.next.  Four functions
fetch the size of the terminal for User-Agent headers, and
get_default_terminal() is not really right, but neither was the
original code; add TODO comments in those functions.

When the user chooses "Background and Notify", associate the download
with the terminal where the dialog box is.  So any later messages will
then appear in that terminal, if it is still open.  However, don't
change the terminal if the download has an external handler.

When a download gets some data, don't immediately check the associated
terminal.  Instead, wait for the download to end.  Then, if the
terminal of the download has been closed, use get_default_terminal()
instead.  If there is no default terminal either, just skip any
message boxes.
2008-10-15 23:29:25 +03:00
Kalle Olavi Niemitalo
8010b3371b big dialogs: redraw the dialog when scrolling
Merge functions:
redraw_from_window(win) => redraw_windows(REDRAW_IN_FRONT_OF_WINDOW, win)
redraw_below_window(win) => redraw_windows(REDRAW_BEHIND_WINDOW, win)
Add REDRAW_WINDOW_AND_FRONT as a third possibility.
Then use that in update_hierbox_browser(), which previously used
window.next for this purpose, and in dialog-scrolling code,
which previously did not redraw the dialog box itself.
2008-10-12 14:01:05 +03:00
Kalle Olavi Niemitalo
4f41ce00b4 big dialogs: draw_dlg_text: no need to pass the term.
Instead, make draw_dlg_text read dlg_data->win->term.
2008-10-11 23:52:09 +03:00
Kalle Olavi Niemitalo
75302f8e62 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	NEWS
2008-10-03 10:55:11 +03:00
Kalle Olavi Niemitalo
4c2ddac289 Bug 1053: Fix crash when download ends.
ELinks attempted to display a message box on file_download.term, but
it had already closed that terminal and freed the struct terminal.  To
fix this, reset file_download.term pointers to NULL when the terminal
is about to be destroyed.  Also, assert in download_data_store() that
file_download.term is either NULL or in the global "terminals" list.

Reported by أحمد المحمودي.
(cherry picked from commit 6e2476ea4d)
2008-10-03 00:18:41 +03:00
Witold Filipczyk
ca073bf5ca big dialogs: set_curosr2 -> set_dlg_cursor. 2008-09-07 18:16:15 +02:00
Witold Filipczyk
de815bb206 big dialogs: Scrolling of big dialogs, mainly that produced by the bittorent. 2008-09-07 18:02:37 +02:00
Kalle Olavi Niemitalo
af1f475417 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	doc/man/man1/elinks.1.in
	doc/man/man5/elinks.conf.5

Resolved by regenerating the files with make update-man.
2008-06-08 20:47:36 +03:00
Paul B. Mahol
b03ddccf08 Recognize Insert key on cons25 (FreeBSD console) 2008-05-31 13:04:25 +03:00
Kalle Olavi Niemitalo
3c861fd530 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	configure.in
	src/protocol/http/http.c
2008-02-24 22:49:47 +02:00
Laurent MONIN
9ba7079735 Patch: fix for bug 938
This patch prevents  handle_itrm_stdin() and clear_handlers(itrm->in.std) to be
called when -remote is set and in.std < 0.
It adds two assertions for in.std >= 0 in handle_itrm_stdin() and
unhandle_itrm_stdin().
May be a bad fix, please test and review.

[Added a NEWS entry.  --KON]
2008-02-09 14:11:21 +02:00
Kalle Olavi Niemitalo
5499926cc0 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	po/pl.po
	src/config/conf.c
	src/terminal/kbd.c
2008-02-03 22:30:46 +02:00
Kalle Olavi Niemitalo
49ea10a74d Bug 994: Treat only termios.c_cc[VERASE] as "Backspace".
When setting the tty device to raw mode, save the VERASE character.
Later, compare incoming bytes to that.

This is somewhat complicated because "stty verase undef"
sets termios.c_cc[VERASE] = _POSIX_VDISABLE, and e.g. Linux
defines _POSIX_VDISABLE as 0 but that must not cause ELinks
to treat incoming null bytes as backspaces.  Furthermore,
some systems may use different VDISABLE values for different
terminal devices, in which case _POSIX_VDISABLE is undefined
and ELinks must instead read the value from fpathconf().
2008-02-02 13:19:55 +02:00
Kalle Olavi Niemitalo
f19c948ca7 Bug 824: Disable combining characters unless --enable-combining.
Label this as an experimental feature because it has so many bugs
and it is not clear how they can be fixed.
2008-01-19 20:58:22 +02:00
Witold Filipczyk
560818568a combined: Added the option "combine" to terminal and screen driver options.
Note that, combining characters work only on XTerm with UTF-8 locale setings.
2008-01-19 20:49:47 +02:00
Kalle Olavi Niemitalo
d79edd5954 Bug 867: More comments. 2008-01-19 18:12:18 +02:00
Kalle Olavi Niemitalo
a5bb4f1011 Bug 867: Request and recognize bracketed paste.
This is based on attachment 389 from bugzilla.elinks.cz
but there were a number of conflicts already.
2008-01-14 23:53:56 +02:00
Laurent MONIN
6c6e75a71d Trim trailing whitespaces. 2007-09-14 15:14:34 +02:00
Laurent MONIN
f0e66866f5 Trim trailing whitespaces. 2007-09-14 15:12:32 +02:00
Laurent MONIN
ee503f6c00 Prevent internal errors when terminal width or height are very small
(1x1 was fatal).
2007-09-14 11:49:03 +02:00
Jonas Fonseca
0240c469b7 Merge branch 'elinks-0.12'
Conflicts:

	src/document/dom/renderer.c
2007-09-09 18:25:49 +02:00
Kalle Olavi Niemitalo
c44739e039 Refer to bug 96 in a comment. 2007-09-03 21:02:58 +03:00
Kalle Olavi Niemitalo
a59f44c4b5 Document Unicode characters for ACS_S[1379]. 2007-09-03 21:01:49 +03:00
Miciah Dashiel Butler Masters
92abd48405 Drop EVENT_TEXTAREA, use EVENT_RESIZE instead
When returning from an external program, unblock_itrm_x in the slave process will send a resize event to the master process for the slave terminal.  In handle_interlink_event, when we receive this resize event, we can check whether we need to call textarea_edit.
2007-09-01 12:46:02 +00:00
Miciah Dashiel Butler Masters
a66f6f8c90 Make the textarea_data member of struct terminal opaque
Move the definition of struct textarea_data back to src/viewer/text/textarea.c.
2007-09-01 12:02:21 +00:00
Miciah Dashiel Butler Masters
ac230ebc08 Add free_textarea_data wrapper for done_textarea_data and use in destroy_terminal
Unexport done_textarea_data.
2007-09-01 11:58:29 +00:00
Miciah Dashiel Butler Masters
6469344727 Export done_textarea_data and call in destroy_terminal to prevent leak
Previously, if a terminal crashed with an external editor open, the struct textarea_data would never be freed
2007-09-01 09:45:56 +00:00
Miciah Dashiel Butler Masters
cc67edbe1c Drop @textarea_editor global 2007-09-01 09:10:54 +00:00
Miciah Dashiel Butler Masters
d4c262694b Move pointers to struct textarea_data from linked-list to terminal structure 2007-09-01 09:02:01 +00:00
Witold Filipczyk
7726e33b0a bug 181: Simplification. Reverted changes causing incompatibility. 2007-09-01 09:00:36 +00:00
Miciah Dashiel Butler Masters
1000f88748 bug 181: Allow edit textareas using an external editor on slave terminals.
Added EVENT_TEXTAREA used to notify the master terminal
about end of execution of an external program on a slave terminal.
The format of data sent to the master terminal by exec_on_slave_terminal
has changed. Now after 0, fg the value of term is sent.
Therfore this release of ELinks is incompatible with previous releases.

Patch by Witold Filipczyk, taken from his witekfl branch.

Conflicts:

	src/viewer/text/textarea.c
2007-09-01 09:00:33 +00:00
Miciah Dashiel Butler Masters
91947860f2 Check session- and domain-specific settings for many options
Pass the session with some get_opt_* calls.  These are the low-hanging fruit.  Some places will be difficult because we don't have the session or for other reasons.
2007-08-30 21:11:51 +00:00
Kalle Olavi Niemitalo
78f733c6c1 More doc comments about coordinates. 2007-08-29 09:57:18 +03:00
Miciah Dashiel Butler Masters
ea372bd0cd get_opt_*: Add ses parameter
Add a session parameter to get_opt_ and its wrappers in preparation for session-specific and domain-specific options.
2007-08-28 17:24:59 +00:00
Miciah Dashiel Butler Masters
3975d28bce Merge commit 'origin/elinks-0.12'
Conflicts:

	doc/Doxyfile.in
	src/protocol/bittorrent/common.h
2007-08-28 14:47:39 +00:00
Kalle Olavi Niemitalo
40afaae7d6 Doc comments about coordinate systems.
So that I may better understand Witek's patches.
2007-08-28 09:52:37 +03:00
Kalle Olavi Niemitalo
dc2cac851d itrm: Don't mention bug 776 which was already fixed. 2007-07-31 14:14:08 +03:00
Kalle Olavi Niemitalo
cc813e8541 Doxygen: minor changes in src/terminal/itrm.h 2007-07-31 14:12:28 +03:00
Kalle Olavi Niemitalo
76c6f38169 Doxygen: Begin commands with @ not \. 2007-07-31 13:47:12 +03:00
Kalle Olavi Niemitalo
21052fafb0 Doxygen: more links in terminal/screen.c 2007-07-29 13:02:02 +03:00
Kalle Olavi Niemitalo
2437d35904 Merge commit 'pasky.or.cz/elinks-0.12' into elinks-0.13
There were conflicts in src/document/css/ because 0.12.GIT switched
to LIST_OF(struct css_selector) and 0.13.GIT switched to struct
css_selector_set.  Resolved by using LIST_OF(struct css_selector)
inside struct css_selector_set.
2007-07-28 03:22:29 +03:00
Kalle Olavi Niemitalo
4231b9d8d8 Doxygen: minor fixes in handle_trm 2007-07-28 02:34:20 +03:00
Kalle Olavi Niemitalo
8cfe7e026f Doxygenate src/terminal/ 2007-07-27 18:33:33 +03:00
Kalle Olavi Niemitalo
96176a8c77 Declare element types of lists. 2007-07-26 22:47:23 +03:00
Kalle Olavi Niemitalo
d3d2bb26c5 New macro LIST_OF for better Doxygen support. 2007-07-26 22:45:51 +03:00
Kalle Olavi Niemitalo
ab9e0821d6 Merge commit 'pasky.or.cz/elinks-0.12' into elinks-0.13 2007-07-22 18:48:45 +03:00
Kalle Olavi Niemitalo
b9b0088a86 Added TODO comments about TERM_EXEC_NEWWIN. 2007-07-18 18:42:54 +03:00
Kalle Olavi Niemitalo
8097929290 Merge with #elinks-0.12 2007-07-16 00:18:17 +03:00
Kalle Olavi Niemitalo
6117f8a164 Name the exec_on_terminal() fg values. 2007-07-15 23:46:18 +03:00
Kalle Olavi Niemitalo
eccc8c23f0 Merge with http://elinks.cz/elinks.git#elinks-0.12 2007-07-09 16:03:06 +03:00
Kalle Olavi Niemitalo
f6f5eeceb7 Compare screen_driver.name with strcmp, not memcmp.
screen_driver_change_hook was comparing only strlen(name) characters
and ignoring the '\0'.  To reproduce the bug in ELinks 0.11.3 and
ELinks 0.12.GIT:

- Run TERM=screen elinks.
- In another terminal, run TERM=scr elinks.  Quit this slave ELinks.
- Open the terminal options dialog and set 16 colors.
- Open the option manager and change the terminal.scr.colors option to
  1 and back to 0.
- Note that ELinks no longer displays colors.

That bug could be fixed just by using len+1 instead of len.  However,
there is also another bug: memcmp may compare the specified number of
bytes, even if some of the earlier ones differ; thus, it could in
principle read past the end of the malloc block and thereby crash
ELinks.  Using strcmp may be a little slower but I do not believe it
could become a bottleneck.
2007-05-26 21:14:50 +03:00
Kalle Olavi Niemitalo
b904464e76 Document terminal._template_.m11_hack more and add comments. 2007-05-20 16:10:27 +03:00
Kalle Olavi Niemitalo
45d1750d03 Bug 914: Don't let UTF-8 I/O affect internal representations.
Use it for the actual I/O only.  Previously, defining CONFIG_UTF8 and
enabling UTF-8 used to force many strings to the UTF-8 charset
regardless of the terminal charset option.  Now, those strings always
follow the terminal charset.  This fixes bug 914 which was caused
because _() returned strings in the terminal charset and functions
then assumed they were in UTF-8.  This reduction in the effects of
UTF-8 I/O may also simplify future testing.
2007-05-20 15:31:02 +03:00
Kalle Olavi Niemitalo
36287949a0 Bug 914: Add terminal.utf8_cp, not yet read. 2007-05-20 13:50:47 +03:00
Kalle Olavi Niemitalo
61a901969f Bug 914: Add screen_driver_opt.utf8_cp, not yet read. 2007-05-20 13:39:02 +03:00
Kalle Olavi Niemitalo
103ece2127 UTF-8, add_char_data: data can be UCS_NO_CHAR after all. 2007-05-20 10:54:02 +03:00
Kalle Olavi Niemitalo
7b701a5268 Whitespace and comments. 2007-05-19 23:45:38 +03:00
Kalle Olavi Niemitalo
2ef4c9776b UTF-8, set_screen_driver_opt: Never use frame_seqs with UTF-8 I/O. 2007-05-19 23:40:38 +03:00
Kalle Olavi Niemitalo
094096bfdc UTF-8: frame_freebsd isn't in CP437 so use a separate table for UTF-8 I/O. 2007-05-19 23:37:34 +03:00
Kalle Olavi Niemitalo
9f9ed498dd UTF-8: Comment about frame_freebsd[]. 2007-05-19 23:32:36 +03:00
Kalle Olavi Niemitalo
ff5fb6b707 UTF-8: Use frame_vt100_u even #ifdef CONFIG_UTF8.
Should perhaps have been part of the previous commit.
2007-05-19 23:26:10 +03:00
Kalle Olavi Niemitalo
1fbdc0fe37 UTF-8: Make UTF-8 I/O affect frame characters even #ifdef CONFIG_UTF8. 2007-05-19 14:50:22 +03:00
Kalle Olavi Niemitalo
5b3ec40a3b UTF-8, add_char_data: Comment about UCS_NO_CHAR. 2007-05-19 14:49:39 +03:00
Kalle Olavi Niemitalo
84b7bc3db7 UTF-8: Remove screen_driver_opt.utf8, which is no longer used. 2007-05-19 14:49:19 +03:00
Kalle Olavi Niemitalo
fc8f0f1623 UTF-8, use_utf8_io: Test driver->opt.charsets[0] even #ifdef CONFIG_UTF8.
driver->opt.utf8 is no longer read and will soon be removed.
2007-05-19 14:48:59 +03:00
Kalle Olavi Niemitalo
1eaab825c7 UTF-8: Define and set screen_driver_opt.charsets even #ifdef CONFIG_UTF8.
However, the stored values are not yet read in this commit.
2007-05-19 14:48:30 +03:00
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
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