This allows code to use document->cached instead of
find_in_cache(document->uri), thereby increasing the likelihood
of getting the correct cache entry.
This should fix Bug 756 - "assertion (cached)->object.refcount >= 0 failed"
after HTTP proxy was changed.
Patches for this were written by me and then later by Jonas.
This commit combines our independent implementations.
As draw_textarea_utf8 loops over each character of the textarea content, it
checks whether the character is on the screen; draws it if so; increments
the screen co-ordinate; and updates the position in the textarea text.
The last step was being skipped when the character was not on the line,
so a line would be drawn from the beginning, even if the left edge of the
textarea is off the screen.
Closes: Bug 835 - Text in textarea is unaffected by horizontal scrolling of
document in UTF-8 mode
If utf8_char2cells isn't told where the string that contains
the given UTF-8 character ends, it computes that itself. Two users
of utf8_char2cells, format_textutf8 and split_line, were calling
utf8_char2cells in a loop without providing the end of the string,
resulting in numerous calls by utf8_char2cells to strlen.
With this patch, format_textutf8 and split_line each find the end
of the string once and provide it to utf8_char2cells.
This particularly improves performance with textareas, since
format_textutf8 is called multiple times each time the user interacts
with the textarea and when it must be redrawn.
Closes: Bug 823 - Big textarea is too slow with CONFIG_UTF8
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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".
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.
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.
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.
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.
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|
|_ |
+----+
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.
then dump_to_file_256 is defined in dump.c but not used.
If configure --enable-debug was used, then gcc warns about
the unused function, and the warning stops the build.
2. The description of document.dump.color_mode ends with a
newline, provoking a runtime warning from check_description
in src/config/options.c.
3. options.inc has preprocessor directives inside macro arguments.
That is not portable C. xgettext (GNU gettext-tools) 0.14.3 is
not smart enough to figure out the possible combinations, and
copies an incorrect string to elinks.pot.
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:
With commit 637f1e82e6 ('NET: Merge
change_connection into cancel_download'), cancel_download returns
immediately if the connection is not in a result state, so save some
code by not checking is_in_progress_state before calling cancel_download.
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>
This simplifies unqueuing of downloads and makes it more obvious that
the 'change' being performed is to migrate or replace an old download
handle with a new one.
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! ;)