1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-13 00:38:32 -04:00
Commit Graph

1674 Commits

Author SHA1 Message Date
Kalle Olavi Niemitalo
356678dd80 Bug 846: Document the JSClass assumed in each JS_{Set,Get}Private call. 2006-11-25 14:52:58 +02:00
Kalle Olavi Niemitalo
36f5f73a60 Bug 846: Document the expected parents of SMJS class instances. 2006-11-25 14:42:20 +02:00
Kalle Olavi Niemitalo
670ad939c3 Bug 846: Comments on the relations between JSClasses and functions. 2006-11-25 13:36:28 +02:00
Kalle Olavi Niemitalo
d6ea143f36 Bug 846: Document the private data in each SMJS class. 2006-11-25 13:19:35 +02:00
Petr Baudis
eab3cb762f ECMAScript: Fix a leak in case of setTimeout(..., 0)
identified by Jonas seconds after I pushed the original fix out. *blush*
2006-11-23 01:24:56 +01:00
Petr Baudis
a0bc4f7792 Merge with /srv/git/elinks.git 2006-11-23 01:18:06 +01:00
Petr Baudis
e66b6737db ECMAScript: Fix crash on setTimeout(..., 0) 2006-11-21 08:01:36 +01:00
Kalle Olavi Niemitalo
f915c31127 Bug 841, CVE-2006-5925: Prevent enabling the SMB protocol.
src/protocol/smb/smb.c: Added #error directives so that this
vulnerable code cannot be accidentally compiled in.

features.conf: Disable CONFIG_SMB by default and explain why.

configure.in: If CONFIG_SMB is enabled, disable it and warn the user.
This is for people who have customized features.conf.
2006-11-18 20:39:01 +02:00
Miciah Dashiel Butler Masters
a90588debc Fix a grammatical error in the description for document.uri_passing
Suggested by Quiznos on IRC.
2006-11-15 20:08:02 +00:00
Kalle Olavi Niemitalo
24dbdbe899 Bug 830: Check -remote command names more strictly.
doc/remote.txt says there must be a nonempty sequence of ASCII
alphabetic characters before the opening parenthesis.  Check that
they really are ASCII characters and that the sequence is nonempty.
Thus, elinks -remote '(foo)' now treats the string as an address,
rather than as a command.
2006-11-14 00:22:06 +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
Jonas Fonseca
89fd7efa3a Fix misparsing of -remote URLs containing parenthesis (bug 830)
Be more strict about the format accepted by the ELinks specific extension
to the -remote URL syntax. That is, commands must begin with a nonempty
sequence of ASCII alphabetic characters followed by optional whitespace and
an opening parenthesis. Also, document the syntax.

