1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-19 01:36:33 -04:00
Commit Graph

336 Commits

Author SHA1 Message Date
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
7dcc6c9a19 viewer UTF-8: Correctly position cursor for ACT_EDIT_LEFT in text input field.
To reproduce the bug before this patch:
Enable CONFIG_UTF_8, UTF-8 I/O, and UTF-8 charset.
Go to www.google.com and type "abc" in the text input field.
Then press Left.  The cursor jumps to "a" when it should go to "c".
2006-07-31 21:46:36 +02:00
Laurent MONIN
1136aefb71 Trim trailing whitespaces. 2006-07-27 09:51:10 +02:00
Laurent MONIN
a897a95721 Compilation fixes (CONFIG_UTF_8): move variables declarations at start
of blocks. Old compilers do not support in-block declarations.
2006-07-27 09:49:49 +02:00
Witold Filipczyk
4263af97a9 The missing code, I suppose. Fixed moving right in textareas in UTF-8 mode.
First move was by two cells.
2006-07-23 15:23:19 +02:00
Jonas Fonseca
71e569c129 Move variable out of loop to fix uninitialized warning caused by goto label 2006-07-22 17:06:05 +02:00
Witold Filipczyk
7c7a0bb890 Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2006-07-21 19:00:49 +02:00
Miciah Dashiel Butler Masters
97e2bc9365 Text type-ahead searching: don't follow current link on enter
When the user presses enter during a text type-ahead search, simply cancel
the search without additionally following the current link. Link type-ahead
searching still will follow the active link on enter.
2006-07-21 11:15:30 +00:00
Witold Filipczyk
2a6125e3d0 Merge with utf8. src/document/plain/renderer.c replaced by utf8 version 2006-07-21 13:12:06 +02:00
Witold Filipczyk
3126078f51 Rexgexp works but the accented letters. It's all I can do 2006-07-18 18:06:43 +02:00
Witold Filipczyk
b27667fcf7 Use already known document->options.utf8 instead of is_cp_utf8 2006-07-18 17:54:23 +02:00
Witold Filipczyk
44c74ac389 Refactor is_cp_special to is_cp_utf8 2006-07-18 17:51:03 +02:00
Witold Filipczyk
681cfc4ae5 Populate search function with utf8 indicating whether we really use UTF-8 2006-07-18 17:39:02 +02:00
Witold Filipczyk
02e098dc5a Case insensitive search works with accented letters. UTF-8 character set
is assummed for now
2006-07-18 12:31:30 +02:00
Witold Filipczyk
7dc2b5bf02 Case insensitive search works but accented letters 2006-07-18 00:44:08 +02:00
Witold Filipczyk
8052c74a03 Case sensitive searching works, but only in UTF-8 mode 2006-07-18 00:28:13 +02:00
Miciah Dashiel Butler Masters
76f3dc99b3 Fix refresh after move-page-up with a prefix
Make move_up and move_down return no value. Instead, save the old y value
and compare it to the new after calling move_up or move_down in
move_page_up or move_page_down, respectively.

This fixes a bug where if given a prefix, if that prefix specified a number
of pages greater than move-page-up actually scrolled, there would be no
screen update, because the last call to move_up would return FRAME_EVENT_OK
which would be returned from move_page_up, even tho move_page_up would have
previously returned FRAME_EVENT_REFRESH.
2006-06-24 07:39:23 +00:00
Miciah Dashiel Butler Masters
29ffe71bc1 New actions: kill-word-back, move-backward-word, move-forward-word 2006-06-23 04:07:52 +00:00
Miciah Dashiel Butler Masters
1bd498cde9 Fix accesskeys so that they work when priority is 0
Don't try the key as an accesskey if a menu was opened, whether it was just
the main menu or whether it was a submenu of the menu menu (we would try
the key as an accesskey in the latter case).

In send_kbd_event, replace the KBD_MOD_ALT modifier when trying the key as
an accesskey rather than when we don't.
2006-06-19 11:34:49 +00:00
Miciah Dashiel Butler Masters
588fa3ece8 Properly deselect the main menu instead of crashing
In send_kbd_event, use deselect_mainmenu to get rid of the main menu
instead of delete_window. This fixes bug 747.
2006-06-19 11:07:03 +00:00
Miciah Dashiel Butler Masters
a3d804540a Factor draw_link out of clear_link 2006-06-17 01:02:50 +00:00
Laurent MONIN
5acb5e6663 Trim trailing whitespaces. 2006-05-31 19:34:49 +02:00
Miciah Dashiel Butler Masters
c91c763d49 Eliminate link_bg
Instead of saving the old link colours when selecting a link and using that
to restore them when unselecting it, just copy the data from the document.

 - Eliminate struct link_bg and the .link_bg and .link_bg_n members
   of struct document_view.

 - Eliminate the free_link routine and don't call it from draw_doc,
   clear_link, or detach_formatted.

 - Add a .old_current_link member to struct view_state and initialise it in
   init_vs.

 - Don't save link_bg in draw_current_link.

 - Rewrite clear_link to use the document data instead of link_bg.

 - Modify init_link_drawing not to allocate ling_bg and to return a pointer
   to a static variable for the template character.
