1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-14 15:30:29 -08:00
Commit graph

46901 commits

Author SHA1 Message Date
Eli Zaretskii
72278f21e0 ; Clarify doc string of 'long-line-threshold'
* src/buffer.c (syms_of_buffer) <long-line-threshold>: Clarify the
doc string.
2022-07-21 15:59:50 +03:00
Gregory Heytings
616da8fa8e Merge branch 'feature/fix-the-long-lines-display-bug' 2022-07-21 12:37:45 +02:00
Eli Zaretskii
51f8e86374 Update buffer's chars-modified tick when inserting from gap
* src/insdel.c (insert_from_gap): Update buffer's chars-modified
tick.  (Bug#56393)

* test/src/buffer-tests.el (test-buffer-chars-modified-ticks): New
test.
2022-07-21 12:40:28 +03:00
Po Lu
a29a3ad55d Apply tooltip assertions to all instances of x-show-tip
* src/haikufns.c (Fx_show_tip):
(syms_of_haikufns):
* src/nsfns.m (Fx_show_tip):
(syms_of_nsfns):
* src/pgtkfns.c (Fx_show_tip):
(syms_of_pgtkfns):
* src/xfns.c (Fx_show_tip):
(syms_of_xfns): Add assertion and adjust default values.
2022-07-21 16:26:50 +08:00
Eli Zaretskii
46052d1dcb Make sure we don't unknowingly truncate tooltip text
* src/w32fns.c (Fx_show_tip): Add assertion when the default
tooltip dimension limits are insufficient.  (Bug#56561)
2022-07-21 10:12:03 +03:00
Po Lu
50ff15bb8a Avoid wasting bandwidth to set user time
* src/xterm.c (x_display_set_last_user_time): Don't change the
user time property if nothing actually changed.
2022-07-21 14:55:19 +08:00
Po Lu
a641f55559 Improve handling screen resizes when built without RandR
* src/xterm.c (handle_one_xevent): Update DND tooltip position
upon ConfigureNotify for root window.
2022-07-21 09:39:24 +08:00
Gregory Heytings
e09c056a44 * src/xdisp.c (redisplay_window): Small optimization. 2022-07-20 21:54:39 +02:00
Eli Zaretskii
cec248ec31 ; * src/data.c (Fash): Improve wording of the doc string. 2022-07-20 22:03:45 +03:00
Gregory Heytings
c7eef61eee Further tweaks to long lines handling.
* src/xdisp.c (redisplay_window): Increase the threshold above which
long lines detection is performed in the buffer.  This should avoid
triggering that detection for most simple editing operations.

* src/lisp.h (modiff_incr): Explain why the counter is incremented
logarithmically.

* src/buffer.h (struct buffer_text): Adapt the comment about the
'modiff' field accordingly.

* src/buffer.c (modify_overlay): Increase the counter by 1 instead of
the size of the buffer section on which the overlay is placed.

* etc/NEWS: Small improvement.
2022-07-20 19:14:41 +02:00
Po Lu
83753d05eb Implement wheel movement during DND on Haiku
* lisp/term/haiku-win.el (haiku-dnd-wheel-count): New defvar.
(haiku-note-wheel-click, haiku-handle-drag-wheel): New
functions.

* src/haiku_support.cc (EmacsWindow): Get rid of window ID
logic.
(MessageReceived, MouseMoved, be_drag_message): Use thread ID to
identify windows instead of window ID.

* src/haikuselect.c (Fhaiku_drag_message): Record whether or not
the DND frame is a valid drop target.
(haiku_note_drag_wheel): New function.
(syms_of_haikuselect): New defvar.

* src/haikuterm.c (haiku_read_socket): Call
`haiku_note_drag_wheel' when appropriate.
* src/haikuterm.h: Update prototypes.
2022-07-20 07:37:41 +00:00
Po Lu
ffd38a9911 Fix setting user time upon scrolling self during DND
* src/xterm.c (handle_one_xevent): Set user time for emulated
scroll wheel events if Emacs ends up scrolled during DND.
2022-07-20 09:41:43 +08:00
Gregory Heytings
7c0fc85364 Simplified and improved heuristic for long lines detection.
* src/lisp.h (modiff_incr): Add a parameter to 'modiff_incr' to record
the extent of the modification.

* src/insdel.c (insert_1_both, insert_from_string_1, insert_from_gap,
insert_from_buffer_1, adjust_after_replace, replace_range,
replace_range_2, del_range_2, modify_text): Add an argument to each
call to 'modiff_incr'.

* src/textprop.c (modify_text_properties): Add an argument to the call
to 'modiff_incr'.

* src/buffer.c (Frestore_buffer_modified_p, Fbuffer_swap_text,
modify_overlay): Add an argument to each call to 'modiff_incr'.

* src/xdisp.c (redisplay_window): Use the improved version of 'MODIFF'
for the heuristic.
2022-07-19 23:34:09 +02:00
Gregory Heytings
c6bee17075 Revert commits 1ff69cc744 and 9a894206f6. 2022-07-19 23:30:17 +02:00
Gregory Heytings
9a894206f6 Improve the heuristic for long lines detection again.
* src/xdisp.c (redisplay_window): Improve the heuristic again.
2022-07-19 15:35:14 +02:00
Mattias Engdegård
ac1d15e95c ; * src/data.c (Fash): More precise doc string 2022-07-19 15:21:56 +02:00
Stefan Kangas
4b807380cf Merge from origin/emacs-28
282dde887d ; Fix typo missed in previous change
62c47ffd5f ; * lisp/net/tramp-crypt.el: Improve commentary
cba30431ff Merge branch 'emacs-28' of git.savannah.gnu.org:/srv/git/e...
8f9993bb3f ; * src/buffer.c (syms_of_buffer) <mode-line-format>: Doc ...
fec4bb89f9 ; Fix typos (Bug#56550)
2022-07-19 06:30:56 +02:00
Po Lu
6692df0279 Fix timestamp specified in wheel movement XDND events
* src/xterm.c (handle_one_xevent): Use the time of the wheel
event in XDND events sent in response to wheel movement.
2022-07-19 09:41:36 +08:00
Po Lu
bcbd06b4bb Make drag-and-drop wheel movement work locally too on X
This is provided by the XDND protocol, so it isn't fair for it
to not work with local drag-and-drop.

* lisp/x-dnd.el (x-dnd-note-wheel-movement): New function.  Set
it as the `x-dnd-wheel-function'.
* src/xterm.c (x_dnd_cleanup_drag_and_drop): Clear new flags.
(x_dnd_note_self_wheel): New function.  Set some flags.
(x_dnd_process_quit, x_dnd_begin_drag_and_drop, handle_one_xevent)
(x_connection_closed, x_delete_terminal, mark_xterm): Handle and
set new wheel movement flags
(syms_of_xterm): New variable `x-dnd-wheel-function'.
2022-07-19 09:33:09 +08:00
Eli Zaretskii
7dcea5a428 * src/xdisp.c (set_vertical_scroll_bar): Remove stale comment. 2022-07-18 22:51:25 +02:00
Eli Zaretskii
0699f80f85 Fix calculation of the vertical scroll bar's thumb
* src/xdisp.c (set_vertical_scroll_bar): Compute window's end
position "by hand" if w->window_end_pos cannot be relied upon.
2022-07-18 22:49:20 +02:00
Gregory Heytings
1ff69cc744 Improve the heuristic for long lines detection.
* src/buffer.h (struct buffer_text): New 'unchanged_size' field.
(BUF_UNCHANGED_SIZE): New macro to access the field.

* src/buffer.c (Fget_buffer_create): Initialize the field.
(Fbuffer_swap_text): Handle it.

* src/xdisp.c (mark_window_display_accurate_1): Set the field.
(redisplay_window): Use the field for long lines detection.
2022-07-18 17:54:55 +02:00
Gregory Heytings
6a097a8621 Shorter and safer fix for the segfault.
* src/xdisp.c (get_visually_first_element): Shorter and safer fix for
the segfault.  Improves the fix introduced in cc7f37b2a4.
2022-07-18 16:07:07 +02:00
Eli Zaretskii
8f9993bb3f ; * src/buffer.c (syms_of_buffer) <mode-line-format>: Doc fix. 2022-07-18 15:31:26 +03:00
Mattias Engdegård
9de0b06e74 Clarify take and ntake documentation (bug#56521)
* doc/lispref/lists.texi (List Elements): Describe `ntake` better.
* src/fns.c (Ftake, Fntake): Rephrase doc strings.
2022-07-18 12:49:29 +02:00
Gregory Heytings
cc7f37b2a4 Further improvements to long lines handling.
* src/xdisp.c (get_visually_first_element): Fix segfault.
(get_narrowed_begv): Specific improvement for character-only terminals.
2022-07-18 12:11:08 +02:00
Po Lu
7b259b2eb1 Implement last change on Haiku as well
* lisp/term/haiku-win.el (haiku-dnd-drag-handler): Stop
redisplaying here.
* src/haikuselect.c (haiku_note_drag_motion): Use
redisplay_preserve_echo_area.
2022-07-18 04:49:46 +00:00
Po Lu
5480d02cc5 Preserve echo area message when running DND mouse movement function
* lisp/term/x-win.el (x-dnd-movement): Stop redisplaying here.
* src/xterm.c (x_dnd_begin_drag_and_drop): Redisplay with the
echo area preserved.
2022-07-18 12:42:55 +08:00
Po Lu
356618ca6a Handle virtual modifiers in the DND scrolling code
* lisp/x-dnd.el (x-dnd-modifier-mask): Handle virtual modifiers.
* src/xfns.c (Fx_get_modifier_masks): New function.
(syms_of_xfns): Define new subr.
* src/xterm.c (x_get_keyboard_modifiers): New function.
* src/xterm.h: Update prototypes.
2022-07-18 09:20:05 +08:00
Mattias Engdegård
d62766305a Add take and ntake (bug#56521)
These are useful list primitives, complementary to `nthcdr`.

* src/fns.c (Ftake, Fntake): New.
(syms_of_fns): Defsubr them.
* doc/lispref/lists.texi (List Elements):
* lisp/emacs-lisp/shortdoc.el (list): Document.
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns, pure-fns):
Declare `take` pure and side-effect-free.
* test/src/fns-tests.el (fns-tests--take-ref, fns--take-ntake):
New test.
* etc/NEWS: Announce.
2022-07-17 17:35:49 +02:00
Eli Zaretskii
637436970f Fix leaking of file descriptors due to pipe processes on MS-Windows
* src/w32proc.c (reader_thread): Wait for 'sys_close' to finish
processing the pipe read descriptor, before trying to close it.

* src/w32.c (sys_close): Attempt to detect when the reader thread
already exited, so that it would be possible to close descriptors
open by pipe processes for reading from the pipe.  (Bug#56606)
2022-07-17 15:44:50 +03:00
Eli Zaretskii
0c9ca96c06 ; * src/xdisp.c (redisplay_tool_bar): Fix a possible typo. 2022-07-17 13:12:03 +03:00
Eli Zaretskii
5db4ec20fe Fix tab-bar resizing under 'auto-resize-tab-bars' = 'grow-only'
* src/xdisp.c (redisplay_tab_bar): Compute the desired height of
the tab-bar before iterating over the tab-bar string, to detect
the required resizing earlier.  Default 'change_p' to 'false'.

* lisp/tab-bar.el (tab-bar--update-tab-bar-lines): Support
'auto-resize-tab-bars' set to 'grow-only'.
2022-07-17 12:33:34 +03:00
Po Lu
e2ccd358c9 Handle scrolling during XDND drag-and-drop
* lisp/x-dnd.el (x-dnd-get-object-rectangle): Handle cases where
`posn-x-y' is nil.
(x-dnd-modifier-mask, x-dnd-hscroll-flags, x-dnd-note-click):
New functions.
(x-dnd-click-count): New defvar.
(x-dnd-handle-xdnd): Handle button press events.

* src/xterm.c (x_dnd_send_position): Fix handling of mouse
rects.
2022-07-17 11:06:14 +08:00
Po Lu
211ca9f916 Fix drag-and-drop button button flags
* src/xterm.c (x_dnd_send_position): Always send buttons
regardless of version.  Fix bit indices.
(handle_one_xevent): Likewise.
2022-07-17 09:13:28 +08:00
Gregory Heytings
66704fbbcf Fix typo in e7b5912b23. 2022-07-17 01:36:10 +02:00
Gregory Heytings
e7b5912b23 Improvements to long lines handling.
* src/buffer.h (struct buffer): New field 'long_line_optimizations_p'.

* src/buffer.c (syms_of_buffer): New variable 'long-line-threshold'.
(reset_buffer): Initialize the 'long_line_optimizations_p' field.
(Fbuffer_swap_text): Handle it.

* src/xdisp.c (redisplay_window): Set 'long_line_optimizations_p' when
a buffer contains long lines.
(init_iterator): Use 'long_line_optimizations_p'.
(get_narrowed_begv): Update.
(SET_WITH_NARROWED_BEGV): New macro.
(unwind_narrowed_begv): New internal function used by the new macro.
(back_to_previous_line_start, get_visually_first_element,
move_it_vertically_backward): Use the new macro.

* src/search.c (find_newline1): Make it externally visible.

* src/lisp.h: Make 'find_newline1' externally visible.

* src/dispextern.h (struct it): Update comment.  Remove the
'WITH_NARROWED_BEGV' macro.

* etc/NEWS: Mention the 'long-line-threshold' variable.
2022-07-16 21:13:33 +02:00
Eli Zaretskii
9a5b52dace * src/composite.c (find_automatic_composition): Fix off-by-one error. 2022-07-16 16:29:24 +03:00
Eli Zaretskii
058cc53ea7 ; * src/xdisp.c (try_window): Expand the commentary. (Bug#56561) 2022-07-16 11:21:05 +03:00
Po Lu
00501e82c7 Handle XDND mouse rects synchronously
* src/xterm.c (x_dnd_send_position): Record event X and Y for
consumption by the XdndStatus handler.  Ignore mouse rects if
waiting for status.
(x_dnd_send_leave): Clear pending DND event.
(handle_one_xevent): When handling XdndStatus, check if the
pending event is contained in the new mouse rect.
2022-07-16 11:53:42 +08:00
Andreas Schwab
889943e2bd Fix ASAN error with fringe bitmap on NS
* src/nsterm.m (ns_define_fringe_bitmap): Correctly access fringe
bitmap data.  (Bug#56553)
2022-07-15 17:26:39 +02:00
Po Lu
bd35ced042 ; * src/nsterm.m (ns_draw_window_cursor): Fix last change. 2022-07-15 22:04:52 +08:00
Po Lu
c829e63b0a Fix double unfocus during NS cursor display
* src/nsterm.m (ns_draw_window_cursor): Unfocus around calls to
draw_phys_cursor_glyph, then focus again later.  (bug#56559)
2022-07-15 22:00:57 +08:00
Po Lu
c96a6a0c9f Only preserve PRIMARY and CLIPBOARD selection ownership by default
* lisp/cus-start.el (standard): Update defcustom type.
* src/xselect.c (x_should_preserve_selection): New function.
(x_clear_frame_selections): Use it to determine whether or not
to preserve a selection.
* src/xterm.c (x_preserve_selections): Fix tail initialization.
(syms_of_xterm): Update doc string of
`x-auto-preserve-selections'.
2022-07-15 21:47:09 +08:00
Eli Zaretskii
ed4ba79ea8 Avoid infloop in redisplay when displaying a tooltip
* src/xdisp.c (try_window): Ensure we fail if 'display_line'
indicates that the dimensions of the glyph matrix are
insufficient.  (Bug#56561)
2022-07-15 13:49:56 +03:00
Po Lu
200938b95d Fix generated drag-and-drop mouse rectangles
* lisp/x-dnd.el (x-dnd-get-drop-width-height): Handle window
width and height correctly.  Remove unused parameter.
(x-dnd-after-move-frame): New function.
(move-frame-functions): Add new hook.
(x-dnd-compute-root-window-position): New function.
(x-dnd-get-drop-x-y): Use that instead of `left' and `top'
parameters, which include the title bar.
(x-dnd-handle-xdnd): Update accordingly.
* src/xfns.c (Fx_translate_coordinates): New function.
(syms_of_xfns): New defsym.
2022-07-15 16:19:52 +08:00
Po Lu
2e0c76e397 Fix sending button presses if the drop target specified a mouse rectangle
* src/xterm.c (x_dnd_send_position): Handle button presses
specially, ignoring mouse rectangles.
2022-07-15 10:30:18 +08:00
Lars Ingebrigtsen
90f8c8400f Fix --without-x build after previous image cache changes
* src/alloc.c (garbage_collect): Fix --without-all --without-x build.
2022-07-14 20:07:37 +02:00
Lars Ingebrigtsen
564f6c171e Prune animation cache when images are no longer reachable
* lisp/image.el (image-animate-timeout): Eject cached animated
images that are no longer reachable (bug#56546).

* src/image.c (Fclear_image_cache): Allow specifying a cached
animated image to eject.
(gif_load, webp_load): Adjust what to use as the caching key --
the identity of the list itself is apparently changed by some
callers.
2022-07-14 18:59:09 +02:00
Lars Ingebrigtsen
4c542747bd Make image-cache-size also include the animation cache
* src/image.c (struct anim_cache, anim_create_cache): Store approx
cache size.
(gif_load, webp_load): Ditto.
(Fimage_cache_size): Also report animation cache size (bug#56546).
2022-07-14 18:59:09 +02:00