diff options
| author | Po Lu | 2023-07-23 08:53:22 +0800 |
|---|---|---|
| committer | Po Lu | 2023-07-23 08:53:22 +0800 |
| commit | be70caa68f448438cd8170534220ca284d6a6930 (patch) | |
| tree | 7a6898a8a3035001c3766f3fe44e9cde83d0a27e /src | |
| parent | 3ab81aa5fb18b2532bd5f7b5e2220a46caa65b55 (diff) | |
| parent | f37c65b402f8a054fed9a3d6234cb7f85da3621a (diff) | |
| download | emacs-be70caa68f448438cd8170534220ca284d6a6930.tar.gz emacs-be70caa68f448438cd8170534220ca284d6a6930.zip | |
Merge remote-tracking branch 'origin/master' into feature/android
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispnew.c | 17 | ||||
| -rw-r--r-- | src/eval.c | 2 | ||||
| -rw-r--r-- | src/regex-emacs.c | 24 | ||||
| -rw-r--r-- | src/xdisp.c | 19 |
4 files changed, 47 insertions, 15 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index 1e99c7b58bd..02388bcef2b 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -5656,6 +5656,15 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p | |||
| 5656 | argument is ZV to prevent move_it_in_display_line from matching | 5656 | argument is ZV to prevent move_it_in_display_line from matching |
| 5657 | based on buffer positions. */ | 5657 | based on buffer positions. */ |
| 5658 | move_it_in_display_line (&it, ZV, to_x, MOVE_TO_X); | 5658 | move_it_in_display_line (&it, ZV, to_x, MOVE_TO_X); |
| 5659 | if (mouse_prefer_closest_glyph) | ||
| 5660 | { | ||
| 5661 | int next_x = it.current_x + it.pixel_width; | ||
| 5662 | int before_dx = to_x - it.current_x; | ||
| 5663 | int after_dx = next_x - to_x; | ||
| 5664 | if (before_dx > after_dx) | ||
| 5665 | move_it_in_display_line (&it, ZV, next_x, MOVE_TO_X); | ||
| 5666 | } | ||
| 5667 | |||
| 5659 | bidi_unshelve_cache (itdata, 0); | 5668 | bidi_unshelve_cache (itdata, 0); |
| 5660 | 5669 | ||
| 5661 | Fset_buffer (old_current_buffer); | 5670 | Fset_buffer (old_current_buffer); |
| @@ -6848,6 +6857,14 @@ predicates which report frame's specific UI-related capabilities. */); | |||
| 6848 | DEFVAR_BOOL ("cursor-in-echo-area", cursor_in_echo_area, | 6857 | DEFVAR_BOOL ("cursor-in-echo-area", cursor_in_echo_area, |
| 6849 | doc: /* Non-nil means put cursor in minibuffer, at end of any message there. */); | 6858 | doc: /* Non-nil means put cursor in minibuffer, at end of any message there. */); |
| 6850 | 6859 | ||
| 6860 | DEFVAR_BOOL ("mouse-prefer-closest-glyph", mouse_prefer_closest_glyph, | ||
| 6861 | doc: /* Non-nil means mouse click position is taken from glyph closest to click. | ||
| 6862 | |||
| 6863 | When non-nil, mouse position lists will report buffer position set to | ||
| 6864 | the position of the glyph that is the closest to the mouse pointer | ||
| 6865 | at the time of the click, instead of the glyph immediately under it. */); | ||
| 6866 | mouse_prefer_closest_glyph = false; | ||
| 6867 | |||
| 6851 | DEFVAR_LISP ("glyph-table", Vglyph_table, | 6868 | DEFVAR_LISP ("glyph-table", Vglyph_table, |
| 6852 | doc: /* Table defining how to output a glyph code to the frame. | 6869 | doc: /* Table defining how to output a glyph code to the frame. |
| 6853 | If not nil, this is a vector indexed by glyph code to define the glyph. | 6870 | If not nil, this is a vector indexed by glyph code to define the glyph. |
diff --git a/src/eval.c b/src/eval.c index 3f4e77cd3b1..9e54d489a3b 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -4203,7 +4203,7 @@ mark_specpdl (union specbinding *first, union specbinding *ptr) | |||
| 4203 | void | 4203 | void |
| 4204 | get_backtrace (Lisp_Object array) | 4204 | get_backtrace (Lisp_Object array) |
| 4205 | { | 4205 | { |
| 4206 | union specbinding *pdl = backtrace_next (backtrace_top ()); | 4206 | union specbinding *pdl = backtrace_top (); |
| 4207 | ptrdiff_t i = 0, asize = ASIZE (array); | 4207 | ptrdiff_t i = 0, asize = ASIZE (array); |
| 4208 | 4208 | ||
| 4209 | /* Copy the backtrace contents into working memory. */ | 4209 | /* Copy the backtrace contents into working memory. */ |
diff --git a/src/regex-emacs.c b/src/regex-emacs.c index 51fc2b0558d..7e75f0ac597 100644 --- a/src/regex-emacs.c +++ b/src/regex-emacs.c | |||
| @@ -47,6 +47,9 @@ | |||
| 47 | /* Make syntax table lookup grant data in gl_state. */ | 47 | /* Make syntax table lookup grant data in gl_state. */ |
| 48 | #define SYNTAX(c) syntax_property (c, 1) | 48 | #define SYNTAX(c) syntax_property (c, 1) |
| 49 | 49 | ||
| 50 | /* Explicit syntax lookup using the buffer-local table. */ | ||
| 51 | #define BUFFER_SYNTAX(c) syntax_property (c, 0) | ||
| 52 | |||
| 50 | #define RE_MULTIBYTE_P(bufp) ((bufp)->multibyte) | 53 | #define RE_MULTIBYTE_P(bufp) ((bufp)->multibyte) |
| 51 | #define RE_TARGET_MULTIBYTE_P(bufp) ((bufp)->target_multibyte) | 54 | #define RE_TARGET_MULTIBYTE_P(bufp) ((bufp)->target_multibyte) |
| 52 | #define RE_STRING_CHAR(p, multibyte) \ | 55 | #define RE_STRING_CHAR(p, multibyte) \ |
| @@ -132,18 +135,22 @@ | |||
| 132 | 135 | ||
| 133 | #define ISLOWER(c) lowercasep (c) | 136 | #define ISLOWER(c) lowercasep (c) |
| 134 | 137 | ||
| 138 | #define ISUPPER(c) uppercasep (c) | ||
| 139 | |||
| 140 | /* The following predicates use the buffer-local syntax table and | ||
| 141 | ignore syntax properties, for consistency with the up-front | ||
| 142 | assumptions made at compile time. */ | ||
| 143 | |||
| 135 | #define ISPUNCT(c) (IS_REAL_ASCII (c) \ | 144 | #define ISPUNCT(c) (IS_REAL_ASCII (c) \ |
| 136 | ? ((c) > ' ' && (c) < 0177 \ | 145 | ? ((c) > ' ' && (c) < 0177 \ |
| 137 | && !(((c) >= 'a' && (c) <= 'z') \ | 146 | && !(((c) >= 'a' && (c) <= 'z') \ |
| 138 | || ((c) >= 'A' && (c) <= 'Z') \ | 147 | || ((c) >= 'A' && (c) <= 'Z') \ |
| 139 | || ((c) >= '0' && (c) <= '9'))) \ | 148 | || ((c) >= '0' && (c) <= '9'))) \ |
| 140 | : SYNTAX (c) != Sword) | 149 | : BUFFER_SYNTAX (c) != Sword) |
| 141 | 150 | ||
| 142 | #define ISSPACE(c) (SYNTAX (c) == Swhitespace) | 151 | #define ISSPACE(c) (BUFFER_SYNTAX (c) == Swhitespace) |
| 143 | 152 | ||
| 144 | #define ISUPPER(c) uppercasep (c) | 153 | #define ISWORD(c) (BUFFER_SYNTAX (c) == Sword) |
| 145 | |||
| 146 | #define ISWORD(c) (SYNTAX (c) == Sword) | ||
| 147 | 154 | ||
| 148 | /* Use alloca instead of malloc. This is because using malloc in | 155 | /* Use alloca instead of malloc. This is because using malloc in |
| 149 | re_search* or re_match* could cause memory leaks when C-g is used | 156 | re_search* or re_match* could cause memory leaks when C-g is used |
| @@ -2048,13 +2055,6 @@ regex_compile (re_char *pattern, ptrdiff_t size, | |||
| 2048 | is_xdigit, since they can only match ASCII characters. | 2055 | is_xdigit, since they can only match ASCII characters. |
| 2049 | We don't need to handle them for multibyte. */ | 2056 | We don't need to handle them for multibyte. */ |
| 2050 | 2057 | ||
| 2051 | /* Setup the gl_state object to its buffer-defined value. | ||
| 2052 | This hardcodes the buffer-global syntax-table for ASCII | ||
| 2053 | chars, while the other chars will obey syntax-table | ||
| 2054 | properties. It's not ideal, but it's the way it's been | ||
| 2055 | done until now. */ | ||
| 2056 | SETUP_BUFFER_SYNTAX_TABLE (); | ||
| 2057 | |||
| 2058 | for (c = 0; c < 0x80; ++c) | 2058 | for (c = 0; c < 0x80; ++c) |
| 2059 | if (re_iswctype (c, cc)) | 2059 | if (re_iswctype (c, cc)) |
| 2060 | { | 2060 | { |
diff --git a/src/xdisp.c b/src/xdisp.c index 5e471cad61e..ae9152847c1 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2759,6 +2759,7 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect) | |||
| 2759 | enum window_part part; | 2759 | enum window_part part; |
| 2760 | enum glyph_row_area area; | 2760 | enum glyph_row_area area; |
| 2761 | int x, y, width, height; | 2761 | int x, y, width, height; |
| 2762 | int original_gx; | ||
| 2762 | 2763 | ||
| 2763 | if (mouse_fine_grained_tracking) | 2764 | if (mouse_fine_grained_tracking) |
| 2764 | { | 2765 | { |
| @@ -2769,6 +2770,8 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect) | |||
| 2769 | /* Try to determine frame pixel position and size of the glyph under | 2770 | /* Try to determine frame pixel position and size of the glyph under |
| 2770 | frame pixel coordinates X/Y on frame F. */ | 2771 | frame pixel coordinates X/Y on frame F. */ |
| 2771 | 2772 | ||
| 2773 | original_gx = gx; | ||
| 2774 | |||
| 2772 | if (window_resize_pixelwise) | 2775 | if (window_resize_pixelwise) |
| 2773 | { | 2776 | { |
| 2774 | width = height = 1; | 2777 | width = height = 1; |
| @@ -2984,6 +2987,15 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect) | |||
| 2984 | gy += WINDOW_TOP_EDGE_Y (w); | 2987 | gy += WINDOW_TOP_EDGE_Y (w); |
| 2985 | 2988 | ||
| 2986 | store_rect: | 2989 | store_rect: |
| 2990 | if (mouse_prefer_closest_glyph) | ||
| 2991 | { | ||
| 2992 | int half_width = width / 2; | ||
| 2993 | width = half_width; | ||
| 2994 | |||
| 2995 | int bisection = gx + half_width; | ||
| 2996 | if (original_gx > bisection) | ||
| 2997 | gx = bisection; | ||
| 2998 | } | ||
| 2987 | STORE_NATIVE_RECT (*rect, gx, gy, width, height); | 2999 | STORE_NATIVE_RECT (*rect, gx, gy, width, height); |
| 2988 | 3000 | ||
| 2989 | /* Visible feedback for debugging. */ | 3001 | /* Visible feedback for debugging. */ |
| @@ -37724,9 +37736,12 @@ may be more familiar to users. */); | |||
| 37724 | display_raw_bytes_as_hex = false; | 37736 | display_raw_bytes_as_hex = false; |
| 37725 | 37737 | ||
| 37726 | DEFVAR_BOOL ("mouse-fine-grained-tracking", mouse_fine_grained_tracking, | 37738 | DEFVAR_BOOL ("mouse-fine-grained-tracking", mouse_fine_grained_tracking, |
| 37727 | doc: /* Non-nil for pixel-wise mouse-movement. | 37739 | doc: /* Non-nil for pixelwise mouse-movement. |
| 37728 | When nil, mouse-movement events will not be generated as long as the | 37740 | When nil, mouse-movement events will not be generated as long as the |
| 37729 | mouse stays within the extent of a single glyph (except for images). */); | 37741 | mouse stays within the extent of a single glyph (except for images). |
| 37742 | When nil and `mouse-prefer-closest-glyph' is non-nil, mouse-movement | ||
| 37743 | events will instead not be generated as long as the mouse stays within | ||
| 37744 | the extent of a single left/right half glyph (except for images). */); | ||
| 37730 | mouse_fine_grained_tracking = false; | 37745 | mouse_fine_grained_tracking = false; |
| 37731 | 37746 | ||
| 37732 | DEFVAR_BOOL ("tab-bar--dragging-in-progress", tab_bar__dragging_in_progress, | 37747 | DEFVAR_BOOL ("tab-bar--dragging-in-progress", tab_bar__dragging_in_progress, |