1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-28 03:06:20 -04:00
Commit Graph

68 Commits

Author SHA1 Message Date
Kalle Olavi Niemitalo
311d95358d bug 153, 1066: Convert bookmarks to/from UTF-8 when searching. 2009-02-08 18:26:21 +02:00
Kalle Olavi Niemitalo
8c0fa7f09c bug 153, 1066: Convert strings to edit-bookmark dialog from UTF-8. 2009-02-08 18:26:21 +02:00
Kalle Olavi Niemitalo
5a29dbc4a1 bug 153, 1066: Convert strings to bookmark info dialog from UTF-8. 2009-02-08 18:26:20 +02:00
Kalle Olavi Niemitalo
b3acd2a5bc bug 153: Convert titles in bookmark manager from UTF-8. 2009-02-08 18:26:20 +02:00
Kalle Olavi Niemitalo
b3f9d48bba bug 153, 1066: Convert strings from add-bookmark dialogs to UTF-8.
In src/bookmarks/dialogs.c, do_add_bookmark() gets the title and URL
in the terminal charset and needs to know which one that is.  When a
bookmark is being added, save the struct terminal * to dialog.udata2
and read the charset from there.  When a bookmark is being edited,
dialog.udata2 is needed for the struct bookmark *, but there we always
have the parent struct dialog_data * in dialog.udata and can get the
terminal from that.
2009-02-08 18:26:19 +02:00
Kalle Olavi Niemitalo
99d1269bc5 bug 153, 1066: Convert session-snapshot bookmarks to/from UTF-8.
These functions now expect or return strings in UTF-8:
delete_folder_by_name (sneak in a const, too), bookmark_terminal_tabs,
open_bookmark_folder, and get_auto_save_bookmark_foldername_utf8 (new
function).
2009-02-08 18:26:19 +02:00
Kalle Olavi Niemitalo
97d72d15a0 bug 153, 1066: Convert properties of SMJS bookmark to/from UTF-8.
SpiderMonkey uses UTF-16 and the strings in struct bookmark are in
UTF-8.  Previously, the conversions behaved as if the strings had been
in ISO-8859-1.

SpiderMonkey also supports JS_SetCStringsAreUTF8(), which would make
the existing functions convert between UTF-16 and UTF-8, but that
effect is global so I dare not enable it yet.  Besides, I don't know
if that function works in all the SpiderMonkey versions that ELinks
claims to work with.
2009-02-08 18:26:18 +02:00
Kalle Olavi Niemitalo
03b112796d bug 153, 1066: Add codepage parameter to update_bookmark().
This also makes the bookmark-update event carry strings in UTF-8.
The only current consumer of that event is bookmark_change_hook(),
which ignores the strings, so no changes are needed there.
2009-02-08 18:26:18 +02:00
Kalle Olavi Niemitalo
73f925ce21 bug 153, 1066: Convert XBEL bookmarks to/from UTF-8.
When the file is being read, Expat provides the strings to ELinks in
UTF-8, so ELinks can put them in struct bookmark without conversions.
Make sure gettext returns any placeholder strings in UTF-8, too.
Replace '\r' with ' ' in bookmark titles and URLs.

When the file is being written, put encoding="UTF-8" in the XML
declaration, and then write out the strings from struct bookmark
without character set conversions.  Do replace some characters
with entity references though, by calling add_html_to_string().
2009-02-08 18:26:04 +02:00
Kalle Olavi Niemitalo
8c0ae2a215 bug 153, 1066: Convert ~/.elinks/bookmarks to/from UTF-8.
The ~/.elinks/bookmarks file is in the system charset,
for compatibility with earlier ELinks releases,
but internally the strings are in UTF-8.
2009-01-24 14:38:59 +02:00
Kalle Olavi Niemitalo
1cb81679f4 bug 153, 1066: Add add_bookmark_cp(). 2009-01-24 12:18:28 +02:00
Kalle Olavi Niemitalo
d1f2f8df80 bug 153, 1066: init_bookmark() and add_bookmark() expect UTF-8.
Comment changes only.
2009-01-24 12:17:48 +02:00
Kalle Olavi Niemitalo
37de386051 bug 153, 1066: Document that bookmarks should be UTF-8.
Comment changes only.
2009-01-24 12:12:45 +02:00
Kalle Olavi Niemitalo
a82a5cc6d5 XBEL bug 761: Distinguish between names and values of attributes.
When ELinks is parsing an XML element in from an XBEL bookmark file,
it collects the attributes of the element to the current_node->attrs
list.  Previously, struct attributes had room for one string only:
the last element of current_node->attrs was the name of the first
attribute, and it was preceded by the value of the first attribute,
the name of the second attribute, the value of the second attribute,
and so on.  However, when get_attribute_value() was looking for a
given name, it compared the values as well.  So, if you had for
example <bookmark id="href" href="http://elinks.cz/">, then
get_attribute_value("href") would incorrectly return "href".