Fixes bug 830.
2006-11-12 18:49:05 +01:00
Kalle Olavi Niemitalo
cb02b46154 Bug 153: Refer to the bug from the docstring of bookmarks.file_format.
When I first read the warning about "NO NATIONAL CHARS SUPPORT!"
I was amazed: XML is based on Unicode, so why would the authors of the
XBEL specification have botched support for those characters?  The bug
is actually in the ELinks implementation of XBEL, and it has already
been entered in the ELinks bugzilla.  Make the documentation string
refer to that.
2006-11-12 18:47:07 +02:00
Kalle Olavi Niemitalo
7809efa1b5 Names of enum constants should be in upper case.
Requested by Miciah.
2006-11-12 14:51:18 +02:00
Kalle Olavi Niemitalo
40b6edc69d u2cp_: Make the no_nbsp_hack parameter an enum.
This is from attachment 279 of bug 811.  The change does not yet
affect any visible behaviour.
2006-11-12 14:29:09 +02:00
Kalle Olavi Niemitalo
c283b128b6 Bug 387: Treat &#013; inside <pre>...</pre> as a newline.
Recognize all of &#13; &#10; &#xA; &#xD; with any number of leading
zeroes.  (Previously only &#13; and &#x0A; were supported.)  All of
these are case insensitive.

Treat each CR+LF combination (&#13;&#10;) as a single newline.
2006-11-11 20:31:25 +02:00
Kalle Olavi Niemitalo
18f30e7886 decompress_data: Always initialize to_read, avoiding a GCC warning.
"'to_read' may be used uninitialized in this function" was a false warning
but removing it will make important warnings easier to see.
2006-11-11 14:12:39 +02:00
Miciah Dashiel Butler Masters
810a1fc591 data_compress: fix problem with decompression after recent change
Fix bug 834 (various gzip-encoded documents were being truncated),
which I introduced with commit e441361f2c.

Thanks to Witek for reporting the bug, Kalle for determining the
problematic commit, and Jonas for letting me know about the bug report(!).
2006-11-10 15:57:23 +00:00
Jonas Fonseca
f9d3824c65 Make get_fragment_content_type static 2006-11-06 18:09:11 +01:00
Laurent MONIN
cceb7b9be8 Add a missing parenthesis in option description. 2006-11-06 16:59:13 +01:00
Jonas Fonseca
b61d8d06d9 Fix crashes with various bogus BitTorrent URLs
... mainly bittorrent:// and bittorrent://x

The BitTorrent URL is supposed to contain an embedded URL pointing to a
metainfo file. If this is not the case a "custom" error message will be
shown. Also fixes calling of free_list() on an uninitialized list.

Closes bug 729.
2006-11-06 16:24:07 +01:00
Laurent MONIN
7585eedd2e Compilation fix: _GNU_SOURCE has to be defined on GNU platforms to get
strcasestr().
2006-11-06 15:27:54 +01:00
Jonas Fonseca
f33d9b004d Fix handling of links using file://localhost/
A simple "update" of Hugo Haas' patch posted for bug 107. This of course
also affects the (undocumented?) feature of file:// refering to the local
directory in that directories named "localhost" can no longer be displayed
using file://localhost. Nobody should do that anyway.
2006-11-06 05:43:48 +01:00
Jonas Fonseca
0ac97979a2 Fix warning from last patch 2006-11-06 05:35:57 +01:00
Jonas Fonseca
3ea73da7df Add support for more graceful detection of HTML content
It will grab at the first fragment of the cache entry and try to detect the
content-type by looking for valid HTML. It is very stupid for now, simply
searching for "<html>", which may be bogus in certain circumstances. And I
am not sure if this is better left out and up to the scripting backends,
e.g. SMJS can now modify the cache entry.

A feable fix for bug 396.
2006-11-06 05:15:50 +01:00
Jonas Fonseca
58c83a9f48 Never show empty filename in the what-to-do dialog
This fixes the last comment of bug 396.
2006-11-06 04:55:26 +01:00
Petr Baudis
6390c327aa Turn terminal transparency off by default
The problem is that if you run elinks in xterm with the default white
background, it will be totally unreadable if transparency is turned
on. We should default to usability in all common environments, eyecandy
lovers can do the extra setup for their specific one.

It also makes the description note that elinks still assumes the
background is black.
2006-11-05 16:28:53 +01:00
Miciah Dashiel Butler Masters
78946fd723 Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2006-11-05 05:34:12 +00:00
Rich Felker
d2b8e06f41 gzip_read: always call gzclearerr
This is necessary when using a POSIX-compliant stdio implementation, which
will set the FILE error flag when input from the pipe is exhausted, causing
all subsequent reads to fail.
2006-11-05 04:53:42 +00:00
Miciah Dashiel Butler Masters
dfbbde1952 decompress_data: move a comment
This should have been done in commit e441361f2c.
2006-11-05 04:24:48 +00:00
Miciah Dashiel Butler Masters
6f8f41e20d decompress_data: change initial malloc size, drop init variable
Adjust the size of to_read for the initial read instead of setting the init
flag and using that later to check whether to read a smaller amount than
the value in to_read. This also affects the realloc call on the initial
read, which was allocating more memory than necessary (altho this
discrepency would be corrected with the realloc for the next read).
2006-11-05 04:21:52 +00:00
Miciah Dashiel Butler Masters
e441361f2c decompress_data: make the current state more explicit
Introduce and use the local variable state instead of determining the
current state from to_read. Localise to_read to the loop.
2006-11-05 03:42:16 +00:00
Miciah Dashiel Butler Masters
157b08609f decompress_data: remove some unnecessary code 2006-11-05 03:17:30 +00:00
Petr Baudis
8ecf87b7b7 setTimeout: Fix da assert
Yeah, Miciah, I'm an idiot, don't walk around the fact.
2006-11-05 01:13:29 +01:00
Petr Baudis
da5ec748b6 setTimeout: kill previous timer when planting a new one
Otherwise if the page installs multiple timers the old one would live
on unreferenced and possibly (likely) trigger after the document's death
and everything would go to hell.
2006-11-05 00:53:04 +01:00
Petr Baudis
74997f772c setTimeout: A more sensibel assert 2006-11-05 00:35:04 +01:00
Petr Baudis
a1866332d3 Merge with /srv/git/elinks.git 2006-11-04 13:20:36 +01:00
Petr Baudis
a3a85ef453 setTimeout: Second try to fix timer crashes 2006-11-04 13:20:29 +01:00
Jonas Fonseca
180c8befac Fix linker warning on Mac OS X by prefixing locale_charset with "elinks_"
/usr/bin/ld: warning multiple definitions of symbol _locale_charset
lib.o definition of _locale_charset in section (__TEXT,__text)
/usr/lib/libiconv.dylib(localcharset.o) definition of _locale_charset
2006-11-04 08:46:45 +01:00
Kalle Olavi Niemitalo
eb2c64633c Revert c9ce4260e5 (broke URLs as -remote arguments)
Revert commit c9ce4260e5,
which made "elinks -remote http://elinks.cz/" fail with an error
"ELinks: Cannot parse option -remote: Remote method not supported"
even though doc/remote.txt says it should open the URL in a new tab.
2006-11-04 05:06:50 +02:00
Miciah Dashiel Butler Masters
a001cfda17 Rewrite the description for document.cache.revalidation_interval again 2006-11-04 02:23:22 +00:00
Petr Baudis
cd197170d7 Fix wrongly placed -1 ;-) 2006-11-03 20:19:43 +01:00
Petr Baudis
847feea09e setTimeout: Kill timer when it timed out, fixes random crashes 2006-11-03 20:18:31 +01:00
Petr Baudis
c7863324e0 Support for document.cache.interval (set it to -1) and rename it
...to document.cache.revalidation_interval. Moreover, -1 is the default
now.
2006-11-03 19:56:55 +01:00
Petr Baudis
5af21a8d29 Fix perl pre_format_html hook wrt. binary files
When trying to view a binary file, this hook would cut it at the first
'\0'.
2006-11-03 19:22:58 +01:00
Petr Baudis
b8d8d27df4 Fix spurious gcc warning 2006-11-03 19:22:14 +01: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
Miciah Dashiel Butler Masters
061e3aeab5 Eliminate one more unnecessary recomputation in the plaintext parser 2006-11-01 06:38:31 +00:00
Miciah Dashiel Butler Masters
2430de30f4 Eliminate some unnecessary recomputation in the plaintext parser 2006-11-01 01:35:47 +00:00
Miciah Dashiel Butler Masters
d0d03d37bb Fix overflow in the plaintext parser
Remove a bogus cell++ that was added in commit
161ccf9eae. This fixes an overflow when
loading binary files, which was making pasky sad.
2006-11-01 01:19:50 +00: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
Witold Filipczyk
d2006fd3dd Always terminate ELinks when using -remote.
The side effect: ELinks doesn't clear screen with -remote 'openURL(...)'.
2006-10-27 18:59:36 +02:00
Miciah Dashiel Butler Masters
6a53f92179 SMJS (doc): Don't signal an error when assigning to window.status 2006-10-26 20:30:26 +00:00
Witold Filipczyk
c9ce4260e5 elinks -remote 'ping' says:
ELinks: No remote session to connect to.
but should say:
ELinks: No running ELinks found.
2006-10-26 21:01:01 +02:00
Witold Filipczyk
4bf3e2693b "If-Modified-Since" second approach.
Added document.cache.interval option. When time elapsed since previous access
to the document is less than interval then the document is taken from
the cache. Otherwise the request with filled "If-Modified-Since" and/or
"If-None-Match" header field is sent. By default interval is set to 10 minutes.
This requires the correct time to be set on your machine.
2006-10-26 11:53:30 +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
Witold Filipczyk
f4e66f1fc6 ECMAScript: added writeonly property window.status 2006-10-24 20:41:25 +02:00
Witold Filipczyk
6e08e1bf5d ECMAScript: Probably superfluous kill_timer. Removed unused include. 2006-10-24 19:10:10 +02:00
Witold Filipczyk
2fe0623298 Moved the setTimeout timer to the struct document. 2006-10-24 16:47:41 +02:00
Witold Filipczyk
c76ce39a87 SpiderMonkey: added setTimeout. 2006-10-24 15:52:44 +02:00
Witold Filipczyk
e5e6727e81 SEE: setTimeout is a window object method. 2006-10-24 15:33:14 +02:00
Witold Filipczyk
5521ab2910 Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2006-10-23 23:10:05 +02:00
Witold Filipczyk
cc4d02b0ae SEE: Added setTimeout function. 2006-10-23 22:45:55 +02:00
Kalle Olavi Niemitalo
4076759890 Bug 821: With CONFIG_UTF8 and UTF-8 I/O, form_state.value is in UTF-8.
That is even if the document and the terminal have some other charset.
2006-10-23 23:01:47 +03:00
M. Levinson
50b6a61f31 Another fix for Python backend. 2006-10-22 18:45:45 +02:00
Witold Filipczyk
ac1913ff85 Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2006-10-22 18:36:42 +02:00
Kalle Olavi Niemitalo
2fd8538a72 Bug 821: kbd_field: CONFIG_UTF8 does not mean widget_data->cdata is UTF-8.
The current rules are:

             term.utf8
CONFIG_UTF8  UTF-8 I/O  widget_data.cdata
-----------  ---------  ------------------
undefined    disabled   charset of the terminal
undefined    enabled    charset of the terminal
defined      disabled   charset of the terminal (*)
defined      enabled    always UTF-8

(*) kbd_field was incorrectly assuming UTF-8 in this case.
2006-10-22 17:18:26 +03:00
Kalle Olavi Niemitalo
d050cb67aa Revert the use of wcwidth() and describe why.
This reverts the following commits:
- 86ed79deaf
  Use wcwidth if available and applicable.
- 304f5fa1ea
  comment fix (__STDC_ISO_10646__, not __STDC_ISO_10646)
- part of 71eebf1cc7
  Compensate for glibc not defining wcwidth() when _XOPEN_SOURCE is not set
And adds a lengthy comment about LC_CTYPE problems.
2006-10-22 00:05:37 +03:00
Witold Filipczyk
c87186e156 Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2006-10-21 13:55:45 +02:00
Miciah Dashiel Butler Masters
f7fba1b8e4 Use DNS_ERROR instead of -1 where appropriate 2006-10-20 23:10:36 +00:00
Miciah Dashiel Butler Masters
3041ef5ff1 Use foreachbacksafe in shrink_format_cache
I hope that it isn't too confusing to re-use the local variable next
with foreachbacksafe.
2006-10-20 23:10:35 +00:00
Miciah Dashiel Butler Masters
28261fcfba check_dialog: compare return value from widget handlers explicitly
Explicitly compare the value that is returned by the widget handler
against EVENT_NOT_PROCESSED rather than relying on the fact that
EVENT_NOT_PROCESSED is equal to 1.
ffeedbdc5045a6a5db2bc75ecaab56bfe46c80ea
2006-10-20 23:10:35 +00: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
Miciah Dashiel Butler Masters
8957379319 tree_dup: call object_nolock on the cloned children of the new tree 2006-10-20 23:10:33 +00:00
Witold Filipczyk
68913c8c7d Oh, sorry. I forgot about these. 2006-10-19 16:20:26 +02:00
M. Levinson
ebadc9bf9e Additional functionality for Python backend. 2006-10-19 15:21:39 +02: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
Laurent MONIN
3e5b4b7adf Fix whitespace goof reported by Miciah on IRC, introduced in
947c1730a6.
2006-10-13 15:08:52 +02:00
Petr Baudis
9c8fff1100 Merge with /srv/git/elinks.git 2006-10-12 23:44:12 +02:00
Petr Baudis
71eebf1cc7 Compensate for glibc not defining wcwidth() when _XOPEN_SOURCE is not set 2006-10-12 23:43:49 +02:00
Witold Filipczyk
8d6a73646b Commented code related to "If-Modified-Since" (infinite loop). 2006-10-12 14:07:58 +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
Petr Baudis
647db326fb Merge with /srv/git/elinks.git 2006-10-12 11:11:05 +02:00
Petr Baudis
f06aed0d8f More verbose assert messages for invalid h1/h2 in POST buffer 2006-10-12 11:10:41 +02:00
Laurent MONIN
49c5299f89 Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2006-10-12 09:32:44 +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
947c1730a6 Fix crash due to untested null pointer occuring when doing
HTTP_PROXY=8080:proxy.ucv.cl elinks http://wwww.google.cl. Thanks to
Karel Zak.
2006-10-11 14:44:39 +02:00
Laurent MONIN
09991b59f1 Partial Afrikaans translation was added. Thanks to Friedel Wolff. 2006-10-11 14:39:04 +02:00
Witold Filipczyk
cc6c59d932 Handling If-Modified-Since. 2006-10-08 16:24:47 +02:00
Miciah Dashiel Butler Masters
7f0fb0440c Secure file saving: restore umask after _all_ failure conditions
The secure file saving code plays some shenanigans with the umask.
Previously, the code could fail to restore the old umask when certain libc
calls failed: malloc, mkstemp, fdopen, and fopen. This resulted in
unrelated code creating files with the wrong umode. Specifically, the
download code's automatic directory creation was creating directories
without the execute permission bit.

Thanks to Quiznos for reporting and helping to track the problem down.
2006-10-01 14:57:47 +00:00
Witold Filipczyk
461787013b Revert commit 7cb91c3213. Doble glyphs should
be displayed correctly.
2006-10-01 16:08:52 +02:00
Laurent MONIN
e86e1d0fa3 Trim some trailing whitespaces. 2006-09-29 00:07:54 +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
Witold Filipczyk
86bc6a534b Should be visible not location. 2006-09-26 19:40:59 +02:00
Kalle Olavi Niemitalo
c33d195ff4 Garbage-collect SMJS objects before flushing caches. 2006-09-25 23:43:32 +03:00
Kalle Olavi Niemitalo
304f5fa1ea comment fix (__STDC_ISO_10646__, not __STDC_ISO_10646) 2006-09-25 22:24:56 +03:00
Kalle Olavi Niemitalo
86ed79deaf Use wcwidth if available and applicable.
(If wchar_t is not Unicode, then it is not applicable.)
2006-09-24 23:56:12 +03:00
Kalle Olavi Niemitalo
4a5af7fd26 Bug 381: Store codepage-to-Unicode mappings as dense arrays.
Previously, each mapping between a codepage byte and a Unicode
character was stored as a struct table_entry, which listed both the
byte and the character.  This representation may be optimal for sparse
mappings, but codepages map almost every possible byte to a character,
so it is more efficient to just have an array that lists the Unicode
character corresponding to each byte from 0x80 to 0xFF.  The bytes are
not stored but rather implied by the array index.  The tcvn5712 and
viscii codepages have a total of four mappings that do not fit in the
arrays, so we still use struct table_entry for those.

This change also makes cp2u() operate in O(1) time and may speed up
other functions as well.

The "sed | while read" concoction in Unicode/gen-cp looks rather
unhealthy.  It would probably be faster and more readable if rewritten
in Perl, but IMO that goes for the previous version as well, so I
suppose whoever wrote it had a reason not to use Perl here.

Before:

   text	   data	    bss	    dec	    hex	filename
  38948	  28528	   3311	  70787	  11483	src/intl/charsets.o
 500096	  85568	  82112	 667776	  a3080	src/elinks

After:

   text	   data	    bss	    dec	    hex	filename
  31558	  28528	   3311	  63397	   f7a5	src/intl/charsets.o
 492878	  85568	  82112	 660558	  a144e	src/elinks

So the text section shrank by 7390 bytes.

Measured on i686-pc-linux-gnu with: --disable-xbel --disable-nls
--disable-cookies --disable-formhist --disable-globhist
--disable-mailcap --disable-mimetypes --disable-smb --disable-mouse
--disable-sysmouse --disable-leds --disable-marks --disable-css
--enable-small --enable-utf-8 --without-gpm --without-bzlib
--without-idn --without-spidermonkey --without-lua --without-gnutls
--without-openssl CFLAGS="-Os -ggdb -Wall"
2006-09-24 16:55:29 +03:00
Kalle Olavi Niemitalo
0e88f8ba28 Bug 381: New macro is_cp_ptr_utf8(cp_ptr).
This does not significantly change the generated code but should make
the next commit more readable.
2006-09-24 13:33:58 +03:00
Kalle Olavi Niemitalo
e1fee49fb7 Bug 381: Halve sizeof(struct table_entry).
Before:

   text	   data	    bss	    dec	    hex	filename
  54920	  28528	   3311	  86759	  152e7	src/intl/charsets.o
 516064	  85568	  82112	 683744	  a6ee0	src/elinks

After:

   text	   data	    bss	    dec	    hex	filename
  38958	  28528	   3311	  70797	  1148d	src/intl/charsets.o
 500112	  85568	  82112	 667792	  a3090	src/elinks

So the text section shrank by 15962 bytes.

Measured on i686-pc-linux-gnu with: --disable-xbel --disable-nls
--disable-cookies --disable-formhist --disable-globhist
--disable-mailcap --disable-mimetypes --disable-smb --disable-mouse
--disable-sysmouse --disable-leds --disable-marks --disable-css
--enable-small --enable-utf-8 --without-gpm --without-bzlib
--without-idn --without-spidermonkey --without-lua --without-gnutls
--without-openssl CFLAGS="-Os -ggdb -Wall"
2006-09-24 12:47:00 +03:00
Kalle Olavi Niemitalo
62d6db44aa Bug 381: Make codepage data const.
Before:

   text	   data	    bss	    dec	    hex	filename
  25726	  62992	   3343	  92061	  1679d	src/intl/charsets.o
 653856	 120020	  82144	 856020	  d0fd4	src/elinks

After:

   text	   data	    bss	    dec	    hex	filename
  60190	  28528	   3311	  92029	  1677d	src/intl/charsets.o
 688320	  85556	  82112	 855988	  d0fb4	src/elinks

So 34464 bytes were moved from the data section to the text section
and should be more likely to get shared between ELinks processes.

Measured on i686-pc-linux-gnu with: --disable-xbel --disable-nls
--disable-cookies --disable-formhist --disable-globhist
--disable-mailcap --disable-mimetypes --disable-smb --disable-mouse
--disable-sysmouse --disable-leds --disable-marks --disable-css
--enable-small --enable-utf-8 --without-gpm --without-bzlib
--without-idn --without-spidermonkey --without-lua --without-gnutls
--without-openssl CFLAGS="-O2 -ggdb -Wall"
2006-09-24 11:59:23 +03:00
Kalle Olavi Niemitalo
359b131c6b Bug 810: Add a few comments pointing to the bug. 2006-09-24 00:21:03 +03:00
Kalle Olavi Niemitalo
677e5c7adc Callers of cp_to_unicode() assert that it didn't return UCS_NO_CHAR.
UCS_NO_CHAR here means the input was too short.  Because the strings
generally come from the source code or from PO files, they should not
end in the middle of a character.  However, the whole character may be
missing if the string is empty.  So select_button_by_key() now checks
for that case separately.

UCS_NO_CHAR must not be passed to unicode_fold_label_case() because
the result is undefined.
2006-09-17 19:54:37 +03:00
Kalle Olavi Niemitalo
9c94a896b7 Internally rename the utf_8 codepage to utf8. 2006-09-17 16:23:17 +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
Kalle Olavi Niemitalo
07cee4edee sig_tstp: Use _exit() rather than exit(). 2006-09-10 23:38:02 +03:00
Kalle Olavi Niemitalo
d1fb65120d "Resize terminal" tries to use the window size increment.
Previously, the window sizes computed for xterm were a few pixels off,
and this could result in too few character cells being displayed.
This new version tries to read the window size increment from the
WM_NORMAL_HINTS property set by xterm, and base the computations on
that.
2006-09-09 22:47:48 +03:00
Witold Filipczyk
c961564d0b SEE: use keystr as return value. Killed warning. 2006-09-03 13:21:23 +02:00
Kalle Olavi Niemitalo
a01be8bd6b UTF-8: Stepping functions set *count even if an assertion fails.
Previously, utf8_step_forward() and utf8_step_backward() left *count
unchanged if some parameter was invalid.  Now, they properly store 0.
This flaw had no effect in practice, because all current callers pass
count=NULL, and invalid parameters shouldn't be used anyway.
2006-09-03 03:08:56 +03:00
Kalle Olavi Niemitalo
86c9cb01ba add_accesskey_to_string: Add the Alt modifier to the string, too.
The link information window will now display e.g. "(Alt-f)" rather
than just "(f)", becoming easier to understand.
2006-09-03 00:12:34 +03:00
Kalle Olavi Niemitalo
cc6939b9f8 UTF-8: Don't update form_state.state_cell if it is not used.
FC_TEXT, FC_PASSWORD, and FC_FILE do not use state_cell.
FC_TEXTAREA does use it.
2006-09-02 23:16:32 +03:00
Kalle Olavi Niemitalo
8d77387f6f UTF-8: Fix scrolling of input fields.
form_state.state_cell is no longer used for FC_TEXT, FC_PASSWORD, nor FC_FILE.
Instead, get_link_cursor_offset() computes the cell with utf8_ptr2chars
(a new function) or utf8_ptr2cells.  This shouldn't slow down ELinks too
much, as it's done only for the selected link and only once per redraw.

The left side of a scrolled input field is always aligned at a
character boundary.  The right side might not be.
2006-09-02 23:03:45 +03:00
Kalle Olavi Niemitalo
92845d0b56 UTF-8: Reformat get_link_cursor_offset() a little. 2006-09-02 21:48:30 +03:00
Kalle Olavi Niemitalo
e2685ae7b2 New function colspan_is_in_box() 2006-09-02 21:48:19 +03:00
Kalle Olavi Niemitalo
216495188a UTF-8: New functions for stepping forward and backward in a string. 2006-09-02 21:48:03 +03:00
Kalle Olavi Niemitalo
a8c573a174 viewer: Document some members of struct form_state.
The new comments describe how the members were apparently intended to
be used.  However, the implementation does not actually work when
CONFIG_UTF_8 is defined, and the current semantics do not even allow
an efficient implementation of long (mostly scrolled out) strings.
2006-09-02 21:17:05 +03:00
Kalle Olavi Niemitalo
2d19e5ed94 Change elinks.or.cz to elinks.cz and one i.e. to e.g. in option docs.
Some other instances of elinks.or.cz still remain in the tree.
2006-09-02 17:50:53 +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
8850d85998 ECMAScript: If accessKey is a surrogate, throw an error when reading it.
Surrogates are now treated the same way as out-of-range characters
like U+110000; if a link has such an access key, then the ECMAScript
accessKey property cannot be read.  It seems currently impossible to
set such an access key though, because accesskey_string_to_unicode()
doesn't support multibyte characters yet.
2006-08-27 11:45:11 +03: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
9597d403ee True color mode dumps. TODO: UTF-8 2006-08-26 20:04:09 +02:00
Witold Filipczyk
9d4b68a26b Adjusted max values for true color dumps. 2006-08-26 20:03:30 +02:00
Witold Filipczyk
7a84967453 Unification. Removed trailing '\n' from last line. 2006-08-26 19:34:14 +02: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
Kalle Olavi Niemitalo
38fe5b72f7 Define and use macros for handling UTF-16 surrogates. 2006-08-24 23:30:41 +03:00
Jonas Fonseca
b9d66bd9bd Fix compilation on Minix3
- Include arpa/inet.h to get hton* ntoh* functions.
 - Use socklen_t instead of int.
 - Try to define PF_INET to AF_INET if it doesn't exist.

Reported-by: Andy Tanenbaum <ast@cs.vu.nl>
2006-08-22 22:18:00 +02: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
Kalle Olavi Niemitalo
2d898272c1 ECMAScript: Preserve all of Unicode when setting the accessKey property.
Well, almost all.  U+0000 cannot be used because ELinks thinks that
means the link has no access key.
2006-08-20 17:40:27 +03:00
Kalle Olavi Niemitalo
45b194d1e7 ECMAScript: Fix previous careless SEE changes. 2006-08-20 17:36:06 +03: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
Kalle Olavi Niemitalo
00a5b88371 ECMAScript: Preserve all of Unicode when reading the accessKey property.
Setting the property does not yet support Unicode.
2006-08-20 13:37:03 +03:00
Kalle Olavi Niemitalo
245c8cb020 parse_keystroke: Fold the case of Ctrl-letter after read_key(), not before. 2006-08-20 13:07:57 +03:00
Kalle Olavi Niemitalo
35290f92e9 parse_keystroke: Fold the case of Ctrl-letter only if the letter is ASCII. 2006-08-20 13:05:47 +03:00
Kalle Olavi Niemitalo
e054a15960 Change the description of the connection.try_ipv4 option.
Use "e.g." rather than "i.e." because the syntax cannot be deduced
from the preceding text.
2006-08-20 13:04:00 +03: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
Kalle Olavi Niemitalo
dd22535b8c config: Change an error message in the keybinding manager.
The message appears when the user has selected e.g. "Main mapping"
rather than an action inside it.  Because the main mapping is a keymap,
ELinks must not tell the user to select a keymap.
2006-08-19 10:40:30 +03:00
Witold Filipczyk
8615cb529e Added output parameter to the get_filesize_from_RETR. It indicates
whether we ought to add the conn->progress->start to
the conn->est_length. Currently displaying resuming works correctly with
ftp.task.gda.pl and ftp.pld-linux.org.
2006-08-19 09:11:53 +02:00
Witold Filipczyk
77470526ba vsftpd shows total filesize, so I commented out addition.
I know that this is not correct for every server.
Show me ftp sites, where resuming displays wrong filesize.
2006-08-19 00:06:04 +02:00
Miciah Dashiel Butler Masters
e53b7416d6 Fix -dump with charsets other than UTF-8
Restring the spaghetti in dump_to_file to fix a bug that was introduced
in commit 2a6125e3d0 whereby when
document.dump.codepage != "utf-8", the document itself was not output,
only the references list.
2006-08-17 05:16:08 +00: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
Miciah Dashiel Butler Masters
0cca8d4af0 Call set_screen_dirty in draw_link
I dropped this in c91c763d49, but it seems
necessary to fix some drawing artefacts exhibited with a local patch.
2006-08-14 07:59:10 +00:00
Jonas Fonseca
8a8fc52eec cp_to_unicode: Simplify and cleanup 2006-08-14 02:19:44 +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
6773c8505d BFU UTF-8: check_hotkeys_common() compares hotkeys as Unicode. 2006-08-13 23:45:41 +03:00
Kalle Olavi Niemitalo
85d4c5679c UTF-8 doc: unicode_fold_label_case() may be called for any Unicode character.
It cannot be restricted just to characters that have passed
check_kbd_label_key(), because hotkeys in strings received from
gettext must also be processed with it, and there we don't have
a struct term_event for check_kbd_label_key().
2006-08-13 23:41:48 +03:00
Kalle Olavi Niemitalo
b6447ae26b UTF-8: New function cp_to_unicode(). 2006-08-13 23:35:50 +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
4d80fe6453 BFU UTF-8: select_button_by_key() folds the case of Unicode characters.
This causes the documented-slow cp2u() to be called in a loop, which
fortunately doesn't have very many iterations.  If this is too slow,
then cp2u() can be rewritten, or the hotkeys can be cached in struct
widget or struct widget_data.

Note that check_kbd_label_key() does not yet allow non-ASCII
characters when CONFIG_UTF_8 is defined.  Before they are allowed,
menu.c should also be updated.
2006-08-13 20:30:19 +03: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
Jonas Fonseca
abc66da432 really_add_keybinding: Indent msg_text arguments 2006-08-13 14:50:45 +02:00
Jonas Fonseca
98e8ba781f Merge with http://www.iki.fi/kon/2006/elinks.git#ctrl-alt 2006-08-13 14:47:46 +02:00
Kalle Olavi Niemitalo
1837a55444 really_add_keybinding: Remove unneeded initialization.
According to Jonas Fonseca, if init_string(&canonical) fails, then it
anyway sets canonical.source = NULL and makes done_string(&canonical)
safe, even if canonical was previously uninitialized.
2006-08-13 15:45:13 +03:00
Kalle Olavi Niemitalo
c79ecefe73 doc: Document parse_keystroke(). 2006-08-13 15:41:34 +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
2eeb14f95c Key name strings are const in read_key() and in its (indirect) callers. 2006-08-13 14:44:01 +03:00
Jonas Fonseca
edeb934cc3 try_mark_key: try to improve readability by using a local var and a cast
The cast is not necessary since we already check the bounds, but by using a
cast here, it hopefully makes it more obvious what the long comment above
is pointing out: namely that we put the value of a signed integer into an
unsigned char.
2006-08-13 13:27:16 +02:00
Kalle Olavi Niemitalo
aba0bc77a8 parse_keystroke: Never write back to the input string.
This fixes a bug: in the previous version, l_bind_key() modified the
buffer whose address lua_tostring() returned, even though that is not
allowed according to Lua documentation <http://www.lua.org/pil/24.2.2.html>.

The change affects the user interface: previously, if the user typed
"ctrl+cokebottle" in the "Add keybinding" dialog box, ELinks would
change the text in the widget to "Ctrl-cokebottle" before complaining
that the keystroke is invalid.  Now, it leaves the widget unchanged.

This commit does not yet add const to parameters of parse_keystroke()
and related functions.
2006-08-13 14:24:28 +03:00
Jonas Fonseca
f24fa6ef63 search_dlg_do: Minor (questionable) cleanup 2006-08-13 13:20:32 +02:00
Kalle Olavi Niemitalo
93ef5e02f5 really_add_keybinding: Display the canonical name of the keystroke.
Before really_add_keybinding() is called, check_keystroke() calls
parse_keystroke(), which converts the modifier prefix to canonical
form: for example, "alt+f9" becomes "Alt-f9".  This commit makes
really_add_keybinding() normally ignore that string and generate a
brand new one, e.g. "Alt-F9" (note the upper-case F), for its
"Keystroke already used" warning.  Likewise, " " turns to "Space".

After this commit, it should be possible to change parse_keystroke()
to never write back into its input string.

If really_add_keybinding() cannot generate the string for some reason
(out of memory?), then it will use whatever parse_keystroke() has left
in the buffer.  The alternatives would be to omit the keystroke name
from the warning or to reject the keybinding entirely; it isn't clear
what the best solution is here, but the one I implemented is closest
to the previous behaviour.
2006-08-13 14:04:17 +03:00
Kalle Olavi Niemitalo
19bb5f02d1 do_file_menu: Correct the order of arguments in SET_MENU_ITEM invocations.
The last two parameters are hotkey_state_ and hotkey_pos_, not vice versa.
This bug did not affect the binary because HKS_SHOW is defined as 0 anyway.
2006-08-13 07:37:39 +00:00
Miciah Dashiel Butler Masters
75e292efe6 Mark the prompt for a key when adding a binding as translatable
Thanks to Kalle Olavi Niemitalo for noticing this omission.
2006-08-13 07:34:25 +00:00
Witold Filipczyk
5e1a1a215a Fixed about: 2006-08-13 08:58:20 +02:00
Kalle Olavi Niemitalo
143d95e927 UTF-8: Reuse the translation table if it is from the same charset.
This change makes ELinks more efficient and causes bug 782 to occur
far less often.  (That does not mean the bug should not be fixed.)
2006-08-12 21:10:39 +02:00
Witold Filipczyk
b1c8eb5572 SEE: use periodic callback. SEE engine passes infinite test 2006-08-12 19:07:16 +02:00
Witold Filipczyk
0a1b522fdd Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2006-08-12 18:46:43 +02:00
Witold Filipczyk
19315e136e Ecmascript: the code adjusted for SEE-2.0 2006-08-12 18:43:31 +02: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
f97a392c01 try_mark_key: Reject non-ASCII keys as mark characters.
The previous version used only the low 8 bits of the key code.
This one arranges for the whole key to be rejected if it's not ASCII.
Perhaps the modifiers should be checked too, but I'm not changing that now.
2006-08-12 15:07:07 +03:00
Kalle Olavi Niemitalo
2648fd57e4 UTF-8 doc: Clarify FIXME in try_document_key. 2006-08-12 15:00:44 +03:00
Kalle Olavi Niemitalo
8be5ed9749 add_accesskey_to_string: Use KBD_MOD_NONE, rather than plain 0. 2006-08-12 14:53:28 +03:00
Kalle Olavi Niemitalo
f3b04b8645 terminal: Introduce term_event_key_T. 2006-08-12 14:48:08 +03:00
Kalle Olavi Niemitalo
e101f5f537 UTF-8 doc: Clarify FIXME in add_accesskey_to_string. 2006-08-12 12:37:37 +03:00
Miciah Dashiel Butler Masters
8344dfe6c9 Fix IPv4 DNS lookup bug
In revision 1.15 of dns.c (as it was called way back then), pasky
backported a fix from Links 0.97pre2 to try gethostbyaddr before
trying gethostbyname for DNS lookups:

   MacOS address resolution fix (Aldy Hernandez) (from 0.97pre2)

However, that fix introduced a bug, because it was calling gethostbyaddr
on all addresses, not just IP addresses. Mikulas fixed that bug in Links
0.98:

   Do not call gethostbyaddr when name is not ip address (it should avoid
   some useless nameserver queries)'

This fix was never backported to ELinks. Until today.

This commit is functionally the same as the fix in Links 0.98, plus it uses
inet_aton for great correctness!

This fixes a bug reported in #elinks by tnks, whereby lookups for
yubnub.org resulted in 121.117.98.110 == 0x7975626E == 'y', 'u', 'b', 'n'.
I believe that it also fixes bug 691 (which is already closed with a
workaround).
2006-08-09 12:42:54 +00:00
Kalle Olavi Niemitalo
44633cd757 BFU: Fix cell count for forcibly wrapped lines.
To reproduce before this patch:
- Run ELinks with an 80x25 terminal.
- Set document.browse.forms.confirm_submit = 1.
- Go to <http://bugzilla.elinks.cz/query.cgi>.
- Click the [ Search ] submit button.
- ELinks asks "Do you want to post form data to URL".
  Each line of the URL begins at the horizontal center of the dialog,
  and bleeds outside the right border of the dialog.  Also, the
  [ Yes ] and [ No ] buttons appear to float below the dialog.
2006-08-06 23:26:55 +00: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
f7fd49cf28 UTF-8: New function unicode_fold_label_case and a related script. 2006-08-06 20:02:42 +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