2006-05-28 01:08:46 +00:00
Miciah Dashiel Butler Masters
e91b46de5f Modularise viewer/text/marks 2006-05-20 15:01:24 +00:00
Pavol Babincak
c0d20d8420 UTF-8 support for html form textarea. Changed displaying of textarea.
Including double-width glyph support.

Note: textarea is now drawn with blank collumn at end of lines. It seems
that this is more intuitive for users. It behaves similar as textareas in
graphical interfaces. I hope it will hold your interest.

+----+         +----+         +----+
|aaA | [right] |aaa_| [right] |aaa |
|aaa |         |aaa |         |Aaa |
|bb  |         |bb  |         |bb  |
+----+         +----+         +----+
+----+         +----+         +----+
|Aaa |  [end]  |aaa_|   [c]   |aaa |
|aaa |         |aaa |         |Caa |
|bb  |         |bb  |         |abb |
+----+         +----+         +----+
A, _, C - cursor positions.
[right] - right arrow
[end]   - ACT_END (End button)
[c]     - Letter c.

Now this code:
<textarea rows="3" cols="3">aaaaaabb</textarea>
represents textarea with 3x3 positions for chars.

Before this texteare behaved some kind of weirdly. That code above was
rendered like this:
+----+
|aaaa|
|aabb|
|_   |
+----+
2006-05-07 00:51:26 +02:00
Pavol Babincak
aedc5459ef UTF-8 support for html form elements: text, password, select and file.
Including double-width glyphs. Without support for textarea.
2006-05-07 00:51:26 +02:00
Pavol Babincak
546539b25e Changed type uint16_t to unicode_val_T.Changed var x and xi to xbase and x. 2006-05-07 00:51:25 +02:00
Pavol Babincak
f515f14e08 Renamed variables utf8_pos to state_cell and char_cnt to chars_cells. 2006-05-07 00:51:24 +02:00
Witold Filipczyk
c3f17eadeb Ecmascript: activate link only when onClick returns true 2006-05-02 13:47:16 +02:00
Witold Filipczyk
9f69170c2a fixup_select_state was unnecessary 2006-05-02 12:56:05 +02:00
Witold Filipczyk
cdd86d3c20 Ecmascript: write to the variable selectedIndex. Not tested 2006-05-02 11:28:41 +02:00
Witold Filipczyk
79a6fc1905 Pressing button caused not only onclick action, but also
"goto current page". See test/ecmascript/onclick.html.
Tell me if this breaks something
2006-04-30 17:02:48 +02:00
Miciah Dashiel Butler Masters
90f71fe6e4 Highlight links as one enters link prefixes. 2006-04-14 21:46:35 +00:00
Kalle Olavi Niemitalo
8fc8a00844 accel-check: add_uri_command_to_menu now wants the title as a parameter.
Thus, each caller must now choose the accelerator key and declare the
accelerator contexts (i.e. menus) to which it may add the command.

Also, use only one context for tab_menu.

These changes fix the following bugs in accelerator conflict detection:
* "~Pass frame URI to external command" may be displayed together
  with "Pass tab URI to e~xternal command", but that was not
  declared.
* "Pass link URI to e~xternal command" was declared as being in
  the tab menu, but it is actually displayed in the link menu.
2006-03-26 20:52:11 +00:00
Pavol Babincak
8b9d06c977 Convert link titles to correct codepage before displaying it on screen.
Don't replace UTF-8 bytes with '*'. Probably there is need to do better
check what will be displayed.