To fix this confusion, store values in the new member
attributes.value, rather than in attributes.name.
2009-01-04 15:15:21 +02:00
M. Vefa Bicakci
20a7a6c460 Patch 3: Further fixes including strcasestr and convert_to_lowercase 2008-11-01 22:32:43 +02: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
5d22006f93 do_move_bookmark: Update comment to match reality.
[ From commit 22d051925e in ELinks
  0.11.2.GIT.  --KON ]
2007-04-01 15:02:47 +03:00
Kalle Olavi Niemitalo
7645a836fc Cast the NULL argument of straconcat to unsigned char *.
straconcat reads the args with va_arg(ap, const unsigned char *),
and the NULL macro may have the wrong type (e.g. int).

Many places pass string literals of type char * to straconcat.  This
is in principle also a violation, but I'm ignoring it for now because
if it becomes a problem with some C implementation, then so will the
use of unsigned char * with printf "%s", which is so widespread in
ELinks that I'm not going to try fixing it now.
2007-03-11 12:59:11 +02:00
Kalle Olavi Niemitalo
801d520ddd Fix compiler errors without HAVE_VARIADIC_MACROS. 2007-03-11 12:22:02 +02:00
Kalle Olavi Niemitalo
e325b748be XBEL: Fix us-ascii charset lookup.
Previously, print_xml_entities did look up the charset, but did not
save the result anywhere and just used 0, leading to further lookups
in subsequent calls.  It worked by accident though, because the
codepage index of us-ascii currently is 0.
2007-03-11 10:36:44 +02:00
Kalle Olavi Niemitalo
d7e4b57146 Make instances of struct listbox_ops const. 2007-02-04 15:17:49 +02:00
Kalle Olavi Niemitalo
a5e321cb2b Make instances of struct hierbox_browser_button const.
And explicitly disable the "Save" buttons in anonymous mode,
even though they are currently inside #if 0.
2007-02-04 13:54:07 +02:00
Kalle Olavi Niemitalo
22f7468013 Make arrays of option change hooks const. 2007-01-27 19:00:47 +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
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
Laurent MONIN
1136aefb71 Trim trailing whitespaces. 2006-07-27 09:51:10 +02:00
Miciah Dashiel Butler Masters
32ec5d1db3 do_move_bookmarks: replace destb and desti parameters with insert_as_child flag
Simplify do_move_bookmarks (from a readability perspective) by replacing
the destb and desti parameters with a new insert_as_child flag. Inspired
by Kalle Olavi Niemitalo.
2006-06-16 21:13:32 +00:00
Miciah Dashiel Butler Masters
6f98f5fd96 Bookmarks: Fix update after move
do_move_bookmark was only updating the selection in the bookmarks manager
window in which the Move button was pressed. Now all windows are updated.

This patch also prevents a crash when the first item that was displayed
in a box was the last child of a folder and was being moved (the comment
removed in this patch was incorrect in assuming that bm->box->next must
be valid because it neglected to account for non-root children).

This change required that I move the definition of struct
hierbox_dialog_list_item from src/bfu/hierbox.c to src/bfu/hierbox.h.

