Cherry-pick a fix from trunk; fix level handling in bidi_resolve_brackets.
Fix a typo in a comment.
Fix processing of brackets in isolates and crash in w32select.c.
Move cache retrieval on forwards scans to bidi_resolve_brackets.
Add support for canonically equivalent bracket characters.
Fix bidi reordering of bracket characters in isolates.

 src/bidi.c (bidi_cache_find): Rename the argument NEUTRALS_OK to
 RESOLVED_ONLY; when non-zero, return from the cache only fully
 resolved states.  All callers changed.
 (CANONICAL_EQU): New macro.
 (PUSH_BPA_STACK): Use it to push onto the BPA stack the canonical
 equivalent of the paired closing bracket character.
 (bidi_find_bracket_pairs): Set the bracket_pairing_pos member to
 the default non-negative value, to be checked later in
 bidi_resolve_brackets.  Use CANONICAL_EQU to test candidate
 characters against those pushed onto the BPA stack.
 (bidi_record_type_for_neutral): New function.
 (bidi_resolve_brackets): Record next_for_neutral and
 prev_for_neutral when embedding level gets pushed.  Force
 resolution of bracket pairs when entering a level run that was not
 yet BPA-resolved.
 (bidi_resolve_neutral): Add assertions before calling
 bidi_resolve_neutral_1.
 (bidi_level_of_next_char): Remove the code that attempted to
 resolve unresolved neutrals; that is now done by
 bidi_resolve_neutral.
A better fix for drawing hollow cursor on X on 1-pixel thin space characters.

 src/xterm.c (x_draw_bar_cursor, x_draw_hollow_cursor): Subtract 1
 pixel from the window's cursor glyph width, since X renders hollow
 blocks 1 pixel wider than the 'width' parameter.
 src/xdisp.c (get_phys_cursor_geometry): Don't subtract 1 pixel from
 glyph->pixel_width; this is now done in xterm.c.