Also get_current_link_title is no longer pretty and trivial. (o:
2006-03-13 01:54:34 +01:00
witekfl
3f01c3d2fe Display optionally tabs bar at top like other browser do.
TODO: input_line_layouter, ACT_MAIN_TAB_MENU
2006-03-04 10:24:37 +01:00
Pavol Babincak
81778bc5d7 Correct computing of cursor position in UTF-8 textarea. 2006-02-18 20:28:00 +01:00
Pavol Babincak
f9d67aeb73 Added configure option --enable-utf-8
For enabling better UTF-8 support by Witek and Scrool.
2006-02-18 20:28:00 +01:00
Pavol Babincak
3ffa7cac91 Bug fix: formating error in UTF-8 textarea
When textarea contains UTF-8 characters they are not correctly wrapped.
2006-02-18 20:27:52 +01:00
Witold Filipczyk
44a1aa9c87 Witekfl's UTF-8 patch v5. 2006-02-18 20:27:46 +01:00
Kalle Olavi Niemitalo
4217f2c555 Merge with http://elinks.cz/elinks.git 2006-02-18 12:21:47 +02:00
Miciah Dashiel Butler Masters
190259ca22 mem_alloc_align: drop the obj type parameter
Instead use the object itself, i.e., replace typeof(obj) with
typeof(**ptr).
2006-02-17 17:32:59 +00:00
Miciah Dashiel Butler Masters
e6b9093f87 find_form_state: use mem_align_alloc to save some code 2006-02-17 16:52:38 +00:00
Kalle Olavi Niemitalo
0066214b47 Merge with http://elinks.cz/elinks.git 2006-02-10 09:15:12 +02:00
witekfl
6fe1a431f1 Sometimes scripts submit forms using buttons 2006-02-09 22:53:00 +01:00
Miciah Dashiel Butler Masters
ca56e3b185 Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2006-02-08 14:12:13 +00:00
Kalle Olavi Niemitalo
262d592d23 Fix compile errors in call_onsubmit_or_submit #ifdef CONFIG_ECMASCRIPT.
The errors were caused by commit b623decfb5.
Also, rename call_onsubmit_or_submit to call_onsubmit_and_submit.
2006-02-06 23:06:35 +02:00
Kalle Olavi Niemitalo
b623decfb5 Tell the selected submit button to the server.
Commit 9cc9db4e24 broke submit buttons
on HTML forms, so that the server no longer knows which button was
actually pressed.

<kahmalo> The bug with forms seems to be that try_submit_given_form (in
          src/viewer/text/link.c) is the only function that runs "onsubmit"
          scripts, and it does not care which of the submit buttons was
          pressed; it calls submit_given_form which submits based on the first
          item of the form.                                             [20:57]
<kahmalo> or last, I don't know how the list works.
<kahmalo> try_submit_given_form could get the control via
          get_current_link(doc_view) but I suppose it'd be cleaner to provide
          that as a parameter.                                          [20:58]

Originally posted as:
<mid:87ek2heebh.fsf@Astalo.kon.iki.fi>
<nntp://news.gmane.org/87ek2heebh.fsf@Astalo.kon.iki.fi>
<http://permalink.gmane.org/gmane.comp.web.links/2745>
2006-02-06 20:57:08 +02:00
Kalle Olavi Niemitalo
b1f8756c59 Merge with http://elinks.cz/elinks.git 2006-02-05 17:48:43 +02:00
Miciah Dashiel Butler Masters
420f3072fb refresh_view: drop unnecessary call to redraw_from_window
print_screen_status calls redraw_from_window, so there is no need to
call both.
2006-02-05 01:03:24 +00:00
fa93d05b7e current_link_evhook: return effaced 2006-01-30 12:18:43 +01:00
1dae2926fd Neither SEE nor SpiderMonkey tolerate return outside functions 2006-01-30 11:52:58 +01:00
Jonas Fonseca
20f5b76bb2 ECMASCRIPT: Fix unused SEE specific variables when using spidermonkey 2006-01-28 18:26:45 +01:00
9cc9db4e24 Handling onsubmit 2006-01-28 11:17:22 +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
21f61c5c06 Specify accelerator contexts for "Form f~ields". 2006-01-01 23:31:41 +02:00
Kalle Olavi Niemitalo
345ba7afcd Merge with http://elinks.cz/elinks.git 2006-01-01 19:05:44 +02:00
Kalle Olavi Niemitalo
4c2831677a Here is a framework that detects cases where a PO file assigns
the same accelerator key to multiple buttons in a dialog box or
to multiple items in a menu.  ELinks already has some support for
this but it requires the translator to run ELinks and manually
scan through all menus and dialogs.  The attached changes make it
possible to quickly detect and list any conflicts, including ones
that can only occur on operating systems or configurations that
the translator is not currently using.

The changes have no immediate effect on the elinks executable or
the MO files.  PO files become larger, however.

The scheme works like this:

- Like before, accelerator keys in translatable strings are
  tagged with the tilde (~) character.

- Whenever a C source file defines an accelerator key, it must
  assign one or more named "contexts" to it.  The translations in
  the PO files inherit these contexts.  If multiple strings use
  the same accelerator (case insensitive) in the same context,
  that's a conflict and can be detected automatically.

- The contexts are defined with "gettext_accelerator_context"
  comments in source files.  These comments delimit regions where
  all translatable strings containing tildes are given the same
  contexts.  There must be one special comment at the top of the
  region; it lists the contexts assigned to that region.  The
  region automatically ends at the end of the function (found
  with regexp /^\}/), but it can also be closed explicitly with
  another special comment.  The comments are formatted like this:

    /* [gettext_accelerator_context(foo, bar, baz)]
         begins a region that uses the contexts "foo", "bar", and "baz".
         The comma is the delimiter; whitespace is optional.

       [gettext_accelerator_context()]
         ends the region.  */

  The scripts don't currently check whether this syntax occurs
  inside or outside comments.