Thanks to Kalle Olavi Niemitalo for finding both the update problem
and the crash.
2006-06-16 21:13:31 +00:00
Miciah Dashiel Butler Masters
fed0d6bd54 Bookmarks: Include bfu/listbox.h and bfu/hierbox.h 2006-06-16 21:13:31 +00:00
Miciah Dashiel Butler Masters
fde874ad35 Remove a useless comment
The comment was added in commit 0a44083e7b63cf51c7347a289c6d953cb7c15bcd.
2006-06-06 05:18:40 +00:00
Miciah Dashiel Butler Masters
819ea129af Bookmarks: Avoid a dangling pointer on malloc failure
In memorize_last_searched_bookmark, when malloc of bm_last_searched_url
fails, set bm_last_searched_title to NULL after freeing it.
2006-06-06 05:18:39 +00:00
Miciah Dashiel Butler Masters
9d6ec1ee59 Remove a superfluous check.
This thoroughly ridiculous check was added in commit
bfa309e192caf6f1dd1f1bc112490b2f3dad1ebb.
2006-06-06 05:18:39 +00:00
Miciah Dashiel Butler Masters
d3bc3eb7e9 Drop an unnecessary prototype (it is in the header file). 2006-06-06 05:18:38 +00:00
Miciah Dashiel Butler Masters
1a3c8734d4 Utilise mem_free_set. 2006-06-06 05:18:38 +00:00
Miciah Dashiel Butler Masters
551ff4587a Drop a stale comment.
The return value to delete_bookmark was changed to void in commit
7f47389e41a1bd2d9a0e05b74df49c26cd8e155a.
2006-06-06 02:43:00 +00:00
Miciah Dashiel Butler Masters
938d9c860b Drop an unnecessary prototype (it is in the header file). 2006-06-06 02:41:09 +00:00
Kalle Olavi Niemitalo
e5ed5bce80 bookmarks: CONFIG_SMALL elides explanations of why Move failed.
(I added them in commit 3090e3a25077a19a7b2d5361543e28ca19cc7b84.)
2006-06-02 21:16:57 +00:00
Kalle Olavi Niemitalo
403a4ac2a2 bookmarks: Turn tree_node::attrs into a struct list_head.
Previously, it was a pointer to a separately allocated struct attributes,
of which only the LIST_HEAD members were actually used.
All init_list calls now operate on struct list_head.
This change may also reduce memory usage for reading bookmarks.
2006-06-02 19:14:59 +00:00
Kalle Olavi Niemitalo
d10a489a14 BFU: Mark format strings in struct listbox_ops_messages.
With regular comments in the definition of the structure itself,
and with xgettext:c-format comments in constants of that type,
if xgettext would otherwise guess wrong; so that translators
will know they'll have to double any percent signs they add.
I didn't regenerate PO files, though.
2006-06-02 19:08:09 +00:00
Laurent MONIN
1d3656a317 Pass a pointer to a hash pointer to free_hash() to ensure hash pointer
is NULL on return.
2006-05-31 19:33:36 +02:00
Laurent MONIN
54099f5286 Do not export init_hash(),strhash() and hash_size() anymore, use a
wrapper named init_hash8() instead.
2006-05-31 19:17:01 +02:00
Miciah Dashiel Butler Masters
4398613413 Use listbox_sel instead of focus_bookmark and delete focus_bookmark 2006-05-28 00:12:08 +00:00
Kalle Olavi Niemitalo
3090e3a250 BOOKMARKS: Tell the user why the Move button didn't work.
Thanks to Jonas Fonseca.
2006-05-21 16:46:23 +03:00
Kalle Olavi Niemitalo
b1f8756c59 Merge with http://elinks.cz/elinks.git 2006-02-05 17:48:43 +02:00
Jonas Fonseca
3f878c6ce7 BOOKMARKS: Fix XBEL calling add_bookmark() with NULL title
It didn't check that both title and title->text was non NULL. In either
case it now passes "No title" string to add_bookmark().

Reported by Neuromancer.

Tested with both:

	<bookmark href="empty://title"><title></title><bookmark>
	<bookmark href="no://title"></bookmark>
2006-01-31 03:52:48 +01:00
Jonas Fonseca
2748d043f9 Autogenerate .vimrc files and put the master in config/vimrc
This changes the init target to be idempotent: most importantly it will now
never overwrite a Makefile if it exists. Additionally 'make init' will
generate the .vimrc files. Yay, no more stupid 'added fairies' commits! ;)
2006-01-15 18:38:58 +01:00
Kalle Olavi Niemitalo
89fe822f70 Merge with 6a9ea02f3a
(via http://elinks.cz/elinks.git)
2006-01-14 21:30:12 +02:00
Laurent MONIN
b8e64a5ee0 Simplify secure_open() call, make it a wrapper around secure_open_umask(). 2006-01-10 23:49:35 +01:00
Laurent MONIN
9b88da873a Use mode_t and mode macros everywhere. 2006-01-10 23:35:22 +01:00