aboutsummaryrefslogtreecommitdiffstats
path: root/src/textconv.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix get_conversion_field --with-wide-wint overflowPaul Eggert2024-07-161-2/+2
| | | | | | | * src/textconv.c (get_conversion_field): Set max value to PTRDIFF_MAX, not MOST_POSITIVE_FIXNUM, since the variable is ptrdiff_t, not EMACS_INT. Problem caught by gcc -Woverflow on a 32-bit platform with --with-wide-int.
* Fix latent side-effects of respecting field boundaries in text conversionPo Lu2024-06-251-9/+16
| | | | | | | | | | | * src/textconv.c (textconv_query, get_extracted_text) (get_surrounding_text): Restore selected window in addition to excursion. (locate_and_save_position_in_field): Restore excursion lest the current buffer differ from the selected window's contents, to prevent redisplay from clobbering the current buffer when called while the current buffer is at variance with the selected window's contents, as seen with dired-other-window.
* Fix minor issues in textconv.cPo Lu2024-05-271-1/+5
| | | | | | * src/textconv.c (really_commit_text): Introduce a few additional debugging printouts. (locate_and_save_position_in_field): Fix typo.
* Work around bad GCC diagnostic in select_windowPaul Eggert2024-04-301-0/+4
| | | | | * src/textconv.c (select_window): Add an eassume to work around GCC bug 114893.
* Take fields into account during text conversionPo Lu2024-04-291-24/+272
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lisp/cus-edit.el (Custom-mode): Enable text conversion, now that fields are correctly treated. * src/alloc.c (mark_frame): Mark f->conversion.field. * src/androidterm.c (android_update_selection): Adjust conversion region and selection position by the field start and end. * src/editfns.c (find_field): Export function. * src/frame.c (make_frame): Clear f->conversion.field. * src/frame.h (struct text_conversion_state) <field>: New field. * src/lisp.h (find_fields, reset_frame_conversion): Export functions. * src/minibuf.c (Fread_from_minibuffer): Reset frame conversion if Voverriding_text_conversion_style is set. * src/textconv.c (textconv_query): Narrow to field. (reset_frame_conversion): New function. (reset_frame_state): Clear conversion field. (really_delete_surrounding_text): Narrow to field. (locate_and_save_position_in_field): New function. (really_request_point_update, really_set_point_and_mark) (complete_edit_check, handle_pending_conversion_events_1) (handle_pending_conversion_events, get_conversion_field) (set_composing_region, textconv_set_point_and_mark, replace_text) (get_extracted_text, get_surrounding_text, report_point_change): Compute, narrow to and offset by the currently active field whenever point is updated or a command is received. (syms_of_textconv): Revise doc strings. * src/textconv.h (get_conversion_field): Export function.
* Prevent passwords from being recorded during text conversionPo Lu2024-03-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/commands.texi (Misc Events): Document new value of text-conversion-style. * java/org/gnu/emacs/EmacsService.java (EmacsService) <IC_MODE_PASSWORD>: New constant. * java/org/gnu/emacs/EmacsView.java (onCreateInputConnection): Set TYPE_TEXT_VARIATION_PASSWORD and IME_FLAG_FORCE_ASII if mode is IC_MODE_PASSWORD. * lisp/subr.el (read-passwd): Set text-conversion-style to `password'. * src/androidgui.h (enum android_ic_mode): New value ANDROID_IC_MODE_PASSWORD. * src/androidterm.c (android_reset_conversion): Handle `password'. * src/buffer.c (syms_of_buffer) <&BVAR (current_buffer, text_conversion_style)>: Update doc string. * src/textconv.c (syms_of_textconv) <Qpassword>: New DEFSYM. <Vtext_conversion_edits>: Fix typos in doc string.
* textconv.c: Fix warnings with-wide-intStefan Monnier2024-02-031-7/+3
| | | | | * src/textconv.c (set_composing_region, textconv_set_point_and_mark): Use `min/max`.
* Prefer C23 ckd_* to Gnulib *_WRAPV and *_OK macrosPaul Eggert2024-01-281-18/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c (android_make_lisp_symbol) [HAVE_ANDROID && !__clang__]: * src/android.c (android_blit_copy, android_blit_xor) (android_get_image): * src/androidmenu.c (android_menu_show): * src/androidselect.c (Fandroid_get_clipboard_data) (android_notifications_notify_1): * src/androidterm.c (android_decode_utf16) (android_text_to_string): * src/haiku_select.cc (be_display_notification): * src/sfnt.c (sfnt_read_cmap_format_8, sfnt_read_cmap_format_12) (sfnt_read_cmap_format_14, sfnt_read_cmap_table_1) (sfnt_expand_compound_glyph_context, sfnt_poly_edges_exact) (sfnt_read_meta_table, sfnt_read_ttc_header) (sfnt_read_cvt_table, sfnt_read_fpgm_table) (sfnt_read_prep_table, sfnt_make_interpreter) (sfnt_interpret_simple_glyph, sfnt_interpret_compound_glyph_2) (sfnt_interpret_compound_glyph, sfnt_read_default_uvs_table) (sfnt_read_nondefault_uvs_table, sfnt_create_uvs_context) (sfnt_read_fvar_table, sfnt_read_gvar_table) (sfnt_read_avar_table, sfnt_read_cvar_table): * src/sfntfont-android.c (GET_SCANLINE_BUFFER): * src/textconv.c (really_commit_text, really_set_composing_text) (really_replace_text, get_surrounding_text): Prefer C2x stdckdint.h macros to intprops.h macros.
* Revert "Add new `swap` macro and use it"Po Lu2024-01-061-7/+21
| | | | | | | typeof is an extension which does not exist in Standard C, so macros using it are unsuitable for inclusion in Emacs. This reverts commit 37889523278fe65733938fb11c3701898309961c.
* Add new `swap` macro and use itStefan Kangas2024-01-061-21/+7
| | | | | | | | | | | | | | | | | | | | | | | A `swap` macro prevents programming errors and is more concise. It is a natural addition to our existing `min` and `max` macros. * src/lisp.h (swap): New macro. * lwlib/xlwmenu.c (draw_shadow_rectangle, draw_shadow_rhombus): * src/androidterm.c (android_get_surrounding_text): * src/buffer.c (Fmake_overlay, modify_overlay, Fmove_overlay): * src/dispnew.c (swap_glyphs_in_rows, reverse_rows): * src/editfns.c (Finsert_buffer_substring) (Fcompare_buffer_substrings): * src/eval.c (run_hook_wrapped_funcall): * src/fns.c (extract_data_from_object): * src/regex-emacs.c (forall_firstchar_1): * src/textconv.c (textconv_query, get_extracted_text) (get_surrounding_text): * src/textprop.c (validate_interval_range) (verify_interval_modification): * src/w32uniscribe.c (OTF_INT16_VAL): * src/xfaces.c (load_face_colors): * src/xterm.c (SWAPCARD32): Prefer using above macro to open-coding.
* ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
|
* ; Fix typosStefan Kangas2023-12-101-3/+3
|
* Introduce an input method callback required by Android 34Po Lu2023-10-051-1/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * java/org/gnu/emacs/EmacsInputConnection.java (replaceText): New function. * java/org/gnu/emacs/EmacsNative.java (replaceText): Declare native function. * src/androidgui.h (enum android_ime_operation): New operation ANDROID_IME_REPLACE_TEXT. * src/androidterm.c (android_handle_ime_event): Decode text when encountering an ANDROID_IME_REPLACE_TEXT operation. Return if decoding overflowed rather than presenting Qnil to textconv functions. (replaceText): New JNI function. * src/frame.h (enum text_conversion_operation): New operation TEXTCONV_REPLACE_TEXT. * src/textconv.c (really_commit_text): Move point to start if the composing region is set. (really_replace_text): New function. (handle_pending_conversion_events_1) <TEXTCONV_REPLACE_TEXT>: New case. (replace_text): New function. * src/textconv.h: Update prototypes.
* ; Cleanup comments and doc strings in textconv.cEli Zaretskii2023-08-191-79/+83
| | | | | | | | | | | | | * src/textconv.c (copy_buffer_text): Rename from 'copy_buffer'. All callers changed. (textconv_query, complete_edit_check, commit_text) (finish_composing_text, set_composing_region) (textconv_set_point_and_mark, delete_surrounding_text) (request_point_update, textconv_barrier, get_extracted_text) (get_surrounding_text, report_point_change) (report_selected_window_change): Fix commentary. (Fset_text_conversion_style, text-conversion-edits) (overriding-text-conversion-style, text-conversion-face): Doc fix.
* ; * src/textconv.c (Fset_text_conversion_style): Fix typo.Po Lu2023-08-191-5/+5
|
* Disable text conversion within read-char-from-minibufferPo Lu2023-08-191-1/+4
| | | | | | | | | | | | * lisp/subr.el (read-char-from-minibuffer): Disable text conversion. (bug#65370) (y-or-n-p): Remove redundant binding of `override-text-conversion-style', given that read-key already disables text conversion. * src/textconv.c (Fset_text_conversion_style): Always reset text conversion for the selected frame in addition to any displaying current_buffer.
* Update Android portPo Lu2023-07-051-3/+86
| | | | | | | | | | | | | | | | | | | | | * doc/lispref/commands.texi (Misc Events): Correctly index `set-text-conversion-style'. * lisp/tool-bar.el (tool-bar-event-apply-alt-modifier) (tool-bar-event-apply-super-modifier) (tool-bar-event-apply-hyper-modifier) (tool-bar-event-apply-shift-modifier) (tool-bar-event-apply-control-modifier) (tool-bar-event-apply-meta-modifier): Pass t when restoring text conversion style. * src/keyboard.c (restore_reading_key_sequence): New function. (read_key_sequence): Set `reading_key_sequence' where necessary. * src/keyboard.h: Declare variable. * src/textconv.c (check_postponed_buffers): New function. (Fset_text_conversion_style): New argument. If set, and a key sequence is being read, postpone resetting the IME until the key sequence is read. (syms_of_textconv): Clear new variable and add staticpro. * src/textconv.h: Update prototypes.
* Update Android portPo Lu2023-06-111-6/+6
| | | | | | | | | * java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView): Document member variables. (onDraw): Use separate Paint object on the UI thread. * src/textconv.c (really_commit_text, really_set_composing_text) (really_delete_surrounding_text): Run modification hooks when deleting text.
* Inherit surrounding text properties when inserting conversion textPo Lu2023-06-101-4/+21
| | | | | | | * src/textconv.c (really_commit_text) (really_set_composing_text): Improve behavior of certain fontification mechanisms by inheriting text properties from surrounding text.
* ; Fix typosPo Lu2023-06-091-2/+2
| | | | | * src/textconv.c (really_commit_text): (handle_pending_conversion_events): Fix minor typos.
* Avoid responding to input method queries asynchronouslyPo Lu2023-06-091-0/+43
| | | | | | | | | | | | * src/androidterm.c (handle_one_android_event): Don't answer queries here; just rely on the event interrupting android_select. This avoids exposing buffer contents to input methods while a command is being executed. * src/textconv.c (TEXTCONV_DEBUG, really_commit_text) (really_finish_composing_text, really_set_composing_text) (really_set_composing_region, really_delete_surrounding_text) (really_set_point_and_mark, get_extracted_text): Add debugging printouts.
* Update Android portPo Lu2023-06-071-0/+100
| | | | | | | | | | | | | | | | | | | | | | | | * java/org/gnu/emacs/EmacsInputConnection.java (beginBatchEdit) (endBatchEdit, commitCompletion, commitText, deleteSurroundingText) (finishComposingText, getSelectedText, getTextAfterCursor) (getTextBeforeCursor, setComposingText, setComposingRegion) (performEditorAction, performContextMenuAction, getExtractedText) (setSelection, sendKeyEvent, deleteSurroundingTextInCodePoints) (requestCursorUpdates): Ensure that the input connection is up to date. (getSurroundingText): New function. * java/org/gnu/emacs/EmacsNative.java (getSurroundingText): Export new C function. * java/org/gnu/emacs/EmacsService.java (resetIC): Invalidate previously created input connections. * java/org/gnu/emacs/EmacsView.java (EmacsView) (onCreateInputConnection): Signify that input connections are now up to date. * src/androidterm.c (struct android_get_surrounding_text_context): New structure. (android_get_surrounding_text, NATIVE_NAME): * src/textconv.c (get_surrounding_text): * src/textconv.h: New functions.
* Improve undo behavior on AndroidPo Lu2023-06-061-17/+14
| | | | | | | | | | | | * lisp/simple.el (undo-auto-amalgamate): Update doc string to describe new amalgamating commands. (analyze-text-conversion): Make this an amalgamating command by default, unless a new line has been inserted. Also, shorten the undo boundary timer. * src/textconv.c (really_commit_text) (really_set_composing_text): Correctly report ephemeral deletions. (syms_of_textconv): Fix doc strings.
* Behave correctly when IMEs commit or compose text with active markPo Lu2023-06-031-25/+79
| | | | | | | * src/textconv.c (really_commit_text) (really_set_composing_text): Delete text between mark and point if the mark is active. Don't record changes if the text is empty.
* Update Android portPo Lu2023-06-031-4/+9
| | | | | | | | | | | | | * src/androidterm.c (struct android_get_extracted_text_context): New field `mark_active'. (android_get_extracted_text): Set that field. (struct android_extracted_text_class): New field `flags'. (android_build_extracted_text): New argument `mark_active'. Set flags appropriately. (NATIVE_NAME, android_update_selection): Likewise. * src/textconv.c (get_extracted_text): New argument `mark_active'. Set it if the mark is active. * src/textconv.h: Update prototypes.
* Update Android portPo Lu2023-06-021-6/+54
| | | | | | | | | | | | | | | | | | * java/org/gnu/emacs/EmacsInputConnection.java (EmacsInputConnection): Apply workarounds on Vivo devices as well. * src/android.c (sendKeyPress, sendKeyRelease): Clear counter. * src/androidgui.h (struct android_key_event): New field `counter'. * src/androidterm.c (handle_one_android_event): Generate barriers as appropriate. (JNICALL): Set `counter'. * src/frame.h (enum text_conversion_operation): * src/textconv.c (detect_conversion_events) (really_set_composing_text, handle_pending_conversion_events_1) (handle_pending_conversion_events, textconv_barrier): * src/textconv.h: Implement text conversion barriers and fix various typos.
* Update Android portPo Lu2023-06-011-7/+16
| | | | | | | | | | | | | | | | | * java/org/gnu/emacs/EmacsInputConnection.java (EmacsInputConnection, performContextMenuAction): New function. * java/org/gnu/emacs/EmacsNative.java (EmacsNative) (performContextMenuAction): New function. * src/android.c (android_get_gc_values): Implement more efficiently. * src/androidterm.c (android_handle_ime_event): Pass through `update' argument to `finish_composing_text'. Fix thinko. * src/textconv.c (really_finish_composing_text) (really_set_composing_text, really_set_composing_region) (handle_pending_conversion_events_1, finish_composing_text): New argument `update'. Notify IME of conversion region changes if set. * src/textconv.h: Update structs and prototypes.
* Correctly report start and end in extracted textPo Lu2023-06-011-7/+17
| | | | | | | | | | | * src/androidterm.c (struct android_get_extracted_text_context): New field `start_offset' and `end_offset'. Delete `offset'. (android_get_extracted_text, android_build_extracted_text): Replace `offset' with new args `start_offset' and `end_offset'. (NATIVE_NAME): Set `start_offset' and `end_offset'. (android_update_selection): Likewise. * src/textconv.c (get_extracted_text): Likewise. * src/textconv.h: Update prototypes.
* Fix build with Lisp_Object type checkingPo Lu2023-05-311-1/+2
| | | | | | | | | | | | | | | | * configure.ac: Pass through `--enable-check-lisp-object-type' on Android. * src/alloc.c (android_make_lisp_symbol): * src/android.c: * src/androidfns.c (android_set_no_focus_on_map) (android_set_no_accept_focus): * src/androidfont.c (androidfont_match, androidfont_open_font): * src/androidselect.c (Fandroid_get_clipboard) (Fandroid_get_clipboard_targets): * src/keyboard.c (make_lispy_event, syms_of_keyboard): * src/sfntfont.c (sfnt_enum_font_1, sfntfont_list_1): * src/textconv.c (really_set_point_and_mark): Fix Lisp_Object and integer screw-ups.
* Update Android portPo Lu2023-05-311-0/+6
| | | | | | | | | | | | | | | | | | | | | * java/debug.sh (is_root): Go back to using unix sockets; allow adb to forward them correctly. * java/org/gnu/emacs/EmacsInputConnection.java (getExtractedText): Don't print text if NULL. * java/org/gnu/emacs/EmacsService.java (EmacsService): New field `imSyncInProgress'. (updateIC): If an IM sync might be in progress, avoid deadlocks. * java/org/gnu/emacs/EmacsView.java (onCreateInputConnection): Set `imSyncInProgress' across synchronization point. * src/android.c (android_check_query): Use __atomic_store_n. (android_answer_query): New function. (android_begin_query): Set `android_servicing_query' to 2. Check once, and don't spin waiting for query to complete. (android_end_query): Use __atomic_store_n. (android_run_in_emacs_thread): Compare-and-exchange flag. If originally 1, fail. * src/textconv.c (really_set_composing_text): Clear conversion region if text is empty.
* Merge remote-tracking branch 'origin/master' into feature/androidPo Lu2023-05-181-3/+3
|\
| * Prefer C23 ckd_* to Gnulib *_WRAPV macrosPaul Eggert2023-05-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C23 has added ckd_add etc. macros with functionality equivalent to the older Gnulib INT_ADD_WRAPV macros, so switch to the more-standard names. * admin/merge-gnulib (GNULIB_MODULES): Add stdckdint. This merely makes the dependency explicit, as we were already using this Gnulib module indirectly. * lib-src/etags.c, src/lisp.h: Include stdckdint.h. * lib-src/etags.c (xnmalloc, xnrealloc): * src/alloc.c (xnmalloc, xnrealloc, xpalloc, Fmake_string) (mark_memory): * src/bignum.c (emacs_mpz_pow_ui): * src/buffer.c (record_overlay_string, overlay_strings): * src/bytecode.c (exec_byte_code): * src/casefiddle.c (do_casify_multibyte_string): * src/ccl.c (ccl_driver, Fccl_execute_on_string): * src/character.c (char_width, c_string_width) (lisp_string_width, count_size_as_multibyte) (string_escape_byte8): * src/cmds.c (internal_self_insert): * src/coding.c (coding_alloc_by_realloc, produce_chars): * src/data.c (arith_driver): * src/dispnew.c (realloc_glyph_pool, init_display_interactive): * src/doprnt.c (parse_format_integer): * src/editfns.c (Freplace_buffer_contents, str2num) (styled_format): * src/emacs-module.c (module_global_reference_p) (module_make_global_ref, module_funcall): * src/eval.c (max_ensure_room): * src/fileio.c (blocks_to_bytes): * src/fns.c (Ffillarray): * src/font.c (font_intern_prop): * src/frame.c (check_frame_pixels): * src/gnutls.c (gnutls_hex_string, gnutls_symmetric_aead): * src/gtkutil.c (get_utf8_string): * src/haikuterm.c (haiku_term_init): * src/image.c (xbm_scan, image_to_emacs_colors) (image_detect_edges, png_load_body): * src/keyboard.c (Frecursion_depth): * src/keymap.c (Flookup_key, Fkey_description): * src/lisp.h (modiff_incr, SAFE_ALLOCA_LISP_EXTRA): * src/lread.c (read_bool_vector): * src/pgtkterm.c (pgtk_term_init): * src/regex-emacs.c (regex_compile): * src/term.c (encode_terminal_code): * src/termcap.c (tputs): * src/textconv.c (textconv_query): * src/timefns.c (timespec_ticks, lisp_time_hz_ticks) (Fdecode_time, check_tm_member): * src/tparam.c (tparam1): * src/w32term.c (w32_initialize_display_info): * src/xdisp.c (fill_column_indicator_column, decode_mode_spec): * src/xselect.c (selection_data_size, x_property_data_to_lisp): * src/xsmfns.c (smc_save_yourself_CB): * src/xterm.c (xm_setup_dnd_targets, x_sync_get_monotonic_time) (x_sync_current_monotonic_time, x_sync_note_frame_times) (x_display_set_last_user_time, x_term_init): Prefer the C23 stdckdint macros to their Gnulib intprops.h counterparts, since C23 is standard.
* | Update Android portPo Lu2023-05-061-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | * cross/verbose.mk.android: Get rid of badly aligned ANDROID_CC messages. * java/org/gnu/emacs/EmacsInputConnection.java (syncAfterCommit) (extractAbsoluteOffsets): Add workarounds for several kinds of machines. (commitText, getExtractedText): Likewise. * src/textconv.c (really_commit_text): Improve definition of POSITION. (get_extracted_text): Default to providing at least 4 characters.
* | Update Android portPo Lu2023-03-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac: Add support for HarfBuzz on Android. * java/INSTALL: Document where to get Emacs with HarfBuzz. * lisp/subr.el (overriding-text-conversion-style, y-or-n-p): Correctly set text conversion style if y-or-n-p is called inside the minibuffer. * src/sfnt.c (sfnt_read_cmap_format_8) (sfnt_read_cmap_format_12): Fix typos. (sfnt_read_24, sfnt_read_cmap_format_14): New function. (sfnt_read_cmap_table_1, sfnt_read_cmap_table): Handle format 14 cmap tables. (sfnt_read_default_uvs_table, sfnt_read_nondefault_uvs_table) (sfnt_compare_table_offsets, sfnt_create_uvs_context) (sfnt_free_uvs_context, sfnt_compare_uvs_mapping) (sfnt_variation_glyph_for_char, sfnt_map_table, sfnt_unmap_table) (sfnt_read_table, sfnt_test_uvs): New functions. (main): Add UVS tests. * src/sfnt.h (struct sfnt_cmap_format_14) (struct sfnt_variation_selector_record) (struct sfnt_default_uvs_table, struct sfnt_unicode_value_range) (struct sfnt_nondefault_uvs_table, struct sfnt_uvs_mapping) (struct sfnt_mapped_variation_selector_record) (struct sfnt_table_offset_rec, struct sfnt_uvs_context) (struct sfnt_mapped_table): New structures. Update prototypes. * src/sfntfont-android.c (android_sfntfont_driver): Register HarfBuzz callbacks where required. * src/sfntfont.c (sfntfont_select_cmap): Look for a format 14 table. Save it in new arg FORMAT14. (sfntfont_read_cmap): Adjust accordingly. (struct sfnt_font_info): New field `uvs'. New fields `hb_font', `fd' and `directory'. (sfntfont_open): Open uvs context. Under HarfBuzz, don't close the fd or subtable, but save them in the font info instead. (sfntfont_close): Free UVS context. Close font fd and table directory and HarfBuzz font. (sfntfont_draw): Handle case where s->padding_p. (sfntfont_get_variation_glyphs): New function. (sfntfont_unmap_blob, sfntfont_get_font_table) (sfntfont_begin_hb_font): New functions. * src/sfntfont.h: Update prototypes. * src/textconv.c (Fset_text_conversion_style): Fix doc string.
* | Update Android portPo Lu2023-03-151-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/commands.texi (Misc Events): Document variable `disable-inhibit-text-conversion'. * java/org/gnu/emacs/EmacsDialog.java (display1): Try an activity that is certain to be focused first. * lisp/touch-screen.el (touch-screen-track-tap) (touch-screen-track-drag): Bind `disable-inhibit-text-conversion'. * src/keyboard.c (read_key_sequence): Only disable text conversion if an actual function or numeric key is found in the key sequence. (syms_of_keyboard): New variable `disable-inhibit-text-conversion'. * src/lread.c (read_filtered_event): Check new variable. * src/textconv.c (textconv_query): Remove unused label.
* | Update Android portPo Lu2023-03-141-34/+0
| | | | | | | | | | | | | | | | | | | | * java/org/gnu/emacs/EmacsWindow.java (figureChange): Detect mice on up events as well. (onSomeKindOfMotionEvent): Work past framework bug. * src/androidterm.c (android_perform_conversion_query): * src/textconv.c (textconv_query): * src/textconv.h (TEXTCONV_SKIP_ACTIVE_REGION): Remove unused code.
* | Update Android portPo Lu2023-03-121-3/+33
| | | | | | | | | | | | | | | | | | | | * src/androidterm.c (NATIVE_NAME, JNICALL) (android_build_extracted_text, android_update_selection): Use 0-based indices for Android buffer positions. Also, report surrounding text relative to the region, not to the cursor. * src/textconv.c (textconv_query): Accept new values of position. (really_set_composing_text): Use ephemeral last point.
* | ; * textconv.c: Remove out-of-date comment.Po Lu2023-03-091-6/+2
| |
* | Update Android portPo Lu2023-03-061-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * java/org/gnu/emacs/EmacsNative.java (EmacsNative): New function requestSelectionUpdate. * java/org/gnu/emacs/EmacsView.java (onCreateInputConnection): Call it instead of losing if getting the current selection fails. * src/android-asset.h (AAsset_seek): Define stub. * src/android.c (android_open): Take mode_t. (android_open_asset, android_close_asset, android_asset_read_quit) (android_asset_read, android_asset_lseek, android_asset_fstat): New functions. * src/android.h (struct android_fd_or_asset): Update prototypes. * src/androidgui.h (enum android_ime_operation): Add new operation to update the selection position. * src/androidterm.c (android_handle_ime_event): Handle new operation. (requestSelectionUpdate): New function. * src/fileio.c (close_file_unwind_emacs_fd): New function. (Fcopy_file, union read_non_regular, read_non_regular) (Finsert_file_contents): Use optimized codepath to insert Android asset files. * src/frame.h (enum text_conversion_operation): New operation. * src/textconv.c (really_request_point_update) (handle_pending_conversion_events_1, request_point_update): New functions. * src/textconv.h: Update prototypes.
* | Update Android portPo Lu2023-03-031-10/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * java/org/gnu/emacs/EmacsActivity.java (EmacsActivity) (onCreate): Add view tree observer. (onGlobalLayout): Sync fullscreen state. (syncFullscreenWith): Improve visibility flag setting. * src/textconv.c (select_window): New function. (textconv_query): (restore_selected_window): (really_commit_text): (really_set_composing_text): (really_set_composing_region): (really_delete_surrounding_text): (really_set_point_and_mark): (get_extracted_text): Call it instead of Fselect_window to avoid selecting the mini window if it is no longer active.
* | Update Android portPo Lu2023-02-261-9/+29
| | | | | | | | | | | | | | | | | | | | | | | | * doc/lispref/commands.texi (Misc Events): Update documentation. * java/org/gnu/emacs/EmacsService.java (EmacsService) (onStartCommand): Improve notification message. * src/android.c (android_hack_asset_fd): Detect if ashmem is available dynamically. (android_detect_ashmem): New function. * src/textconv.c (record_buffer_change): Use markers to represent BEG and END instead. (syms_of_textconv): Update doc string.
* | Update Android portPo Lu2023-02-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | * doc/emacs/input.texi (On-Screen Keyboards): Document changes to text conversion. * java/org/gnu/emacs/EmacsInputConnection.java (getExtractedText) (EmacsInputConnection): * src/keyboard.c (read_key_sequence): Disable text conversion after reading prefix key. * src/textconv.c (get_extracted_text): Fix returned value when request length is zero.
* | Update Android portPo Lu2023-02-181-17/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/emacs/input.texi (On-Screen Keyboards): Document `touch-screen-always-display'. * doc/lispref/commands.texi (Misc Events): Improve documentation of text conversion events. * java/org/gnu/emacs/EmacsDialog.java (toAlertDialog, display1): Reorder buttons to make more sense. * lisp/elec-pair.el (electric-pair-analyze-conversion): New function. * lisp/simple.el (analyze-text-conversion): Improve integration with electric pair modes. * lisp/term.el (term-mode): Always display the onscreen keyboard. * lisp/touch-screen.el (touch-screen-display-keyboard) (touch-screen-handle-point-up): Respect new options. * src/textconv.c (really_set_composing_text): Stop widenining unnecessarily. (really_delete_surrounding_text): Really delete surrounding text. Give text conversion analyzers the buffer text. (syms_of_textconv): Update doc string.
* | Notify input methods when editing failsPo Lu2023-02-181-0/+57
| | | | | | | | | | | | | | | | | | | | * INSTALL.android: Clarify build instructions. * src/textconv.c (struct complete_edit_check_context): New structure. (complete_edit_check): New function. (handle_pending_conversion_events_1): If the window is known, then ensure that any editing failures are reported to the input method.
* | Work around race condition bug in Android 13's input managerPo Lu2023-02-171-0/+13
| | | | | | | | | | | | | | * src/androidterm.c (android_get_selection): Use ephemeral last point. * src/textconv.c (report_selected_window_change): Set w->ephemeral_last_point to the window's point now.
* | Fix build and running on Android 2.2Po Lu2023-02-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * INSTALL.android: Document that Android 2.2 is now supported, with caveats. * configure.ac (ANDROID_MIN_SDK, ANDROID_SDK_18_OR_EARLIER) (SYSTEM_TYPE, ANDROID_STUBIFY, SIZEOF_LONG): Correctly detect things missing on Android 2.2. * java/Makefile.in (ANDROID_JAR, JARSIGNER_FLAGS): * java/debug.sh (jdb, gdbserver, line): * java/org/gnu/emacs/EmacsApplication.java (findDumpFile): * java/org/gnu/emacs/EmacsService.java (onCreate): * java/org/gnu/emacs/EmacsThread.java (EmacsThread, run): Run parameter initialization on main thread. * src/android-asset.h (struct android_asset_manager) (struct android_asset, AAssetManager_fromJava, AAssetManager_open) (AAsset_close, android_asset_create_stream) (android_asset_read_internal, AAsset_openFileDescriptor) (AAsset_getLength, AAsset_getBuffer, AAsset_read): New file. * src/android.c (android_user_full_name, android_hack_asset_fd) (android_check_compressed_file): Implement for Android 2.2. * src/process.c (Fprocess_send_eof): Don't call tcdrain if unavailable. * src/sfntfont-android.c (system_font_directories): Fix compiler warning. * src/sfntfont.c (sfntfont_read_cmap): Correctly test rc of emacs_open. * src/textconv.c (handle_pending_conversion_events_1): Mark buffer UNINIT.
* | Update Android portPo Lu2023-02-161-21/+213
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/emacs/android.texi (Android Fonts): * doc/emacs/input.texi (On-Screen Keyboards): * doc/lispref/commands.texi (Misc Events): Update documentation. * java/org/gnu/emacs/EmacsInputConnection.java (setSelection): New function. * java/org/gnu/emacs/EmacsSurfaceView.java (EmacsSurfaceView) (reconfigureFrontBuffer): Make bitmap references weak references. * java/org/gnu/emacs/EmacsView.java (handleDirtyBitmap): Don't clear surfaceView bitmap. * lisp/comint.el (comint-mode): * lisp/international/fontset.el (script-representative-chars) (setup-default-fontset): Improve detection of CJK fonts. * lisp/isearch.el (set-text-conversion-style): New variable. (isearch-mode, isearch-done): Save and restore the text conversion style. * lisp/minibuffer.el (minibuffer-mode): Set an appropriate text conversion style. * lisp/simple.el (analyze-text-conversion): Run post-self-insert-hook properly. * lisp/subr.el (read-char-from-minibuffer): Disable text conversion when reading character. * src/androidterm.c (show_back_buffer): Don't check that F is not garbaged. (android_update_selection, android_reset_conversion): Use the ephemeral last point and handle text conversion being disabled. * src/buffer.c (syms_of_buffer): Convert old style DEFVAR. * src/keyboard.c (kbd_buffer_get_event): Handle text conversion first. * src/lisp.h: Update prototypes. * src/lread.c (read_filtered_event): Temporarily disable text conversion. * src/sfnt.c (sfnt_decompose_glyph_1, sfnt_decompose_glyph_2): New functions. (sfnt_decompose_glyph, sfnt_decompose_instructed_outline): Refactor contour decomposition to those two functions. (main): Update tests. * src/sfntfont-android.c (system_font_directories): Add empty field. (Fandroid_enumerate_fonts, init_sfntfont_android): Enumerate fonts in a user fonts directory. * src/sfntfont.c (struct sfnt_font_desc): New field `num_glyphs'. (sfnt_enum_font_1): Set num_glyphs and avoid duplicate fonts. (sfntfont_glyph_valid): New function. (sfntfont_lookup_char, sfntfont_list_1): Make sure glyphs found are valid. * src/textconv.c (sync_overlay, really_commit_text) (really_set_composing_text, really_set_composing_region) (really_delete_surrounding_text, really_set_point_and_mark) (handle_pending_conversion_events_1) (handle_pending_conversion_events, conversion_disabled_p) (disable_text_conversion, resume_text_conversion) (Fset_text_conversion_style, syms_of_textconv): Update to respect new options. * src/textconv.h: * src/window.h (GCALIGNED_STRUCT): New field `ephemeral_last_point'. * src/xdisp.c (mark_window_display_accurate_1): Set it.
* | Update Android portPo Lu2023-02-151-26/+289
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/emacs/input.texi (On-Screen Keyboards): * doc/lispref/commands.texi (Misc Events): Improve documentation of text conversion stuff. * java/org/gnu/emacs/EmacsInputConnection.java (beginBatchEdit) (endBatchEdit, commitCompletion, commitText, deleteSurroundingText) (finishComposingText, getSelectedText, getTextAfterCursor) (EmacsInputConnection, setComposingRegion, performEditorAction) (getExtractedText): Condition debug code on DEBUG_IC. * java/org/gnu/emacs/EmacsService.java (EmacsService, updateIC): Likewise. * lisp/bindings.el (global-map): * lisp/electric.el (global-map): Make `text-conversion' `analyze-text-conversion'. * lisp/progmodes/prog-mode.el (prog-mode): Enable text conversion in input methods. * lisp/simple.el (analyze-text-conversion): New function. * lisp/textmodes/text-mode.el (text-conversion-style) (text-mode): Likewise. * src/androidterm.c (android_handle_ime_event): Handle set_point_and_mark. (android_sync_edit): Give Emacs 100 ms instead. (android_perform_conversion_query): Skip the active region, not the conversion region. (getSelectedText): Implement properly. (android_update_selection): Expose mark to input methods. (android_reset_conversion): Handle `text-conversion-style'. * src/buffer.c (init_buffer_once, syms_of_buffer): Add buffer local variable `text-conversion-style'. * src/buffer.h (struct buffer, bset_text_conversion_style): New fields. * src/emacs.c (android_emacs_init): Call syms_of_textconv. * src/frame.h (enum text_conversion_operation): Rename TEXTCONV_SET_POINT. * src/lisp.h: Export syms_of_textconv. * src/marker.c (set_marker_internal): Force redisplay when the mark is set and the buffer is visible on builds that use text conversion. Explain why. * src/textconv.c (copy_buffer): Fix copying past gap. (get_mark): New function. (textconv_query): Implement new flag. (sync_overlay): New function. Display conversion text in an overlay. (record_buffer_change, really_commit_text) (really_set_composing_text, really_set_composing_region) (really_delete_surrounding_text, really_set_point) (handle_pending_conversion_events_1, decrement_inside) (handle_pending_conversion_events, textconv_set_point) (get_extracted_text, register_textconv_interface): Various fixes and improvements. * src/textconv.h (struct textconv_interface): Update documentation. * src/window.h (GCALIGNED_STRUCT): New field `prev_mark'. * src/xdisp.c (mark_window_display_accurate_1): Handle prev_mark.
* | Fix small bugsPo Lu2023-02-151-3/+16
| | | | | | | | | | | | | | | | * src/androidterm.c (android_handle_ime_event): Pacify compiler warnings. * src/textconv.c (really_set_composing_text) (handle_pending_conversion_events, get_extracted_text): Fix reentrancy problems and uses of uninitialized values.
* | Update Android portPo Lu2023-02-151-6/+900
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (HAVE_TEXT_CONVERSION): Define on Android. * doc/emacs/input.texi (On-Screen Keyboards): Document ``text conversion'' slightly. * doc/lispref/commands.texi (Misc Events): Document new `text-conversion' event. * java/org/gnu/emacs/EmacsContextMenu.java (display): Use `syncRunnable'. * java/org/gnu/emacs/EmacsDialog.java (display): Likewise. * java/org/gnu/emacs/EmacsEditable.java: Delete file. * java/org/gnu/emacs/EmacsInputConnection.java (EmacsInputConnection): Reimplement from scratch. * java/org/gnu/emacs/EmacsNative.java (EmacsNative): Add new functions. * java/org/gnu/emacs/EmacsService.java (EmacsService, getEmacsView) (getLocationOnScreen, sync, getClipboardManager, restartEmacs): Use syncRunnable. (syncRunnable): New function. (updateIC, resetIC): New functions. * java/org/gnu/emacs/EmacsView.java (EmacsView): New field `inputConnection' and `icMode'. (onCreateInputConnection): Update accordingly. (setICMode, getICMode): New functions. * lisp/bindings.el (global-map): Ignore text conversion events. * src/alloc.c (mark_frame): Mark text conversion data. * src/android.c (struct android_emacs_service): New fields `update_ic' and `reset_ic'. (event_serial): Export. (android_query_sem): New function. (android_init_events): Initialize new semaphore. (android_write_event): Export. (android_select): Check for UI thread code. (setEmacsParams, android_init_emacs_service): Initialize new methods. (android_check_query, android_begin_query, android_end_query) (android_run_in_emacs_thread): (android_update_ic, android_reset_ic): New functions for managing synchronous queries from one thread to another. * src/android.h: Export new functions. * src/androidgui.h (enum android_event_type): Add input method events. (enum android_ime_operation, struct android_ime_event) (union android_event, enum android_ic_mode): New structs and enums. * src/androidterm.c (android_window_to_frame): Allow DPYINFO to be NULL. (android_decode_utf16, android_handle_ime_event) (handle_one_android_event, android_sync_edit) (android_copy_java_string, beginBatchEdit, endBatchEdit) (commitCompletion, deleteSurroundingText, finishComposingText) (getSelectedtext, getTextAfterCursor, getTextBeforeCursor) (setComposingText, setComposingRegion, setSelection, getSelection) (performEditorAction, getExtractedText): New functions. (struct android_conversion_query_context): (android_perform_conversion_query): (android_text_to_string): (struct android_get_selection_context): (android_get_selection): (struct android_get_extracted_text_context): (android_get_extracted_text): (struct android_extracted_text_request_class): (struct android_extracted_text_class): (android_update_selection): (android_reset_conversion): (android_set_point): (android_compose_region_changed): (android_notify_conversion): (text_conversion_interface): New functions and structures. (android_term_init): Initialize text conversion. * src/coding.c (syms_of_coding): Define Qutf_16le on Android. * src/frame.c (make_frame): Clear conversion data. (delete_frame): Reset conversion state. * src/frame.h (enum text_conversion_operation) (struct text_conversion_action, struct text_conversion_state) (GCALIGNED_STRUCT): Update structures. * src/keyboard.c (read_char, readable_events, kbd_buffer_get_event) (syms_of_keyboard): Handle text conversion events. * src/lisp.h: * src/process.c: Fix includes. * src/textconv.c (enum textconv_batch_edit_flags, textconv_query) (reset_frame_state, detect_conversion_events) (restore_selected_window, really_commit_text) (really_finish_composing_text, really_set_composing_text) (really_set_composing_region, really_delete_surrounding_text) (really_set_point, complete_edit) (handle_pending_conversion_events_1) (handle_pending_conversion_events, start_batch_edit) (end_batch_edit, commit_text, finish_composing_text) (set_composing_text, set_composing_region, textconv_set_point) (delete_surrounding_text, get_extracted_text) (report_selected_window_change, report_point_change) (register_texconv_interface): New functions. * src/textconv.h (struct textconv_interface) (TEXTCONV_SKIP_CONVERSION_REGION): Update prototype. * src/xdisp.c (mark_window_display_accurate_1): * src/xfns.c (xic_string_conversion_callback): * src/xterm.c (init_xterm): Adjust accordingly.