- The names of contexts consist of C identifiers delimited with
  periods.  I typically used the name of a function that sets
  up a dialog, or the name of an array where the items of a
  menu are listed.  There is a special feature for static
  functions: if the name begins with a period, then the period
  will be replaced with the name of the source file and a colon.

- If a menu is programmatically generated from multiple parts,
  of which some are never used together, so that it is safe to
  use the same accelerators in them, then it is necessary to
  define multiple contexts for the same menu.  link_menu() in
  src/viewer/text/link.c is the most complex example of this.

- During make update-po:

  - A Perl script (po/gather-accelerator-contexts.pl) reads
    po/elinks.pot, scans the source files listed in it for
    "gettext_accelerator_context" comments, and rewrites
    po/elinks.pot with "accelerator_context" comments that
    indicate the contexts of each msgid: the union of all
    contexts of all of its uses in the source files.  It also
    removes any "gettext_accelerator_context" comments that
    xgettext --add-comments has copied to elinks.pot.

  - If po/gather-accelerator-contexts.pl does not find any
    contexts for some use of an msgid that seems to contain an
    accelerator (because it contains a tilde), it warns.  If the
    tilde refers to e.g. "~/.elinks" and does not actually mark
    an accelerator, the warning can be silenced by specifying the
    special context "IGNORE", which the script otherwise ignores.

  - msgmerge copies the "accelerator_context" comments from
    po/elinks.pot to po/*.po.  Translators do not edit those
    comments.

- During make check-po:

  - Another Perl script (po/check-accelerator-contexts.pl) reads
    po/*.po and keeps track of which accelerators have been bound
    in each context.  It warns about any conflicts it finds.
    This script does not access the C source files; thus it does
    not matter if the line numbers in "#:" lines are out of date.

This implementation is not perfect and I am not proposing to
add it to the main source tree at this time.  Specifically:

- It introduces compile-time dependencies on Perl and Locale::PO.
  There should be a configure-time or compile-time check so that
  the new features are skipped if the prerequisites are missing.

- When the scripts include msgstr strings in warnings, they
  should transcode them from the charset of the PO file to the
  one specified by the user's locale.

- It is not adequately documented (well, except perhaps here).

- po/check-accelerator-contexts.pl reports the same conflict
  multiple times if it occurs in multiple contexts.

- The warning messages should include line numbers, so that users
  of Emacs could conveniently edit the conflicting part of the PO
  file.  This is not feasible with the current version of
  Locale::PO.

- Locale::PO does not understand #~ lines and spews warnings
  about them.  There is an ugly hack to hide these warnings.

- Jonas Fonseca suggested the script could propose accelerators
  that are still available.  This has not been implemented.

There are three files attached:

- po/gather-accelerator-contexts.pl: Augments elinks.pot with
  context information.

- po/check-accelerator-contexts.pl: Checks conflicts.

- accelerator-contexts.diff: Makes po/Makefile run the scripts,
  and adds special comments to source files.
2006-01-01 18:55:18 +02:00
Jonas Fonseca
cef160d630 No need to have link_form_menu() be a menu function when it has an action 2005-12-26 22:28:38 +01:00
Miciah Dashiel Butler Masters
eeb51bffea Refresh the view after selecting a new form item with the form menu. 2005-12-26 11:31:05 +00:00
Miciah Dashiel Butler Masters
bcdc69e86a Use intdup for the new form menu because you can't just put an int in
a void * and expect it to work everywhere.
2005-12-26 11:25:03 +00:00
Jonas Fonseca
26b82953ce Add a "Form fields" entry to the link menu (if it is a form field)
The menu shows a list of all fields of a form, with the possibility to jump
right to that form field when selecting an entry. The menu text is the
basic form field label "Radio button", "Text field", etc. with the form
field name or alt text as the right menu text.

It introduces a new main action called link-form-menu with no default
binding.

Requested by Klaus Knopper, as a mean to improve accessibility for complex,
overloaded pages like ebay.com.
2005-12-26 01:27:44 +01:00
Miciah Dashiel Butler Masters
d11dc65320 If the user edits a textarea with an external editor but exceeds the
maximum length, do not simply drop the changes, but instead truncate them,
warn the user, and provide the user with the path to the temporary file
from which the full changes can be recovered.
2005-12-18 16:23:52 +00:00
Miciah Dashiel Butler Masters
69f38bcbcc After editing a textarea in an external editor, do not unlink the file
if it was too large to fit into the textarea.
2005-12-18 16:02:37 +00:00
Miciah Dashiel Butler Masters
9959f4d788 Fold load_textarea_file into textarea_edit. 2005-12-18 16:00:48 +00:00
Miciah Dashiel Butler Masters
517bb03da4 Add routine add_file_to_string and use it in load_textarea_file. 2005-12-18 15:56:59 +00:00
Miciah Dashiel Butler Masters
13f4464151 Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2005-12-13 18:03:55 +00:00
Laurent MONIN
1ca88c9147 encode_multipart(): move @rd to inner scope. 2005-12-13 17:04:24 +01:00
Laurent MONIN
10aa67fb32 sort_submitted_values(): move @change abd @next to inner scope. 2005-12-13 17:01:45 +01:00
Laurent MONIN
dbcc033edb draw_frames(): move @more to inner scope. 2005-12-13 16:59:10 +01:00
Miciah Dashiel Butler Masters
db5b9be213 Convert the body of activate_link to a single switch statement. 2005-12-13 00:00:08 +00:00
Miciah Dashiel Butler Masters
b191247894 Reflow some code to reduce indentation in activate_link. 2005-12-12 23:57:37 +00:00
Miciah Dashiel Butler Masters
73e3cdecd0 Factor activate_link out of enter, which now just acquires the link
reference, calls activate_link, and triggers the onClick event.
2005-12-12 22:58:05 +00:00
Laurent MONIN
c769b81f93 send_event(): initialize @doc_view only when needed, and prevent a
useless test for mouse event when event is of keyboard type.
2005-12-12 17:11:28 +01:00
Laurent MONIN
59c8dcc473 get_current_link_info(): simplify code flow. 2005-12-12 17:05:43 +01:00
Petr Baudis
0281f732ab Fix broken onClick on checkboxes etc.
onClick on checkbox would get triggered before actually ticking the
checkbox, which is not the expected behaviour (apparently). This change
makes sure that we call the onClick event handler only after actually
doing our work with the checkbox/select widget (for the other widgets,
things should stay the same).
2005-12-10 03:48:42 +01:00
Laurent MONIN
df065ead80 Remove now useless $Id: lines. 2005-10-21 09:14:07 +02:00
Jonas Fonseca
c88afeb1c2 path_to_top -> top_builddir 2005-10-20 04:00:35 +02:00
Jonas Fonseca
e39a4342d6 Include $(top_srcdir)/Makefile.lib instead of $(path_to_top)/Makefile.lib
A step towards out of tree builds ...
2005-10-20 01:11:47 +02:00
Jonas Fonseca
c6f6717a79 Re-commit the rest of the changes which was reverted in the recent 'funny merge' 2005-10-17 23:20:53 +02:00
Jonas Fonseca
94ed6fa754 Finalize and cleanup the denser Makefile format
Convert remaining conditional file building to use

	OBJS-$(CONFIG_FOO) += foo.o

one problem with reverse meaining (in util/) fixed with local 'hack'.

Cleanup and remove stuff which is now default targets.
2005-09-28 12:38:17 +02:00
Jonas Fonseca
1efab31581 Simplify building of and linking with directories
Ditch the building of an archive (.a) in favour of linking all objects in a
directory into a lib.o file. This makes it easy to link in subdirectories
and more importantly keeps the build logic in the local subdirectories.

Note: after updating you will have to rm **/*.a if you do not make clean
before updating.
2005-09-27 21:38:58 +02:00
Jonas Fonseca
b30064c0d0 Rename targets: *-l -> *-local 2005-09-27 21:11:28 +02:00
Petr Baudis
3e394f3367 ELBuildized viewer/. 2005-09-16 13:33:43 +02:00
Jonas Fonseca
7462f22635 Remove now obsolete .cvsignore files. 2005-09-15 18:33:20 +02:00
Petr Baudis
0f6d4310ad Initial commit of the HEAD branch of the ELinks CVS repository, as of
Thu Sep 15 15:57:07 CEST 2005. The previous history can be added to this
by grafting.
2005-09-15 15:58:31 +02:00