aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog32
-rw-r--r--src/dispextern.h19
-rw-r--r--src/intervals.h4
-rw-r--r--src/lisp.h8
-rw-r--r--src/xdisp.c2393
5 files changed, 1195 insertions, 1261 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 77589f8d949..b4abdc59045 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,35 @@
12015-02-10 Paul Eggert <eggert@cs.ucla.edu>
2
3 Use bool for boolean in xdisp.c
4 * dispextern.h (display_prop_intangible_p, resize_mini_window)
5 (pixel_to_glyph_coords, mark_window_display_accurate)
6 (compute_display_string_pos, handle_tool_bar_click)
7 (x_intersect_rectangles, clear_mouse_face, display_tty_menu_item):
8 * lisp.h (setup_echo_area_for_printing, message_with_string)
9 (pos_visible_p): Use bool for boolean.
10 * xdisp.c: Use bool, true, false intstead of int, 1, 0.
11 Remove unnecessary forward decls.
12 (trace_move) [DEBUG_TRACE_MOVE]: Now static.
13 (CHECK_IT, CHECK_WINDOW_END):
14 Now an inline function that is always defined.
15 (check_it) [0]:
16 (check_window_end) [oGLYPH_DEBUG && ENABLE_CHECKING]:
17 Remove; no longer needed.
18 (handle_stop): Prefer (X && !Y) to (X ? !Y : 0).
19 (get_overlay_strings): Omit unnecessary casts.
20 (forward_to_next_line_start):
21 (Ftool_bar_height):
22 Prefer !BOOL to (BOOL ? 0 : 1).
23 (next_element_function): New typedef.
24 (get_next_element): Use it. Now const.
25 (IT_POS_VALID_AFTER_MOVE_P): Prefer !X || Y==0 to (X ? Y==0 : 1).
26 (vmessage): Now ATTRIBUTE_FORMAT_PRINTF (1, 0), to pacify GCC 4.9.2
27 (display_echo_area): Prefer BOOLEXPR to BOOLEXPR ? 1 : 0.
28 (tool_bar_item_info): Simplify.
29 (invisible_prop): Rename from invisible_p, since it doesn't
30 return bool. All callers changed.
31 (x_produce_glyphs): Simplify.
32
12015-02-09 Paul Eggert <eggert@cs.ucla.edu> 332015-02-09 Paul Eggert <eggert@cs.ucla.edu>
2 34
3 Check for some overflows in vertical-motion 35 Check for some overflows in vertical-motion
diff --git a/src/dispextern.h b/src/dispextern.h
index b0f2944da86..5f730df514b 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3182,9 +3182,9 @@ struct glyph_row *row_containing_pos (struct window *, ptrdiff_t,
3182 struct glyph_row *, int); 3182 struct glyph_row *, int);
3183int line_bottom_y (struct it *); 3183int line_bottom_y (struct it *);
3184int default_line_pixel_height (struct window *); 3184int default_line_pixel_height (struct window *);
3185int display_prop_intangible_p (Lisp_Object, Lisp_Object, ptrdiff_t, ptrdiff_t); 3185bool display_prop_intangible_p (Lisp_Object, Lisp_Object, ptrdiff_t, ptrdiff_t);
3186void resize_echo_area_exactly (void); 3186void resize_echo_area_exactly (void);
3187int resize_mini_window (struct window *, int); 3187bool resize_mini_window (struct window *, bool);
3188void set_vertical_scroll_bar (struct window *); 3188void set_vertical_scroll_bar (struct window *);
3189void set_horizontal_scroll_bar (struct window *); 3189void set_horizontal_scroll_bar (struct window *);
3190int try_window (Lisp_Object, struct text_pos, int); 3190int try_window (Lisp_Object, struct text_pos, int);
@@ -3199,10 +3199,10 @@ int window_box_right (struct window *, enum glyph_row_area);
3199int estimate_mode_line_height (struct frame *, enum face_id); 3199int estimate_mode_line_height (struct frame *, enum face_id);
3200int move_it_to (struct it *, ptrdiff_t, int, int, int, int); 3200int move_it_to (struct it *, ptrdiff_t, int, int, int, int);
3201void pixel_to_glyph_coords (struct frame *, int, int, int *, int *, 3201void pixel_to_glyph_coords (struct frame *, int, int, int *, int *,
3202 NativeRectangle *, int); 3202 NativeRectangle *, bool);
3203void remember_mouse_glyph (struct frame *, int, int, NativeRectangle *); 3203void remember_mouse_glyph (struct frame *, int, int, NativeRectangle *);
3204 3204
3205void mark_window_display_accurate (Lisp_Object, int); 3205void mark_window_display_accurate (Lisp_Object, bool);
3206void redisplay_preserve_echo_area (int); 3206void redisplay_preserve_echo_area (int);
3207void init_iterator (struct it *, struct window *, ptrdiff_t, 3207void init_iterator (struct it *, struct window *, ptrdiff_t,
3208 ptrdiff_t, struct glyph_row *, enum face_id); 3208 ptrdiff_t, struct glyph_row *, enum face_id);
@@ -3228,7 +3228,7 @@ extern void reseat_at_previous_visible_line_start (struct it *);
3228extern Lisp_Object lookup_glyphless_char_display (int, struct it *); 3228extern Lisp_Object lookup_glyphless_char_display (int, struct it *);
3229extern ptrdiff_t compute_display_string_pos (struct text_pos *, 3229extern ptrdiff_t compute_display_string_pos (struct text_pos *,
3230 struct bidi_string_data *, 3230 struct bidi_string_data *,
3231 struct window *, int, int *); 3231 struct window *, bool, int *);
3232extern ptrdiff_t compute_display_string_end (ptrdiff_t, 3232extern ptrdiff_t compute_display_string_end (ptrdiff_t,
3233 struct bidi_string_data *); 3233 struct bidi_string_data *);
3234extern void produce_stretch_glyph (struct it *); 3234extern void produce_stretch_glyph (struct it *);
@@ -3271,21 +3271,20 @@ extern void get_glyph_string_clip_rect (struct glyph_string *,
3271extern Lisp_Object find_hot_spot (Lisp_Object, int, int); 3271extern Lisp_Object find_hot_spot (Lisp_Object, int, int);
3272 3272
3273extern void handle_tool_bar_click (struct frame *, 3273extern void handle_tool_bar_click (struct frame *,
3274 int, int, int, int); 3274 int, int, bool, int);
3275 3275
3276extern void expose_frame (struct frame *, int, int, int, int); 3276extern void expose_frame (struct frame *, int, int, int, int);
3277extern int x_intersect_rectangles (XRectangle *, XRectangle *, 3277extern bool x_intersect_rectangles (XRectangle *, XRectangle *, XRectangle *);
3278 XRectangle *);
3279#endif /* HAVE_WINDOW_SYSTEM */ 3278#endif /* HAVE_WINDOW_SYSTEM */
3280 3279
3281extern void note_mouse_highlight (struct frame *, int, int); 3280extern void note_mouse_highlight (struct frame *, int, int);
3282extern void x_clear_window_mouse_face (struct window *); 3281extern void x_clear_window_mouse_face (struct window *);
3283extern void cancel_mouse_face (struct frame *); 3282extern void cancel_mouse_face (struct frame *);
3284extern int clear_mouse_face (Mouse_HLInfo *); 3283extern bool clear_mouse_face (Mouse_HLInfo *);
3285extern bool cursor_in_mouse_face_p (struct window *w); 3284extern bool cursor_in_mouse_face_p (struct window *w);
3286extern void tty_draw_row_with_mouse_face (struct window *, struct glyph_row *, 3285extern void tty_draw_row_with_mouse_face (struct window *, struct glyph_row *,
3287 int, int, enum draw_glyphs_face); 3286 int, int, enum draw_glyphs_face);
3288extern void display_tty_menu_item (const char *, int, int, int, int, int); 3287extern void display_tty_menu_item (const char *, int, int, int, int, bool);
3289 3288
3290/* Flags passed to try_window. */ 3289/* Flags passed to try_window. */
3291#define TRY_WINDOW_CHECK_MARGINS (1 << 0) 3290#define TRY_WINDOW_CHECK_MARGINS (1 << 0)
diff --git a/src/intervals.h b/src/intervals.h
index b2260d002e6..30fb4b10b02 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -223,7 +223,7 @@ set_interval_plist (INTERVAL i, Lisp_Object plist)
223#define TEXT_PROP_MEANS_INVISIBLE(prop) \ 223#define TEXT_PROP_MEANS_INVISIBLE(prop) \
224 (EQ (BVAR (current_buffer, invisibility_spec), Qt) \ 224 (EQ (BVAR (current_buffer, invisibility_spec), Qt) \
225 ? !NILP (prop) \ 225 ? !NILP (prop) \
226 : invisible_p (prop, BVAR (current_buffer, invisibility_spec))) 226 : invisible_prop (prop, BVAR (current_buffer, invisibility_spec)))
227 227
228/* Declared in alloc.c. */ 228/* Declared in alloc.c. */
229 229
@@ -269,7 +269,7 @@ extern INTERVAL validate_interval_range (Lisp_Object, Lisp_Object *,
269extern INTERVAL interval_of (ptrdiff_t, Lisp_Object); 269extern INTERVAL interval_of (ptrdiff_t, Lisp_Object);
270 270
271/* Defined in xdisp.c. */ 271/* Defined in xdisp.c. */
272extern int invisible_p (Lisp_Object, Lisp_Object); 272extern int invisible_prop (Lisp_Object, Lisp_Object);
273 273
274/* Defined in textprop.c. */ 274/* Defined in textprop.c. */
275extern Lisp_Object copy_text_properties (Lisp_Object, Lisp_Object, 275extern Lisp_Object copy_text_properties (Lisp_Object, Lisp_Object,
diff --git a/src/lisp.h b/src/lisp.h
index f5242ab84a1..6c7b51fea06 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3640,7 +3640,7 @@ extern bool noninteractive_need_newline;
3640extern Lisp_Object echo_area_buffer[2]; 3640extern Lisp_Object echo_area_buffer[2];
3641extern void add_to_log (const char *, Lisp_Object, Lisp_Object); 3641extern void add_to_log (const char *, Lisp_Object, Lisp_Object);
3642extern void check_message_stack (void); 3642extern void check_message_stack (void);
3643extern void setup_echo_area_for_printing (int); 3643extern void setup_echo_area_for_printing (bool);
3644extern bool push_message (void); 3644extern bool push_message (void);
3645extern void pop_message_unwind (void); 3645extern void pop_message_unwind (void);
3646extern Lisp_Object restore_message_unwind (Lisp_Object); 3646extern Lisp_Object restore_message_unwind (Lisp_Object);
@@ -3653,7 +3653,7 @@ extern void message1_nolog (const char *);
3653extern void message3 (Lisp_Object); 3653extern void message3 (Lisp_Object);
3654extern void message3_nolog (Lisp_Object); 3654extern void message3_nolog (Lisp_Object);
3655extern void message_dolog (const char *, ptrdiff_t, bool, bool); 3655extern void message_dolog (const char *, ptrdiff_t, bool, bool);
3656extern void message_with_string (const char *, Lisp_Object, int); 3656extern void message_with_string (const char *, Lisp_Object, bool);
3657extern void message_log_maybe_newline (void); 3657extern void message_log_maybe_newline (void);
3658extern void update_echo_area (void); 3658extern void update_echo_area (void);
3659extern void truncate_echo_area (ptrdiff_t); 3659extern void truncate_echo_area (ptrdiff_t);
@@ -3663,8 +3663,8 @@ void set_frame_cursor_types (struct frame *, Lisp_Object);
3663extern void syms_of_xdisp (void); 3663extern void syms_of_xdisp (void);
3664extern void init_xdisp (void); 3664extern void init_xdisp (void);
3665extern Lisp_Object safe_eval (Lisp_Object); 3665extern Lisp_Object safe_eval (Lisp_Object);
3666extern int pos_visible_p (struct window *, ptrdiff_t, int *, 3666extern bool pos_visible_p (struct window *, ptrdiff_t, int *,
3667 int *, int *, int *, int *, int *); 3667 int *, int *, int *, int *, int *);
3668 3668
3669/* Defined in xsettings.c. */ 3669/* Defined in xsettings.c. */
3670extern void syms_of_xsettings (void); 3670extern void syms_of_xsettings (void);
diff --git a/src/xdisp.c b/src/xdisp.c
index ef9d72d5ab9..57a5631c0e3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -341,7 +341,7 @@ static Lisp_Object list_of_error;
341 && (IT)->current_x == (IT)->last_visible_x) 341 && (IT)->current_x == (IT)->last_visible_x)
342 342
343#else /* !HAVE_WINDOW_SYSTEM */ 343#else /* !HAVE_WINDOW_SYSTEM */
344#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it) 0 344#define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it) false
345#endif /* HAVE_WINDOW_SYSTEM */ 345#endif /* HAVE_WINDOW_SYSTEM */
346 346
347/* Test if the display element loaded in IT, or the underlying buffer 347/* Test if the display element loaded in IT, or the underlying buffer
@@ -360,12 +360,11 @@ static Lisp_Object list_of_error;
360 && (*BYTE_POS_ADDR (IT_BYTEPOS (*it)) == ' ' \ 360 && (*BYTE_POS_ADDR (IT_BYTEPOS (*it)) == ' ' \
361 || *BYTE_POS_ADDR (IT_BYTEPOS (*it)) == '\t')))) \ 361 || *BYTE_POS_ADDR (IT_BYTEPOS (*it)) == '\t')))) \
362 362
363/* Non-zero means print newline to stdout before next mini-buffer 363/* True means print newline to stdout before next mini-buffer message. */
364 message. */
365 364
366bool noninteractive_need_newline; 365bool noninteractive_need_newline;
367 366
368/* Non-zero means print newline to message log before next message. */ 367/* True means print newline to message log before next message. */
369 368
370static bool message_log_need_newline; 369static bool message_log_need_newline;
371 370
@@ -409,7 +408,7 @@ static struct text_pos this_line_min_pos;
409 408
410static struct buffer *this_line_buffer; 409static struct buffer *this_line_buffer;
411 410
412/* Nonzero if an overlay arrow has been displayed in this window. */ 411/* True if an overlay arrow has been displayed in this window. */
413 412
414static bool overlay_arrow_seen; 413static bool overlay_arrow_seen;
415 414
@@ -430,7 +429,7 @@ Lisp_Object echo_area_window;
430 429
431static Lisp_Object Vmessage_stack; 430static Lisp_Object Vmessage_stack;
432 431
433/* Nonzero means multibyte characters were enabled when the echo area 432/* True means multibyte characters were enabled when the echo area
434 message was specified. */ 433 message was specified. */
435 434
436static bool message_enable_multibyte; 435static bool message_enable_multibyte;
@@ -452,7 +451,7 @@ int update_mode_lines;
452 451
453int windows_or_buffers_changed; 452int windows_or_buffers_changed;
454 453
455/* Nonzero after display_mode_line if %l was used and it displayed a 454/* True after display_mode_line if %l was used and it displayed a
456 line number. */ 455 line number. */
457 456
458static bool line_number_displayed; 457static bool line_number_displayed;
@@ -474,17 +473,17 @@ static Lisp_Object echo_buffer[2];
474 473
475static Lisp_Object Vwith_echo_area_save_vector; 474static Lisp_Object Vwith_echo_area_save_vector;
476 475
477/* Non-zero means display_echo_area should display the last echo area 476/* True means display_echo_area should display the last echo area
478 message again. Set by redisplay_preserve_echo_area. */ 477 message again. Set by redisplay_preserve_echo_area. */
479 478
480static bool display_last_displayed_message_p; 479static bool display_last_displayed_message_p;
481 480
482/* Nonzero if echo area is being used by print; zero if being used by 481/* True if echo area is being used by print; false if being used by
483 message. */ 482 message. */
484 483
485static bool message_buf_print; 484static bool message_buf_print;
486 485
487/* Set to 1 in clear_message to make redisplay_internal aware 486/* Set to true in clear_message to make redisplay_internal aware
488 of an emptied echo area. */ 487 of an emptied echo area. */
489 488
490static bool message_cleared_p; 489static bool message_cleared_p;
@@ -500,7 +499,7 @@ static struct glyph scratch_glyphs[MAX_SCRATCH_GLYPHS];
500 499
501static int last_height; 500static int last_height;
502 501
503/* Non-zero if there's a help-echo in the echo area. */ 502/* True if there's a help-echo in the echo area. */
504 503
505bool help_echo_showing_p; 504bool help_echo_showing_p;
506 505
@@ -519,21 +518,21 @@ bool help_echo_showing_p;
519 move around the buffer, we can cause the bidi cache to be pushed or 518 move around the buffer, we can cause the bidi cache to be pushed or
520 popped, and therefore we need to restore the cache state when we 519 popped, and therefore we need to restore the cache state when we
521 return to the original iterator. */ 520 return to the original iterator. */
522#define SAVE_IT(ITCOPY,ITORIG,CACHE) \ 521#define SAVE_IT(ITCOPY, ITORIG, CACHE) \
523 do { \ 522 do { \
524 if (CACHE) \ 523 if (CACHE) \
525 bidi_unshelve_cache (CACHE, 1); \ 524 bidi_unshelve_cache (CACHE, true); \
526 ITCOPY = ITORIG; \ 525 ITCOPY = ITORIG; \
527 CACHE = bidi_shelve_cache (); \ 526 CACHE = bidi_shelve_cache (); \
528 } while (0) 527 } while (false)
529 528
530#define RESTORE_IT(pITORIG,pITCOPY,CACHE) \ 529#define RESTORE_IT(pITORIG, pITCOPY, CACHE) \
531 do { \ 530 do { \
532 if (pITORIG != pITCOPY) \ 531 if (pITORIG != pITCOPY) \
533 *(pITORIG) = *(pITCOPY); \ 532 *(pITORIG) = *(pITCOPY); \
534 bidi_unshelve_cache (CACHE, 0); \ 533 bidi_unshelve_cache (CACHE, false); \
535 CACHE = NULL; \ 534 CACHE = NULL; \
536 } while (0) 535 } while (false)
537 536
538/* Functions to mark elements as needing redisplay. */ 537/* Functions to mark elements as needing redisplay. */
539enum { REDISPLAY_SOME = 2}; /* Arbitrary choice. */ 538enum { REDISPLAY_SOME = 2}; /* Arbitrary choice. */
@@ -587,7 +586,7 @@ bset_update_mode_line (struct buffer *b)
587 586
588#ifdef GLYPH_DEBUG 587#ifdef GLYPH_DEBUG
589 588
590/* Non-zero means print traces of redisplay if compiled with 589/* True means print traces of redisplay if compiled with
591 GLYPH_DEBUG defined. */ 590 GLYPH_DEBUG defined. */
592 591
593bool trace_redisplay_p; 592bool trace_redisplay_p;
@@ -595,8 +594,8 @@ bool trace_redisplay_p;
595#endif /* GLYPH_DEBUG */ 594#endif /* GLYPH_DEBUG */
596 595
597#ifdef DEBUG_TRACE_MOVE 596#ifdef DEBUG_TRACE_MOVE
598/* Non-zero means trace with TRACE_MOVE to stderr. */ 597/* True means trace with TRACE_MOVE to stderr. */
599int trace_move; 598static bool trace_move;
600 599
601#define TRACE_MOVE(x) if (trace_move) fprintf x; else (void) 0 600#define TRACE_MOVE(x) if (trace_move) fprintf x; else (void) 0
602#else 601#else
@@ -722,7 +721,7 @@ Lisp_Object previous_help_echo_string;
722 721
723#ifdef HAVE_WINDOW_SYSTEM 722#ifdef HAVE_WINDOW_SYSTEM
724 723
725/* Non-zero means an hourglass cursor is currently shown. */ 724/* True means an hourglass cursor is currently shown. */
726static bool hourglass_shown_p; 725static bool hourglass_shown_p;
727 726
728/* If non-null, an asynchronous timer that, when it expires, displays 727/* If non-null, an asynchronous timer that, when it expires, displays
@@ -745,63 +744,29 @@ static struct atimer *hourglass_atimer;
745/* Function prototypes. */ 744/* Function prototypes. */
746 745
747static void setup_for_ellipsis (struct it *, int); 746static void setup_for_ellipsis (struct it *, int);
748static void set_iterator_to_next (struct it *, int); 747static void set_iterator_to_next (struct it *, bool);
749static void mark_window_display_accurate_1 (struct window *, int); 748static void mark_window_display_accurate_1 (struct window *, bool);
750static int single_display_spec_string_p (Lisp_Object, Lisp_Object); 749static bool row_for_charpos_p (struct glyph_row *, ptrdiff_t);
751static int display_prop_string_p (Lisp_Object, Lisp_Object); 750static bool cursor_row_p (struct glyph_row *);
752static int row_for_charpos_p (struct glyph_row *, ptrdiff_t);
753static int cursor_row_p (struct glyph_row *);
754static int redisplay_mode_lines (Lisp_Object, bool); 751static int redisplay_mode_lines (Lisp_Object, bool);
755static char *decode_mode_spec_coding (Lisp_Object, char *, int);
756
757static Lisp_Object get_it_property (struct it *it, Lisp_Object prop);
758 752
759static void handle_line_prefix (struct it *); 753static void handle_line_prefix (struct it *);
760 754
761static void pint2str (char *, int, ptrdiff_t);
762static void pint2hrstr (char *, int, ptrdiff_t);
763static struct text_pos run_window_scroll_functions (Lisp_Object,
764 struct text_pos);
765static int text_outside_line_unchanged_p (struct window *,
766 ptrdiff_t, ptrdiff_t);
767static void store_mode_line_noprop_char (char);
768static int store_mode_line_noprop (const char *, int, int);
769static void handle_stop (struct it *);
770static void handle_stop_backwards (struct it *, ptrdiff_t); 755static void handle_stop_backwards (struct it *, ptrdiff_t);
771static void vmessage (const char *, va_list) ATTRIBUTE_FORMAT_PRINTF (1, 0);
772static void ensure_echo_area_buffers (void);
773static void unwind_with_echo_area_buffer (Lisp_Object); 756static void unwind_with_echo_area_buffer (Lisp_Object);
774static Lisp_Object with_echo_area_buffer_unwind_data (struct window *); 757static Lisp_Object with_echo_area_buffer_unwind_data (struct window *);
775static int with_echo_area_buffer (struct window *, int, 758static bool current_message_1 (ptrdiff_t, Lisp_Object);
776 int (*) (ptrdiff_t, Lisp_Object), 759static bool truncate_message_1 (ptrdiff_t, Lisp_Object);
777 ptrdiff_t, Lisp_Object);
778static void clear_garbaged_frames (void);
779static int current_message_1 (ptrdiff_t, Lisp_Object);
780static int truncate_message_1 (ptrdiff_t, Lisp_Object);
781static void set_message (Lisp_Object); 760static void set_message (Lisp_Object);
782static int set_message_1 (ptrdiff_t, Lisp_Object); 761static bool set_message_1 (ptrdiff_t, Lisp_Object);
783static int display_echo_area (struct window *); 762static bool display_echo_area_1 (ptrdiff_t, Lisp_Object);
784static int display_echo_area_1 (ptrdiff_t, Lisp_Object); 763static bool resize_mini_window_1 (ptrdiff_t, Lisp_Object);
785static int resize_mini_window_1 (ptrdiff_t, Lisp_Object);
786static void unwind_redisplay (void); 764static void unwind_redisplay (void);
787static int string_char_and_length (const unsigned char *, int *);
788static struct text_pos display_prop_end (struct it *, Lisp_Object,
789 struct text_pos);
790static int compute_window_start_on_continuation_line (struct window *);
791static void insert_left_trunc_glyphs (struct it *);
792static struct glyph_row *get_overlay_arrow_glyph_row (struct window *,
793 Lisp_Object);
794static void extend_face_to_end_of_line (struct it *); 765static void extend_face_to_end_of_line (struct it *);
795static int append_space_for_newline (struct it *, int);
796static int cursor_row_fully_visible_p (struct window *, int, int);
797static int try_scrolling (Lisp_Object, int, ptrdiff_t, ptrdiff_t, int, int);
798static int try_cursor_movement (Lisp_Object, struct text_pos, int *);
799static int trailing_whitespace_p (ptrdiff_t);
800static intmax_t message_log_check_duplicate (ptrdiff_t, ptrdiff_t); 766static intmax_t message_log_check_duplicate (ptrdiff_t, ptrdiff_t);
801static void push_it (struct it *, struct text_pos *); 767static void push_it (struct it *, struct text_pos *);
802static void iterate_out_of_display_property (struct it *); 768static void iterate_out_of_display_property (struct it *);
803static void pop_it (struct it *); 769static void pop_it (struct it *);
804static void sync_frame_with_window_matrix_rows (struct window *);
805static void redisplay_internal (void); 770static void redisplay_internal (void);
806static bool echo_area_display (bool); 771static bool echo_area_display (bool);
807static void redisplay_windows (Lisp_Object); 772static void redisplay_windows (Lisp_Object);
@@ -809,17 +774,19 @@ static void redisplay_window (Lisp_Object, bool);
809static Lisp_Object redisplay_window_error (Lisp_Object); 774static Lisp_Object redisplay_window_error (Lisp_Object);
810static Lisp_Object redisplay_window_0 (Lisp_Object); 775static Lisp_Object redisplay_window_0 (Lisp_Object);
811static Lisp_Object redisplay_window_1 (Lisp_Object); 776static Lisp_Object redisplay_window_1 (Lisp_Object);
812static int set_cursor_from_row (struct window *, struct glyph_row *, 777static bool set_cursor_from_row (struct window *, struct glyph_row *,
813 struct glyph_matrix *, ptrdiff_t, ptrdiff_t, 778 struct glyph_matrix *, ptrdiff_t, ptrdiff_t,
814 int, int); 779 int, int);
815static int update_menu_bar (struct frame *, int, int); 780static bool update_menu_bar (struct frame *, bool, bool);
816static int try_window_reusing_current_matrix (struct window *); 781static bool try_window_reusing_current_matrix (struct window *);
817static int try_window_id (struct window *); 782static int try_window_id (struct window *);
818static int display_line (struct it *); 783static bool display_line (struct it *);
819static int display_mode_lines (struct window *); 784static int display_mode_lines (struct window *);
820static int display_mode_line (struct window *, enum face_id, Lisp_Object); 785static int display_mode_line (struct window *, enum face_id, Lisp_Object);
821static int display_mode_element (struct it *, int, int, int, Lisp_Object, Lisp_Object, int); 786static int display_mode_element (struct it *, int, int, int, Lisp_Object,
822static int store_mode_line_string (const char *, Lisp_Object, int, int, int, Lisp_Object); 787 Lisp_Object, bool);
788static int store_mode_line_string (const char *, Lisp_Object, bool, int, int,
789 Lisp_Object);
823static const char *decode_mode_spec (struct window *, int, int, Lisp_Object *); 790static const char *decode_mode_spec (struct window *, int, int, Lisp_Object *);
824static void display_menu_bar (struct window *); 791static void display_menu_bar (struct window *);
825static ptrdiff_t display_count_lines (ptrdiff_t, ptrdiff_t, ptrdiff_t, 792static ptrdiff_t display_count_lines (ptrdiff_t, ptrdiff_t, ptrdiff_t,
@@ -828,64 +795,40 @@ static int display_string (const char *, Lisp_Object, Lisp_Object,
828 ptrdiff_t, ptrdiff_t, struct it *, int, int, int, int); 795 ptrdiff_t, ptrdiff_t, struct it *, int, int, int, int);
829static void compute_line_metrics (struct it *); 796static void compute_line_metrics (struct it *);
830static void run_redisplay_end_trigger_hook (struct it *); 797static void run_redisplay_end_trigger_hook (struct it *);
831static int get_overlay_strings (struct it *, ptrdiff_t); 798static bool get_overlay_strings (struct it *, ptrdiff_t);
832static int get_overlay_strings_1 (struct it *, ptrdiff_t, int); 799static bool get_overlay_strings_1 (struct it *, ptrdiff_t, bool);
833static void next_overlay_string (struct it *); 800static void next_overlay_string (struct it *);
834static void reseat (struct it *, struct text_pos, int); 801static void reseat (struct it *, struct text_pos, bool);
835static void reseat_1 (struct it *, struct text_pos, int); 802static void reseat_1 (struct it *, struct text_pos, bool);
836static void back_to_previous_visible_line_start (struct it *); 803static bool next_element_from_display_vector (struct it *);
837static void reseat_at_next_visible_line_start (struct it *, int); 804static bool next_element_from_string (struct it *);
838static int next_element_from_ellipsis (struct it *); 805static bool next_element_from_c_string (struct it *);
839static int next_element_from_display_vector (struct it *); 806static bool next_element_from_buffer (struct it *);
840static int next_element_from_string (struct it *); 807static bool next_element_from_composition (struct it *);
841static int next_element_from_c_string (struct it *); 808static bool next_element_from_image (struct it *);
842static int next_element_from_buffer (struct it *); 809static bool next_element_from_stretch (struct it *);
843static int next_element_from_composition (struct it *);
844static int next_element_from_image (struct it *);
845static int next_element_from_stretch (struct it *);
846static void load_overlay_strings (struct it *, ptrdiff_t); 810static void load_overlay_strings (struct it *, ptrdiff_t);
847static int init_from_display_pos (struct it *, struct window *, 811static bool get_next_display_element (struct it *);
848 struct display_pos *);
849static void reseat_to_string (struct it *, const char *,
850 Lisp_Object, ptrdiff_t, ptrdiff_t, int, int);
851static int get_next_display_element (struct it *);
852static enum move_it_result 812static enum move_it_result
853 move_it_in_display_line_to (struct it *, ptrdiff_t, int, 813 move_it_in_display_line_to (struct it *, ptrdiff_t, int,
854 enum move_operation_enum); 814 enum move_operation_enum);
855static void get_visually_first_element (struct it *); 815static void get_visually_first_element (struct it *);
856static void init_to_row_start (struct it *, struct window *,
857 struct glyph_row *);
858static int init_to_row_end (struct it *, struct window *,
859 struct glyph_row *);
860static void back_to_previous_line_start (struct it *);
861static int forward_to_next_line_start (struct it *, int *, struct bidi_it *);
862static struct text_pos string_pos_nchars_ahead (struct text_pos,
863 Lisp_Object, ptrdiff_t);
864static struct text_pos string_pos (ptrdiff_t, Lisp_Object);
865static struct text_pos c_string_pos (ptrdiff_t, const char *, bool);
866static ptrdiff_t number_of_chars (const char *, bool);
867static void compute_stop_pos (struct it *); 816static void compute_stop_pos (struct it *);
868static void compute_string_pos (struct text_pos *, struct text_pos, 817static int face_before_or_after_it_pos (struct it *, bool);
869 Lisp_Object);
870static int face_before_or_after_it_pos (struct it *, int);
871static ptrdiff_t next_overlay_change (ptrdiff_t); 818static ptrdiff_t next_overlay_change (ptrdiff_t);
872static int handle_display_spec (struct it *, Lisp_Object, Lisp_Object, 819static int handle_display_spec (struct it *, Lisp_Object, Lisp_Object,
873 Lisp_Object, struct text_pos *, ptrdiff_t, int); 820 Lisp_Object, struct text_pos *, ptrdiff_t, bool);
874static int handle_single_display_spec (struct it *, Lisp_Object, 821static int handle_single_display_spec (struct it *, Lisp_Object,
875 Lisp_Object, Lisp_Object, 822 Lisp_Object, Lisp_Object,
876 struct text_pos *, ptrdiff_t, int, int); 823 struct text_pos *, ptrdiff_t, int, bool);
877static int underlying_face_id (struct it *); 824static int underlying_face_id (struct it *);
878static int in_ellipses_for_invisible_text_p (struct display_pos *,
879 struct window *);
880 825
881#define face_before_it_pos(IT) face_before_or_after_it_pos ((IT), 1) 826#define face_before_it_pos(IT) face_before_or_after_it_pos (IT, true)
882#define face_after_it_pos(IT) face_before_or_after_it_pos ((IT), 0) 827#define face_after_it_pos(IT) face_before_or_after_it_pos (IT, false)
883 828
884#ifdef HAVE_WINDOW_SYSTEM 829#ifdef HAVE_WINDOW_SYSTEM
885 830
886static void x_consider_frame_title (Lisp_Object); 831static void update_tool_bar (struct frame *, bool);
887static void update_tool_bar (struct frame *, int);
888static int redisplay_tool_bar (struct frame *);
889static void x_draw_bottom_divider (struct window *w); 832static void x_draw_bottom_divider (struct window *w);
890static void notice_overwritten_cursor (struct window *, 833static void notice_overwritten_cursor (struct window *,
891 enum glyph_row_area, 834 enum glyph_row_area,
@@ -1289,20 +1232,20 @@ window_hscroll_limited (struct window *w, struct frame *f)
1289 return window_hscroll; 1232 return window_hscroll;
1290} 1233}
1291 1234
1292/* Return 1 if position CHARPOS is visible in window W. 1235/* Return true if position CHARPOS is visible in window W.
1293 CHARPOS < 0 means return info about WINDOW_END position. 1236 CHARPOS < 0 means return info about WINDOW_END position.
1294 If visible, set *X and *Y to pixel coordinates of top left corner. 1237 If visible, set *X and *Y to pixel coordinates of top left corner.
1295 Set *RTOP and *RBOT to pixel height of an invisible area of glyph at POS. 1238 Set *RTOP and *RBOT to pixel height of an invisible area of glyph at POS.
1296 Set *ROWH and *VPOS to row's visible height and VPOS (row number). */ 1239 Set *ROWH and *VPOS to row's visible height and VPOS (row number). */
1297 1240
1298int 1241bool
1299pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, 1242pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1300 int *rtop, int *rbot, int *rowh, int *vpos) 1243 int *rtop, int *rbot, int *rowh, int *vpos)
1301{ 1244{
1302 struct it it; 1245 struct it it;
1303 void *itdata = bidi_shelve_cache (); 1246 void *itdata = bidi_shelve_cache ();
1304 struct text_pos top; 1247 struct text_pos top;
1305 int visible_p = 0; 1248 bool visible_p = false;
1306 struct buffer *old_buffer = NULL; 1249 struct buffer *old_buffer = NULL;
1307 bool r2l = false; 1250 bool r2l = false;
1308 1251
@@ -1366,7 +1309,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1366 if (top_y < window_top_y) 1309 if (top_y < window_top_y)
1367 visible_p = bottom_y > window_top_y; 1310 visible_p = bottom_y > window_top_y;
1368 else if (top_y < it.last_visible_y) 1311 else if (top_y < it.last_visible_y)
1369 visible_p = 1; 1312 visible_p = true;
1370 if (bottom_y >= it.last_visible_y 1313 if (bottom_y >= it.last_visible_y
1371 && it.bidi_p && it.bidi_it.scan_dir == -1 1314 && it.bidi_p && it.bidi_it.scan_dir == -1
1372 && IT_CHARPOS (it) < charpos) 1315 && IT_CHARPOS (it) < charpos)
@@ -1386,7 +1329,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1386 move_it_to (&it, charpos, -1, bottom_y + ten_more_lines, -1, 1329 move_it_to (&it, charpos, -1, bottom_y + ten_more_lines, -1,
1387 MOVE_TO_POS | MOVE_TO_Y); 1330 MOVE_TO_POS | MOVE_TO_Y);
1388 if (it.current_y > top_y) 1331 if (it.current_y > top_y)
1389 visible_p = 0; 1332 visible_p = false;
1390 1333
1391 } 1334 }
1392 RESTORE_IT (&it, &save_it, save_it_data); 1335 RESTORE_IT (&it, &save_it, save_it_data);
@@ -1424,7 +1367,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1424 get_next_display_element (&it2); 1367 get_next_display_element (&it2);
1425 PRODUCE_GLYPHS (&it2); 1368 PRODUCE_GLYPHS (&it2);
1426 it2_prev = it2; 1369 it2_prev = it2;
1427 set_iterator_to_next (&it2, 1); 1370 set_iterator_to_next (&it2, true);
1428 } while (it2.method == GET_FROM_DISPLAY_VECTOR 1371 } while (it2.method == GET_FROM_DISPLAY_VECTOR
1429 && IT_CHARPOS (it2) < charpos); 1372 && IT_CHARPOS (it2) < charpos);
1430 } 1373 }
@@ -1444,13 +1387,12 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1444 Lisp_Object spec = Fget_char_property (cpos, Qdisplay, Qnil); 1387 Lisp_Object spec = Fget_char_property (cpos, Qdisplay, Qnil);
1445 Lisp_Object string = string_from_display_spec (spec); 1388 Lisp_Object string = string_from_display_spec (spec);
1446 struct text_pos tpos; 1389 struct text_pos tpos;
1447 int replacing_spec_p;
1448 bool newline_in_string 1390 bool newline_in_string
1449 = (STRINGP (string) 1391 = (STRINGP (string)
1450 && memchr (SDATA (string), '\n', SBYTES (string))); 1392 && memchr (SDATA (string), '\n', SBYTES (string)));
1451 1393
1452 SET_TEXT_POS (tpos, charpos, CHAR_TO_BYTE (charpos)); 1394 SET_TEXT_POS (tpos, charpos, CHAR_TO_BYTE (charpos));
1453 replacing_spec_p 1395 bool replacing_spec_p
1454 = (!NILP (spec) 1396 = (!NILP (spec)
1455 && handle_display_spec (NULL, spec, Qnil, Qnil, &tpos, 1397 && handle_display_spec (NULL, spec, Qnil, Qnil, &tpos,
1456 charpos, FRAME_WINDOW_P (it.f))); 1398 charpos, FRAME_WINDOW_P (it.f)));
@@ -1475,7 +1417,6 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1475 Lisp_Object startpos, endpos; 1417 Lisp_Object startpos, endpos;
1476 EMACS_INT start, end; 1418 EMACS_INT start, end;
1477 struct it it3; 1419 struct it it3;
1478 int it3_moved;
1479 1420
1480 /* Find the first and the last buffer positions 1421 /* Find the first and the last buffer positions
1481 covered by the display string. */ 1422 covered by the display string. */
@@ -1534,7 +1475,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1534 begins. */ 1475 begins. */
1535 start_display (&it3, w, top); 1476 start_display (&it3, w, top);
1536 move_it_to (&it3, -1, 0, top_y, -1, MOVE_TO_X | MOVE_TO_Y); 1477 move_it_to (&it3, -1, 0, top_y, -1, MOVE_TO_X | MOVE_TO_Y);
1537 /* If it3_moved stays zero after the 'while' loop 1478 /* If it3_moved stays false after the 'while' loop
1538 below, that means we already were at a newline 1479 below, that means we already were at a newline
1539 before the loop (e.g., the display string begins 1480 before the loop (e.g., the display string begins
1540 with a newline), so we don't need to (and cannot) 1481 with a newline), so we don't need to (and cannot)
@@ -1542,7 +1483,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1542 PRODUCE_GLYPHS will not produce anything for a 1483 PRODUCE_GLYPHS will not produce anything for a
1543 newline, and thus it3.glyph_row stays at its 1484 newline, and thus it3.glyph_row stays at its
1544 stale content it got at top of the window. */ 1485 stale content it got at top of the window. */
1545 it3_moved = 0; 1486 bool it3_moved = false;
1546 /* Finally, advance the iterator until we hit the 1487 /* Finally, advance the iterator until we hit the
1547 first display element whose character position is 1488 first display element whose character position is
1548 CHARPOS, or until the first newline from the 1489 CHARPOS, or until the first newline from the
@@ -1554,8 +1495,8 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1554 if (IT_CHARPOS (it3) == charpos 1495 if (IT_CHARPOS (it3) == charpos
1555 || ITERATOR_AT_END_OF_LINE_P (&it3)) 1496 || ITERATOR_AT_END_OF_LINE_P (&it3))
1556 break; 1497 break;
1557 it3_moved = 1; 1498 it3_moved = true;
1558 set_iterator_to_next (&it3, 0); 1499 set_iterator_to_next (&it3, false);
1559 } 1500 }
1560 top_x = it3.current_x - it3.pixel_width; 1501 top_x = it3.current_x - it3.pixel_width;
1561 /* Normally, we would exit the above loop because we 1502 /* Normally, we would exit the above loop because we
@@ -1625,9 +1566,9 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1625 r2l = true; 1566 r2l = true;
1626 } 1567 }
1627 else 1568 else
1628 bidi_unshelve_cache (it2data, 1); 1569 bidi_unshelve_cache (it2data, true);
1629 } 1570 }
1630 bidi_unshelve_cache (itdata, 0); 1571 bidi_unshelve_cache (itdata, false);
1631 1572
1632 if (old_buffer) 1573 if (old_buffer)
1633 set_buffer_internal_1 (old_buffer); 1574 set_buffer_internal_1 (old_buffer);
@@ -1647,7 +1588,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
1647 *x = window_box_width (w, TEXT_AREA) - *x - 1; 1588 *x = window_box_width (w, TEXT_AREA) - *x - 1;
1648 } 1589 }
1649 1590
1650#if 0 1591#if false
1651 /* Debugging code. */ 1592 /* Debugging code. */
1652 if (visible_p) 1593 if (visible_p)
1653 fprintf (stderr, "+pv pt=%d vs=%d --> x=%d y=%d rt=%d rb=%d rh=%d vp=%d\n", 1594 fprintf (stderr, "+pv pt=%d vs=%d --> x=%d y=%d rt=%d rb=%d rh=%d vp=%d\n",
@@ -1725,7 +1666,7 @@ string_pos (ptrdiff_t charpos, Lisp_Object string)
1725 1666
1726 1667
1727/* Value is a text position, i.e. character and byte position, for 1668/* Value is a text position, i.e. character and byte position, for
1728 character position CHARPOS in C string S. MULTIBYTE_P non-zero 1669 character position CHARPOS in C string S. MULTIBYTE_P
1729 means recognize multibyte characters. */ 1670 means recognize multibyte characters. */
1730 1671
1731static struct text_pos 1672static struct text_pos
@@ -1757,7 +1698,7 @@ c_string_pos (ptrdiff_t charpos, const char *s, bool multibyte_p)
1757 1698
1758 1699
1759/* Value is the number of characters in C string S. MULTIBYTE_P 1700/* Value is the number of characters in C string S. MULTIBYTE_P
1760 non-zero means recognize multibyte characters. */ 1701 means recognize multibyte characters. */
1761 1702
1762static ptrdiff_t 1703static ptrdiff_t
1763number_of_chars (const char *s, bool multibyte_p) 1704number_of_chars (const char *s, bool multibyte_p)
@@ -1835,12 +1776,12 @@ estimate_mode_line_height (struct frame *f, enum face_id face_id)
1835 1776
1836/* Given a pixel position (PIX_X, PIX_Y) on frame F, return glyph 1777/* Given a pixel position (PIX_X, PIX_Y) on frame F, return glyph
1837 co-ordinates in (*X, *Y). Set *BOUNDS to the rectangle that the 1778 co-ordinates in (*X, *Y). Set *BOUNDS to the rectangle that the
1838 glyph at X, Y occupies, if BOUNDS != 0. If NOCLIP is non-zero, do 1779 glyph at X, Y occupies, if BOUNDS != 0. If NOCLIP, do
1839 not force the value into range. */ 1780 not force the value into range. */
1840 1781
1841void 1782void
1842pixel_to_glyph_coords (struct frame *f, register int pix_x, register int pix_y, 1783pixel_to_glyph_coords (struct frame *f, int pix_x, int pix_y, int *x, int *y,
1843 int *x, int *y, NativeRectangle *bounds, int noclip) 1784 NativeRectangle *bounds, bool noclip)
1844{ 1785{
1845 1786
1846#ifdef HAVE_WINDOW_SYSTEM 1787#ifdef HAVE_WINDOW_SYSTEM
@@ -2281,7 +2222,7 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect)
2281 goto virtual_glyph; 2222 goto virtual_glyph;
2282 } 2223 }
2283 else if (!f->glyphs_initialized_p 2224 else if (!f->glyphs_initialized_p
2284 || (window = window_from_coordinates (f, gx, gy, &part, 0), 2225 || (window = window_from_coordinates (f, gx, gy, &part, false),
2285 NILP (window))) 2226 NILP (window)))
2286 { 2227 {
2287 width = FRAME_SMALLEST_CHAR_WIDTH (f); 2228 width = FRAME_SMALLEST_CHAR_WIDTH (f);
@@ -2488,13 +2429,11 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect)
2488 STORE_NATIVE_RECT (*rect, gx, gy, width, height); 2429 STORE_NATIVE_RECT (*rect, gx, gy, width, height);
2489 2430
2490 /* Visible feedback for debugging. */ 2431 /* Visible feedback for debugging. */
2491#if 0 2432#if false && defined HAVE_X_WINDOWS
2492#if HAVE_X_WINDOWS
2493 XDrawRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 2433 XDrawRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
2494 f->output_data.x->normal_gc, 2434 f->output_data.x->normal_gc,
2495 gx, gy, width, height); 2435 gx, gy, width, height);
2496#endif 2436#endif
2497#endif
2498} 2437}
2499 2438
2500 2439
@@ -2621,14 +2560,13 @@ safe_call2 (Lisp_Object fn, Lisp_Object arg1, Lisp_Object arg2)
2621 Debugging 2560 Debugging
2622 ***********************************************************************/ 2561 ***********************************************************************/
2623 2562
2624#if 0
2625
2626/* Define CHECK_IT to perform sanity checks on iterators. 2563/* Define CHECK_IT to perform sanity checks on iterators.
2627 This is for debugging. It is too slow to do unconditionally. */ 2564 This is for debugging. It is too slow to do unconditionally. */
2628 2565
2629static void 2566static void
2630check_it (struct it *it) 2567CHECK_IT (struct it *it)
2631{ 2568{
2569#if false
2632 if (it->method == GET_FROM_STRING) 2570 if (it->method == GET_FROM_STRING)
2633 { 2571 {
2634 eassert (STRINGP (it->string)); 2572 eassert (STRINGP (it->string));
@@ -2648,25 +2586,17 @@ check_it (struct it *it)
2648 eassert (it->current.dpvec_index >= 0); 2586 eassert (it->current.dpvec_index >= 0);
2649 else 2587 else
2650 eassert (it->current.dpvec_index < 0); 2588 eassert (it->current.dpvec_index < 0);
2589#endif
2651} 2590}
2652 2591
2653#define CHECK_IT(IT) check_it ((IT))
2654
2655#else /* not 0 */
2656
2657#define CHECK_IT(IT) (void) 0
2658
2659#endif /* not 0 */
2660
2661
2662#if defined GLYPH_DEBUG && defined ENABLE_CHECKING
2663 2592
2664/* Check that the window end of window W is what we expect it 2593/* Check that the window end of window W is what we expect it
2665 to be---the last row in the current matrix displaying text. */ 2594 to be---the last row in the current matrix displaying text. */
2666 2595
2667static void 2596static void
2668check_window_end (struct window *w) 2597CHECK_WINDOW_END (struct window *w)
2669{ 2598{
2599#if defined GLYPH_DEBUG && defined ENABLE_CHECKING
2670 if (!MINI_WINDOW_P (w) && w->window_end_valid) 2600 if (!MINI_WINDOW_P (w) && w->window_end_valid)
2671 { 2601 {
2672 struct glyph_row *row; 2602 struct glyph_row *row;
@@ -2675,16 +2605,9 @@ check_window_end (struct window *w)
2675 || MATRIX_ROW_DISPLAYS_TEXT_P (row) 2605 || MATRIX_ROW_DISPLAYS_TEXT_P (row)
2676 || MATRIX_ROW_VPOS (row, w->current_matrix) == 0)); 2606 || MATRIX_ROW_VPOS (row, w->current_matrix) == 0));
2677 } 2607 }
2608#endif
2678} 2609}
2679 2610
2680#define CHECK_WINDOW_END(W) check_window_end ((W))
2681
2682#else
2683
2684#define CHECK_WINDOW_END(W) (void) 0
2685
2686#endif /* GLYPH_DEBUG and ENABLE_CHECKING */
2687
2688/*********************************************************************** 2611/***********************************************************************
2689 Iterator initialization 2612 Iterator initialization
2690 ***********************************************************************/ 2613 ***********************************************************************/
@@ -2982,13 +2905,13 @@ init_iterator (struct it *it, struct window *w,
2982 it->paragraph_embedding = R2L; 2905 it->paragraph_embedding = R2L;
2983 else 2906 else
2984 it->paragraph_embedding = NEUTRAL_DIR; 2907 it->paragraph_embedding = NEUTRAL_DIR;
2985 bidi_unshelve_cache (NULL, 0); 2908 bidi_unshelve_cache (NULL, false);
2986 bidi_init_it (charpos, IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), 2909 bidi_init_it (charpos, IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f),
2987 &it->bidi_it); 2910 &it->bidi_it);
2988 } 2911 }
2989 2912
2990 /* Compute faces etc. */ 2913 /* Compute faces etc. */
2991 reseat (it, it->current.pos, 1); 2914 reseat (it, it->current.pos, true);
2992 } 2915 }
2993 2916
2994 CHECK_IT (it); 2917 CHECK_IT (it);
@@ -3001,7 +2924,7 @@ void
3001start_display (struct it *it, struct window *w, struct text_pos pos) 2924start_display (struct it *it, struct window *w, struct text_pos pos)
3002{ 2925{
3003 struct glyph_row *row; 2926 struct glyph_row *row;
3004 int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0; 2927 bool first_vpos = WINDOW_WANTS_HEADER_LINE_P (w);
3005 2928
3006 row = w->desired_matrix->rows + first_vpos; 2929 row = w->desired_matrix->rows + first_vpos;
3007 init_iterator (it, w, CHARPOS (pos), BYTEPOS (pos), row, DEFAULT_FACE_ID); 2930 init_iterator (it, w, CHARPOS (pos), BYTEPOS (pos), row, DEFAULT_FACE_ID);
@@ -3011,13 +2934,12 @@ start_display (struct it *it, struct window *w, struct text_pos pos)
3011 position is in a string or image. */ 2934 position is in a string or image. */
3012 if (it->method == GET_FROM_BUFFER && it->line_wrap != TRUNCATE) 2935 if (it->method == GET_FROM_BUFFER && it->line_wrap != TRUNCATE)
3013 { 2936 {
3014 int start_at_line_beg_p;
3015 int first_y = it->current_y; 2937 int first_y = it->current_y;
3016 2938
3017 /* If window start is not at a line start, skip forward to POS to 2939 /* If window start is not at a line start, skip forward to POS to
3018 get the correct continuation lines width. */ 2940 get the correct continuation lines width. */
3019 start_at_line_beg_p = (CHARPOS (pos) == BEGV 2941 bool start_at_line_beg_p = (CHARPOS (pos) == BEGV
3020 || FETCH_BYTE (BYTEPOS (pos) - 1) == '\n'); 2942 || FETCH_BYTE (BYTEPOS (pos) - 1) == '\n');
3021 if (!start_at_line_beg_p) 2943 if (!start_at_line_beg_p)
3022 { 2944 {
3023 int new_x; 2945 int new_x;
@@ -3054,7 +2976,7 @@ start_display (struct it *it, struct window *w, struct text_pos pos)
3054 (If we do go to the next line, C-e will not DTRT.) */ 2976 (If we do go to the next line, C-e will not DTRT.) */
3055 && it->c != '\n') 2977 && it->c != '\n')
3056 { 2978 {
3057 set_iterator_to_next (it, 1); 2979 set_iterator_to_next (it, true);
3058 move_it_in_display_line_to (it, -1, -1, 0); 2980 move_it_in_display_line_to (it, -1, -1, 0);
3059 } 2981 }
3060 2982
@@ -3082,14 +3004,14 @@ start_display (struct it *it, struct window *w, struct text_pos pos)
3082} 3004}
3083 3005
3084 3006
3085/* Return 1 if POS is a position in ellipses displayed for invisible 3007/* Return true if POS is a position in ellipses displayed for invisible
3086 text. W is the window we display, for text property lookup. */ 3008 text. W is the window we display, for text property lookup. */
3087 3009
3088static int 3010static bool
3089in_ellipses_for_invisible_text_p (struct display_pos *pos, struct window *w) 3011in_ellipses_for_invisible_text_p (struct display_pos *pos, struct window *w)
3090{ 3012{
3091 Lisp_Object prop, window; 3013 Lisp_Object prop, window;
3092 int ellipses_p = 0; 3014 bool ellipses_p = false;
3093 ptrdiff_t charpos = CHARPOS (pos->pos); 3015 ptrdiff_t charpos = CHARPOS (pos->pos);
3094 3016
3095 /* If POS specifies a position in a display vector, this might 3017 /* If POS specifies a position in a display vector, this might
@@ -3103,7 +3025,7 @@ in_ellipses_for_invisible_text_p (struct display_pos *pos, struct window *w)
3103 && (XSETWINDOW (window, w), 3025 && (XSETWINDOW (window, w),
3104 prop = Fget_char_property (make_number (charpos), 3026 prop = Fget_char_property (make_number (charpos),
3105 Qinvisible, window), 3027 Qinvisible, window),
3106 !TEXT_PROP_MEANS_INVISIBLE (prop))) 3028 TEXT_PROP_MEANS_INVISIBLE (prop) == 0))
3107 { 3029 {
3108 prop = Fget_char_property (make_number (charpos - 1), Qinvisible, 3030 prop = Fget_char_property (make_number (charpos - 1), Qinvisible,
3109 window); 3031 window);
@@ -3117,13 +3039,14 @@ in_ellipses_for_invisible_text_p (struct display_pos *pos, struct window *w)
3117/* Initialize IT for stepping through current_buffer in window W, 3039/* Initialize IT for stepping through current_buffer in window W,
3118 starting at position POS that includes overlay string and display 3040 starting at position POS that includes overlay string and display
3119 vector/ control character translation position information. Value 3041 vector/ control character translation position information. Value
3120 is zero if there are overlay strings with newlines at POS. */ 3042 is false if there are overlay strings with newlines at POS. */
3121 3043
3122static int 3044static bool
3123init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos) 3045init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos)
3124{ 3046{
3125 ptrdiff_t charpos = CHARPOS (pos->pos), bytepos = BYTEPOS (pos->pos); 3047 ptrdiff_t charpos = CHARPOS (pos->pos), bytepos = BYTEPOS (pos->pos);
3126 int i, overlay_strings_with_newlines = 0; 3048 int i;
3049 bool overlay_strings_with_newlines = false;
3127 3050
3128 /* If POS specifies a position in a display vector, this might 3051 /* If POS specifies a position in a display vector, this might
3129 be for an ellipsis displayed for invisible text. We won't 3052 be for an ellipsis displayed for invisible text. We won't
@@ -3159,7 +3082,7 @@ init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos)
3159 3082
3160 if (s < e) 3083 if (s < e)
3161 { 3084 {
3162 overlay_strings_with_newlines = 1; 3085 overlay_strings_with_newlines = true;
3163 break; 3086 break;
3164 } 3087 }
3165 } 3088 }
@@ -3277,13 +3200,13 @@ init_to_row_start (struct it *it, struct window *w, struct glyph_row *row)
3277 3200
3278/* Initialize IT for stepping through current_buffer in window W 3201/* Initialize IT for stepping through current_buffer in window W
3279 starting in the line following ROW, i.e. starting at ROW->end. 3202 starting in the line following ROW, i.e. starting at ROW->end.
3280 Value is zero if there are overlay strings with newlines at ROW's 3203 Value is false if there are overlay strings with newlines at ROW's
3281 end position. */ 3204 end position. */
3282 3205
3283static int 3206static bool
3284init_to_row_end (struct it *it, struct window *w, struct glyph_row *row) 3207init_to_row_end (struct it *it, struct window *w, struct glyph_row *row)
3285{ 3208{
3286 int success = 0; 3209 bool success = false;
3287 3210
3288 if (init_from_display_pos (it, w, &row->end)) 3211 if (init_from_display_pos (it, w, &row->end))
3289 { 3212 {
@@ -3291,7 +3214,7 @@ init_to_row_end (struct it *it, struct window *w, struct glyph_row *row)
3291 it->continuation_lines_width 3214 it->continuation_lines_width
3292 = row->continuation_lines_width + row->pixel_width; 3215 = row->continuation_lines_width + row->pixel_width;
3293 CHECK_IT (it); 3216 CHECK_IT (it);
3294 success = 1; 3217 success = true;
3295 } 3218 }
3296 3219
3297 return success; 3220 return success;
@@ -3312,14 +3235,14 @@ static void
3312handle_stop (struct it *it) 3235handle_stop (struct it *it)
3313{ 3236{
3314 enum prop_handled handled; 3237 enum prop_handled handled;
3315 int handle_overlay_change_p; 3238 bool handle_overlay_change_p;
3316 struct props *p; 3239 struct props *p;
3317 3240
3318 it->dpvec = NULL; 3241 it->dpvec = NULL;
3319 it->current.dpvec_index = -1; 3242 it->current.dpvec_index = -1;
3320 handle_overlay_change_p = !it->ignore_overlay_strings_at_pos_p; 3243 handle_overlay_change_p = !it->ignore_overlay_strings_at_pos_p;
3321 it->ignore_overlay_strings_at_pos_p = 0; 3244 it->ignore_overlay_strings_at_pos_p = false;
3322 it->ellipsis_p = 0; 3245 it->ellipsis_p = false;
3323 3246
3324 /* Use face of preceding text for ellipsis (if invisible) */ 3247 /* Use face of preceding text for ellipsis (if invisible) */
3325 if (it->selective_display_ellipsis_p) 3248 if (it->selective_display_ellipsis_p)
@@ -3391,8 +3314,7 @@ handle_stop (struct it *it)
3391 expected by the rest of the code that processes 3314 expected by the rest of the code that processes
3392 overlay strings. */ 3315 overlay strings. */
3393 || (it->current.overlay_string_index < 0 3316 || (it->current.overlay_string_index < 0
3394 ? !get_overlay_strings_1 (it, 0, 0) 3317 && !get_overlay_strings_1 (it, 0, false)))
3395 : 0))
3396 { 3318 {
3397 if (it->ellipsis_p) 3319 if (it->ellipsis_p)
3398 setup_for_ellipsis (it, 0); 3320 setup_for_ellipsis (it, 0);
@@ -3410,15 +3332,15 @@ handle_stop (struct it *it)
3410 else 3332 else
3411 { 3333 {
3412 it->ignore_overlay_strings_at_pos_p = true; 3334 it->ignore_overlay_strings_at_pos_p = true;
3413 it->string_from_display_prop_p = 0; 3335 it->string_from_display_prop_p = false;
3414 it->from_disp_prop_p = 0; 3336 it->from_disp_prop_p = false;
3415 handle_overlay_change_p = 0; 3337 handle_overlay_change_p = false;
3416 } 3338 }
3417 handled = HANDLED_RECOMPUTE_PROPS; 3339 handled = HANDLED_RECOMPUTE_PROPS;
3418 break; 3340 break;
3419 } 3341 }
3420 else if (handled == HANDLED_OVERLAY_STRING_CONSUMED) 3342 else if (handled == HANDLED_OVERLAY_STRING_CONSUMED)
3421 handle_overlay_change_p = 0; 3343 handle_overlay_change_p = false;
3422 } 3344 }
3423 3345
3424 if (handled != HANDLED_RECOMPUTE_PROPS) 3346 if (handled != HANDLED_RECOMPUTE_PROPS)
@@ -3426,7 +3348,7 @@ handle_stop (struct it *it)
3426 /* Don't check for overlay strings below when set to deliver 3348 /* Don't check for overlay strings below when set to deliver
3427 characters from a display vector. */ 3349 characters from a display vector. */
3428 if (it->method == GET_FROM_DISPLAY_VECTOR) 3350 if (it->method == GET_FROM_DISPLAY_VECTOR)
3429 handle_overlay_change_p = 0; 3351 handle_overlay_change_p = false;
3430 3352
3431 /* Handle overlay changes. 3353 /* Handle overlay changes.
3432 This sets HANDLED to HANDLED_RECOMPUTE_PROPS 3354 This sets HANDLED to HANDLED_RECOMPUTE_PROPS
@@ -3498,7 +3420,7 @@ compute_stop_pos (struct it *it)
3498 /* Get the interval containing IT's position. Value is a null 3420 /* Get the interval containing IT's position. Value is a null
3499 interval if there isn't such an interval. */ 3421 interval if there isn't such an interval. */
3500 position = make_number (charpos); 3422 position = make_number (charpos);
3501 iv = validate_interval_range (object, &position, &position, 0); 3423 iv = validate_interval_range (object, &position, &position, false);
3502 if (iv) 3424 if (iv)
3503 { 3425 {
3504 Lisp_Object values_here[LAST_PROP_IDX]; 3426 Lisp_Object values_here[LAST_PROP_IDX];
@@ -3571,7 +3493,7 @@ next_overlay_change (ptrdiff_t pos)
3571 USE_SAFE_ALLOCA; 3493 USE_SAFE_ALLOCA;
3572 3494
3573 /* Get all overlays at the given position. */ 3495 /* Get all overlays at the given position. */
3574 GET_OVERLAYS_AT (pos, overlays, noverlays, &endpos, 1); 3496 GET_OVERLAYS_AT (pos, overlays, noverlays, &endpos, true);
3575 3497
3576 /* If any of these overlays ends before endpos, 3498 /* If any of these overlays ends before endpos,
3577 use its ending point instead. */ 3499 use its ending point instead. */
@@ -3600,7 +3522,7 @@ next_overlay_change (ptrdiff_t pos)
3600 with `display' property whose value is a string, or a `display' 3522 with `display' property whose value is a string, or a `display'
3601 text property whose value is a string. STRING is data about the 3523 text property whose value is a string. STRING is data about the
3602 string to iterate; if STRING->lstring is nil, we are iterating a 3524 string to iterate; if STRING->lstring is nil, we are iterating a
3603 buffer. FRAME_WINDOW_P is non-zero when we are displaying a window 3525 buffer. FRAME_WINDOW_P is true when we are displaying a window
3604 on a GUI frame. DISP_PROP is set to zero if we searched 3526 on a GUI frame. DISP_PROP is set to zero if we searched
3605 MAX_DISP_SCAN characters forward without finding any display 3527 MAX_DISP_SCAN characters forward without finding any display
3606 strings, non-zero otherwise. It is set to 2 if the display string 3528 strings, non-zero otherwise. It is set to 2 if the display string
@@ -3610,12 +3532,12 @@ ptrdiff_t
3610compute_display_string_pos (struct text_pos *position, 3532compute_display_string_pos (struct text_pos *position,
3611 struct bidi_string_data *string, 3533 struct bidi_string_data *string,
3612 struct window *w, 3534 struct window *w,
3613 int frame_window_p, int *disp_prop) 3535 bool frame_window_p, int *disp_prop)
3614{ 3536{
3615 /* OBJECT = nil means current buffer. */ 3537 /* OBJECT = nil means current buffer. */
3616 Lisp_Object object, object1; 3538 Lisp_Object object, object1;
3617 Lisp_Object pos, spec, limpos; 3539 Lisp_Object pos, spec, limpos;
3618 int string_p = (string && (STRINGP (string->lstring) || string->s)); 3540 bool string_p = string && (STRINGP (string->lstring) || string->s);
3619 ptrdiff_t eob = string_p ? string->schars : ZV; 3541 ptrdiff_t eob = string_p ? string->schars : ZV;
3620 ptrdiff_t begb = string_p ? 0 : BEGV; 3542 ptrdiff_t begb = string_p ? 0 : BEGV;
3621 ptrdiff_t bufpos, charpos = CHARPOS (*position); 3543 ptrdiff_t bufpos, charpos = CHARPOS (*position);
@@ -4037,12 +3959,12 @@ underlying_face_id (struct it *it)
4037 3959
4038 3960
4039/* Compute the face one character before or after the current position 3961/* Compute the face one character before or after the current position
4040 of IT, in the visual order. BEFORE_P non-zero means get the face 3962 of IT, in the visual order. BEFORE_P means get the face
4041 in front (to the left in L2R paragraphs, to the right in R2L 3963 in front (to the left in L2R paragraphs, to the right in R2L
4042 paragraphs) of IT's screen position. Value is the ID of the face. */ 3964 paragraphs) of IT's screen position. Value is the ID of the face. */
4043 3965
4044static int 3966static int
4045face_before_or_after_it_pos (struct it *it, int before_p) 3967face_before_or_after_it_pos (struct it *it, bool before_p)
4046{ 3968{
4047 int face_id, limit; 3969 int face_id, limit;
4048 ptrdiff_t next_check_charpos; 3970 ptrdiff_t next_check_charpos;
@@ -4248,7 +4170,7 @@ static enum prop_handled
4248handle_invisible_prop (struct it *it) 4170handle_invisible_prop (struct it *it)
4249{ 4171{
4250 enum prop_handled handled = HANDLED_NORMALLY; 4172 enum prop_handled handled = HANDLED_NORMALLY;
4251 int invis_p; 4173 int invis;
4252 Lisp_Object prop; 4174 Lisp_Object prop;
4253 4175
4254 if (STRINGP (it->string)) 4176 if (STRINGP (it->string))
@@ -4260,13 +4182,13 @@ handle_invisible_prop (struct it *it)
4260 property. */ 4182 property. */
4261 charpos = make_number (IT_STRING_CHARPOS (*it)); 4183 charpos = make_number (IT_STRING_CHARPOS (*it));
4262 prop = Fget_text_property (charpos, Qinvisible, it->string); 4184 prop = Fget_text_property (charpos, Qinvisible, it->string);
4263 invis_p = TEXT_PROP_MEANS_INVISIBLE (prop); 4185 invis = TEXT_PROP_MEANS_INVISIBLE (prop);
4264 4186
4265 if (invis_p && IT_STRING_CHARPOS (*it) < it->end_charpos) 4187 if (invis != 0 && IT_STRING_CHARPOS (*it) < it->end_charpos)
4266 { 4188 {
4267 /* Record whether we have to display an ellipsis for the 4189 /* Record whether we have to display an ellipsis for the
4268 invisible text. */ 4190 invisible text. */
4269 int display_ellipsis_p = (invis_p == 2); 4191 bool display_ellipsis_p = (invis == 2);
4270 ptrdiff_t len, endpos; 4192 ptrdiff_t len, endpos;
4271 4193
4272 handled = HANDLED_RECOMPUTE_PROPS; 4194 handled = HANDLED_RECOMPUTE_PROPS;
@@ -4283,12 +4205,12 @@ handle_invisible_prop (struct it *it)
4283 { 4205 {
4284 endpos = XFASTINT (end_charpos); 4206 endpos = XFASTINT (end_charpos);
4285 prop = Fget_text_property (end_charpos, Qinvisible, it->string); 4207 prop = Fget_text_property (end_charpos, Qinvisible, it->string);
4286 invis_p = TEXT_PROP_MEANS_INVISIBLE (prop); 4208 invis = TEXT_PROP_MEANS_INVISIBLE (prop);
4287 if (invis_p == 2) 4209 if (invis == 2)
4288 display_ellipsis_p = true; 4210 display_ellipsis_p = true;
4289 } 4211 }
4290 } 4212 }
4291 while (invis_p && endpos < len); 4213 while (invis != 0 && endpos < len);
4292 4214
4293 if (display_ellipsis_p) 4215 if (display_ellipsis_p)
4294 it->ellipsis_p = true; 4216 it->ellipsis_p = true;
@@ -4306,7 +4228,7 @@ handle_invisible_prop (struct it *it)
4306 if (it->bidi_it.first_elt 4228 if (it->bidi_it.first_elt
4307 && it->bidi_it.charpos < SCHARS (it->string)) 4229 && it->bidi_it.charpos < SCHARS (it->string))
4308 bidi_paragraph_init (it->paragraph_embedding, 4230 bidi_paragraph_init (it->paragraph_embedding,
4309 &it->bidi_it, 1); 4231 &it->bidi_it, true);
4310 /* Bidi-iterate out of the invisible text. */ 4232 /* Bidi-iterate out of the invisible text. */
4311 do 4233 do
4312 { 4234 {
@@ -4357,14 +4279,14 @@ handle_invisible_prop (struct it *it)
4357 pos = make_number (tem); 4279 pos = make_number (tem);
4358 prop = get_char_property_and_overlay (pos, Qinvisible, it->window, 4280 prop = get_char_property_and_overlay (pos, Qinvisible, it->window,
4359 &overlay); 4281 &overlay);
4360 invis_p = TEXT_PROP_MEANS_INVISIBLE (prop); 4282 invis = TEXT_PROP_MEANS_INVISIBLE (prop);
4361 4283
4362 /* If we are on invisible text, skip over it. */ 4284 /* If we are on invisible text, skip over it. */
4363 if (invis_p && start_charpos < it->end_charpos) 4285 if (invis != 0 && start_charpos < it->end_charpos)
4364 { 4286 {
4365 /* Record whether we have to display an ellipsis for the 4287 /* Record whether we have to display an ellipsis for the
4366 invisible text. */ 4288 invisible text. */
4367 int display_ellipsis_p = invis_p == 2; 4289 bool display_ellipsis_p = invis == 2;
4368 4290
4369 handled = HANDLED_RECOMPUTE_PROPS; 4291 handled = HANDLED_RECOMPUTE_PROPS;
4370 4292
@@ -4383,39 +4305,39 @@ handle_invisible_prop (struct it *it)
4383 text in the first place. If everything to the end of 4305 text in the first place. If everything to the end of
4384 the buffer was skipped, end the loop. */ 4306 the buffer was skipped, end the loop. */
4385 if (newpos == tem || newpos >= ZV) 4307 if (newpos == tem || newpos >= ZV)
4386 invis_p = 0; 4308 invis = 0;
4387 else 4309 else
4388 { 4310 {
4389 /* We skipped some characters but not necessarily 4311 /* We skipped some characters but not necessarily
4390 all there are. Check if we ended up on visible 4312 all there are. Check if we ended up on visible
4391 text. Fget_char_property returns the property of 4313 text. Fget_char_property returns the property of
4392 the char before the given position, i.e. if we 4314 the char before the given position, i.e. if we
4393 get invis_p = 0, this means that the char at 4315 get invis = 0, this means that the char at
4394 newpos is visible. */ 4316 newpos is visible. */
4395 pos = make_number (newpos); 4317 pos = make_number (newpos);
4396 prop = Fget_char_property (pos, Qinvisible, it->window); 4318 prop = Fget_char_property (pos, Qinvisible, it->window);
4397 invis_p = TEXT_PROP_MEANS_INVISIBLE (prop); 4319 invis = TEXT_PROP_MEANS_INVISIBLE (prop);
4398 } 4320 }
4399 4321
4400 /* If we ended up on invisible text, proceed to 4322 /* If we ended up on invisible text, proceed to
4401 skip starting with next_stop. */ 4323 skip starting with next_stop. */
4402 if (invis_p) 4324 if (invis != 0)
4403 tem = next_stop; 4325 tem = next_stop;
4404 4326
4405 /* If there are adjacent invisible texts, don't lose the 4327 /* If there are adjacent invisible texts, don't lose the
4406 second one's ellipsis. */ 4328 second one's ellipsis. */
4407 if (invis_p == 2) 4329 if (invis == 2)
4408 display_ellipsis_p = true; 4330 display_ellipsis_p = true;
4409 } 4331 }
4410 while (invis_p); 4332 while (invis != 0);
4411 4333
4412 /* The position newpos is now either ZV or on visible text. */ 4334 /* The position newpos is now either ZV or on visible text. */
4413 if (it->bidi_p) 4335 if (it->bidi_p)
4414 { 4336 {
4415 ptrdiff_t bpos = CHAR_TO_BYTE (newpos); 4337 ptrdiff_t bpos = CHAR_TO_BYTE (newpos);
4416 int on_newline 4338 bool on_newline
4417 = bpos == ZV_BYTE || FETCH_BYTE (bpos) == '\n'; 4339 = bpos == ZV_BYTE || FETCH_BYTE (bpos) == '\n';
4418 int after_newline 4340 bool after_newline
4419 = newpos <= BEGV || FETCH_BYTE (bpos - 1) == '\n'; 4341 = newpos <= BEGV || FETCH_BYTE (bpos - 1) == '\n';
4420 4342
4421 /* If the invisible text ends on a newline or on a 4343 /* If the invisible text ends on a newline or on a
@@ -4431,7 +4353,7 @@ handle_invisible_prop (struct it *it)
4431 bidi_dir_t pdir = it->bidi_it.paragraph_dir; 4353 bidi_dir_t pdir = it->bidi_it.paragraph_dir;
4432 4354
4433 SET_TEXT_POS (tpos, newpos, bpos); 4355 SET_TEXT_POS (tpos, newpos, bpos);
4434 reseat_1 (it, tpos, 0); 4356 reseat_1 (it, tpos, false);
4435 /* If we reseat on a newline/ZV, we need to prep the 4357 /* If we reseat on a newline/ZV, we need to prep the
4436 bidi iterator for advancing to the next character 4358 bidi iterator for advancing to the next character
4437 after the newline/EOB, keeping the current paragraph 4359 after the newline/EOB, keeping the current paragraph
@@ -4439,7 +4361,7 @@ handle_invisible_prop (struct it *it)
4439 prepending/appending glyphs to a glyph row). */ 4361 prepending/appending glyphs to a glyph row). */
4440 if (on_newline) 4362 if (on_newline)
4441 { 4363 {
4442 it->bidi_it.first_elt = 0; 4364 it->bidi_it.first_elt = false;
4443 it->bidi_it.paragraph_dir = pdir; 4365 it->bidi_it.paragraph_dir = pdir;
4444 it->bidi_it.ch = (bpos == ZV_BYTE) ? -1 : '\n'; 4366 it->bidi_it.ch = (bpos == ZV_BYTE) ? -1 : '\n';
4445 it->bidi_it.nchars = 1; 4367 it->bidi_it.nchars = 1;
@@ -4468,7 +4390,7 @@ handle_invisible_prop (struct it *it)
4468 text at the beginning, which resets the 4390 text at the beginning, which resets the
4469 FIRST_ELT flag. */ 4391 FIRST_ELT flag. */
4470 bidi_paragraph_init (it->paragraph_embedding, 4392 bidi_paragraph_init (it->paragraph_embedding,
4471 &it->bidi_it, 1); 4393 &it->bidi_it, true);
4472 } 4394 }
4473 do 4395 do
4474 { 4396 {
@@ -4513,7 +4435,7 @@ handle_invisible_prop (struct it *it)
4513 ended. So we play it safe here and force the 4435 ended. So we play it safe here and force the
4514 iterator to check for potential stop positions 4436 iterator to check for potential stop positions
4515 immediately after the invisible text. Note that 4437 immediately after the invisible text. Note that
4516 if get_overlay_strings returns non-zero, it 4438 if get_overlay_strings returns true, it
4517 normally also pushed the iterator stack, so we 4439 normally also pushed the iterator stack, so we
4518 need to update the stop position in the slot 4440 need to update the stop position in the slot
4519 below the current one. */ 4441 below the current one. */
@@ -4607,7 +4529,7 @@ handle_display_prop (struct it *it)
4607 struct text_pos *position; 4529 struct text_pos *position;
4608 ptrdiff_t bufpos; 4530 ptrdiff_t bufpos;
4609 /* Nonzero if some property replaces the display of the text itself. */ 4531 /* Nonzero if some property replaces the display of the text itself. */
4610 int display_replaced_p = 0; 4532 int display_replaced = 0;
4611 4533
4612 if (STRINGP (it->string)) 4534 if (STRINGP (it->string))
4613 { 4535 {
@@ -4644,11 +4566,10 @@ handle_display_prop (struct it *it)
4644 if (!STRINGP (it->string)) 4566 if (!STRINGP (it->string))
4645 object = it->w->contents; 4567 object = it->w->contents;
4646 4568
4647 display_replaced_p = handle_display_spec (it, propval, object, overlay, 4569 display_replaced = handle_display_spec (it, propval, object, overlay,
4648 position, bufpos, 4570 position, bufpos,
4649 FRAME_WINDOW_P (it->f)); 4571 FRAME_WINDOW_P (it->f));
4650 4572 return display_replaced != 0 ? HANDLED_RETURN : HANDLED_NORMALLY;
4651 return display_replaced_p ? HANDLED_RETURN : HANDLED_NORMALLY;
4652} 4573}
4653 4574
4654/* Subroutine of handle_display_prop. Returns non-zero if the display 4575/* Subroutine of handle_display_prop. Returns non-zero if the display
@@ -4659,7 +4580,7 @@ handle_display_prop (struct it *it)
4659 compute_display_string_pos, which see. 4580 compute_display_string_pos, which see.
4660 4581
4661 See handle_single_display_spec for documentation of arguments. 4582 See handle_single_display_spec for documentation of arguments.
4662 frame_window_p is non-zero if the window being redisplayed is on a 4583 FRAME_WINDOW_P is true if the window being redisplayed is on a
4663 GUI frame; this argument is used only if IT is NULL, see below. 4584 GUI frame; this argument is used only if IT is NULL, see below.
4664 4585
4665 IT can be NULL, if this is called by the bidi reordering code 4586 IT can be NULL, if this is called by the bidi reordering code
@@ -4670,10 +4591,9 @@ handle_display_prop (struct it *it)
4670static int 4591static int
4671handle_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, 4592handle_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4672 Lisp_Object overlay, struct text_pos *position, 4593 Lisp_Object overlay, struct text_pos *position,
4673 ptrdiff_t bufpos, int frame_window_p) 4594 ptrdiff_t bufpos, bool frame_window_p)
4674{ 4595{
4675 int replacing_p = 0; 4596 int replacing = 0;
4676 int rv;
4677 4597
4678 if (CONSP (spec) 4598 if (CONSP (spec)
4679 /* Simple specifications. */ 4599 /* Simple specifications. */
@@ -4692,11 +4612,12 @@ handle_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4692 { 4612 {
4693 for (; CONSP (spec); spec = XCDR (spec)) 4613 for (; CONSP (spec); spec = XCDR (spec))
4694 { 4614 {
4695 if ((rv = handle_single_display_spec (it, XCAR (spec), object, 4615 int rv = handle_single_display_spec (it, XCAR (spec), object,
4696 overlay, position, bufpos, 4616 overlay, position, bufpos,
4697 replacing_p, frame_window_p))) 4617 replacing, frame_window_p);
4618 if (rv != 0)
4698 { 4619 {
4699 replacing_p = rv; 4620 replacing = rv;
4700 /* If some text in a string is replaced, `position' no 4621 /* If some text in a string is replaced, `position' no
4701 longer points to the position of `object'. */ 4622 longer points to the position of `object'. */
4702 if (!it || STRINGP (object)) 4623 if (!it || STRINGP (object))
@@ -4708,26 +4629,24 @@ handle_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4708 { 4629 {
4709 ptrdiff_t i; 4630 ptrdiff_t i;
4710 for (i = 0; i < ASIZE (spec); ++i) 4631 for (i = 0; i < ASIZE (spec); ++i)
4711 if ((rv = handle_single_display_spec (it, AREF (spec, i), object, 4632 {
4712 overlay, position, bufpos, 4633 int rv = handle_single_display_spec (it, AREF (spec, i), object,
4713 replacing_p, frame_window_p))) 4634 overlay, position, bufpos,
4714 { 4635 replacing, frame_window_p);
4715 replacing_p = rv; 4636 if (rv != 0)
4716 /* If some text in a string is replaced, `position' no 4637 {
4717 longer points to the position of `object'. */ 4638 replacing = rv;
4718 if (!it || STRINGP (object)) 4639 /* If some text in a string is replaced, `position' no
4719 break; 4640 longer points to the position of `object'. */
4720 } 4641 if (!it || STRINGP (object))
4642 break;
4643 }
4644 }
4721 } 4645 }
4722 else 4646 else
4723 { 4647 replacing = handle_single_display_spec (it, spec, object, overlay, position,
4724 if ((rv = handle_single_display_spec (it, spec, object, overlay, 4648 bufpos, 0, frame_window_p);
4725 position, bufpos, 0, 4649 return replacing;
4726 frame_window_p)))
4727 replacing_p = rv;
4728 }
4729
4730 return replacing_p;
4731} 4650}
4732 4651
4733/* Value is the position of the end of the `display' property starting 4652/* Value is the position of the end of the `display' property starting
@@ -4755,7 +4674,7 @@ display_prop_end (struct it *it, Lisp_Object object, struct text_pos start_pos)
4755 is the object in which the `display' property was found. *POSITION 4674 is the object in which the `display' property was found. *POSITION
4756 is the position in OBJECT at which the `display' property was found. 4675 is the position in OBJECT at which the `display' property was found.
4757 BUFPOS is the buffer position of OBJECT (different from POSITION if 4676 BUFPOS is the buffer position of OBJECT (different from POSITION if
4758 OBJECT is not a buffer). DISPLAY_REPLACED_P non-zero means that we 4677 OBJECT is not a buffer). DISPLAY_REPLACED non-zero means that we
4759 previously saw a display specification which already replaced text 4678 previously saw a display specification which already replaced text
4760 display with something else, for example an image; we ignore such 4679 display with something else, for example an image; we ignore such
4761 properties after the first one has been processed. 4680 properties after the first one has been processed.
@@ -4768,7 +4687,7 @@ display_prop_end (struct it *it, Lisp_Object object, struct text_pos start_pos)
4768 property ends. 4687 property ends.
4769 4688
4770 If IT is NULL, only examine the property specification in SPEC, but 4689 If IT is NULL, only examine the property specification in SPEC, but
4771 don't set up IT. In that case, FRAME_WINDOW_P non-zero means SPEC 4690 don't set up IT. In that case, FRAME_WINDOW_P means SPEC
4772 is intended to be displayed in a window on a GUI frame. 4691 is intended to be displayed in a window on a GUI frame.
4773 4692
4774 Value is non-zero if something was found which replaces the display 4693 Value is non-zero if something was found which replaces the display
@@ -4777,13 +4696,12 @@ display_prop_end (struct it *it, Lisp_Object object, struct text_pos start_pos)
4777static int 4696static int
4778handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, 4697handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4779 Lisp_Object overlay, struct text_pos *position, 4698 Lisp_Object overlay, struct text_pos *position,
4780 ptrdiff_t bufpos, int display_replaced_p, 4699 ptrdiff_t bufpos, int display_replaced,
4781 int frame_window_p) 4700 bool frame_window_p)
4782{ 4701{
4783 Lisp_Object form; 4702 Lisp_Object form;
4784 Lisp_Object location, value; 4703 Lisp_Object location, value;
4785 struct text_pos start_pos = *position; 4704 struct text_pos start_pos = *position;
4786 int valid_p;
4787 4705
4788 /* If SPEC is a list of the form `(when FORM . VALUE)', evaluate FORM. 4706 /* If SPEC is a list of the form `(when FORM . VALUE)', evaluate FORM.
4789 If the result is non-nil, use VALUE instead of SPEC. */ 4707 If the result is non-nil, use VALUE instead of SPEC. */
@@ -5011,7 +4929,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
5011 next_element_from_image would have reset this flag. 4929 next_element_from_image would have reset this flag.
5012 Do the same, to avoid affecting overlays that 4930 Do the same, to avoid affecting overlays that
5013 follow. */ 4931 follow. */
5014 it->ignore_overlay_strings_at_pos_p = 0; 4932 it->ignore_overlay_strings_at_pos_p = false;
5015 return 1; 4933 return 1;
5016 } 4934 }
5017 } 4935 }
@@ -5033,7 +4951,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
5033 } 4951 }
5034 if (it) 4952 if (it)
5035 /* Reset this flag like next_element_from_image would. */ 4953 /* Reset this flag like next_element_from_image would. */
5036 it->ignore_overlay_strings_at_pos_p = 0; 4954 it->ignore_overlay_strings_at_pos_p = false;
5037 return 1; 4955 return 1;
5038 } 4956 }
5039 4957
@@ -5045,7 +4963,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
5045 { 4963 {
5046 Lisp_Object face_name = XCAR (XCDR (XCDR (spec))); 4964 Lisp_Object face_name = XCAR (XCDR (XCDR (spec)));
5047 int face_id2 = lookup_derived_face (it->f, face_name, 4965 int face_id2 = lookup_derived_face (it->f, face_name,
5048 FRINGE_FACE_ID, 0); 4966 FRINGE_FACE_ID, false);
5049 if (face_id2 >= 0) 4967 if (face_id2 >= 0)
5050 face_id = face_id2; 4968 face_id = face_id2;
5051 } 4969 }
@@ -5119,14 +5037,14 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
5119 LOCATION specifies where to display: `left-margin', 5037 LOCATION specifies where to display: `left-margin',
5120 `right-margin' or nil. */ 5038 `right-margin' or nil. */
5121 5039
5122 valid_p = (STRINGP (value) 5040 bool valid_p = (STRINGP (value)
5123#ifdef HAVE_WINDOW_SYSTEM 5041#ifdef HAVE_WINDOW_SYSTEM
5124 || ((it ? FRAME_WINDOW_P (it->f) : frame_window_p) 5042 || ((it ? FRAME_WINDOW_P (it->f) : frame_window_p)
5125 && valid_image_p (value)) 5043 && valid_image_p (value))
5126#endif /* not HAVE_WINDOW_SYSTEM */ 5044#endif /* not HAVE_WINDOW_SYSTEM */
5127 || (CONSP (value) && EQ (XCAR (value), Qspace))); 5045 || (CONSP (value) && EQ (XCAR (value), Qspace)));
5128 5046
5129 if (valid_p && !display_replaced_p) 5047 if (valid_p && display_replaced == 0)
5130 { 5048 {
5131 int retval = 1; 5049 int retval = 1;
5132 5050
@@ -5186,7 +5104,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
5186 it->bidi_it.string.s = NULL; 5104 it->bidi_it.string.s = NULL;
5187 it->bidi_it.string.schars = it->end_charpos; 5105 it->bidi_it.string.schars = it->end_charpos;
5188 it->bidi_it.string.bufpos = bufpos; 5106 it->bidi_it.string.bufpos = bufpos;
5189 it->bidi_it.string.from_disp_str = 1; 5107 it->bidi_it.string.from_disp_str = true;
5190 it->bidi_it.string.unibyte = !it->multibyte_p; 5108 it->bidi_it.string.unibyte = !it->multibyte_p;
5191 it->bidi_it.w = it->w; 5109 it->bidi_it.w = it->w;
5192 bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); 5110 bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it);
@@ -5229,20 +5147,21 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
5229 came, or nil if it came from a text property. CHARPOS and BYTEPOS 5147 came, or nil if it came from a text property. CHARPOS and BYTEPOS
5230 specify the buffer position covered by PROP. */ 5148 specify the buffer position covered by PROP. */
5231 5149
5232int 5150bool
5233display_prop_intangible_p (Lisp_Object prop, Lisp_Object overlay, 5151display_prop_intangible_p (Lisp_Object prop, Lisp_Object overlay,
5234 ptrdiff_t charpos, ptrdiff_t bytepos) 5152 ptrdiff_t charpos, ptrdiff_t bytepos)
5235{ 5153{
5236 int frame_window_p = FRAME_WINDOW_P (XFRAME (selected_frame)); 5154 bool frame_window_p = FRAME_WINDOW_P (XFRAME (selected_frame));
5237 struct text_pos position; 5155 struct text_pos position;
5238 5156
5239 SET_TEXT_POS (position, charpos, bytepos); 5157 SET_TEXT_POS (position, charpos, bytepos);
5240 return handle_display_spec (NULL, prop, Qnil, overlay, 5158 return (handle_display_spec (NULL, prop, Qnil, overlay,
5241 &position, charpos, frame_window_p); 5159 &position, charpos, frame_window_p)
5160 != 0);
5242} 5161}
5243 5162
5244 5163
5245/* Return 1 if PROP is a display sub-property value containing STRING. 5164/* Return true if PROP is a display sub-property value containing STRING.
5246 5165
5247 Implementation note: this and the following function are really 5166 Implementation note: this and the following function are really
5248 special cases of handle_display_spec and 5167 special cases of handle_display_spec and
@@ -5250,21 +5169,21 @@ display_prop_intangible_p (Lisp_Object prop, Lisp_Object overlay,
5250 Until they do, these two pairs must be consistent and must be 5169 Until they do, these two pairs must be consistent and must be
5251 modified in sync. */ 5170 modified in sync. */
5252 5171
5253static int 5172static bool
5254single_display_spec_string_p (Lisp_Object prop, Lisp_Object string) 5173single_display_spec_string_p (Lisp_Object prop, Lisp_Object string)
5255{ 5174{
5256 if (EQ (string, prop)) 5175 if (EQ (string, prop))
5257 return 1; 5176 return true;
5258 5177
5259 /* Skip over `when FORM'. */ 5178 /* Skip over `when FORM'. */
5260 if (CONSP (prop) && EQ (XCAR (prop), Qwhen)) 5179 if (CONSP (prop) && EQ (XCAR (prop), Qwhen))
5261 { 5180 {
5262 prop = XCDR (prop); 5181 prop = XCDR (prop);
5263 if (!CONSP (prop)) 5182 if (!CONSP (prop))
5264 return 0; 5183 return false;
5265 /* Actually, the condition following `when' should be eval'ed, 5184 /* Actually, the condition following `when' should be eval'ed,
5266 like handle_single_display_spec does, and we should return 5185 like handle_single_display_spec does, and we should return
5267 zero if it evaluates to nil. However, this function is 5186 false if it evaluates to nil. However, this function is
5268 called only when the buffer was already displayed and some 5187 called only when the buffer was already displayed and some
5269 glyph in the glyph matrix was found to come from a display 5188 glyph in the glyph matrix was found to come from a display
5270 string. Therefore, the condition was already evaluated, and 5189 string. Therefore, the condition was already evaluated, and
@@ -5281,20 +5200,20 @@ single_display_spec_string_p (Lisp_Object prop, Lisp_Object string)
5281 { 5200 {
5282 prop = XCDR (prop); 5201 prop = XCDR (prop);
5283 if (!CONSP (prop)) 5202 if (!CONSP (prop))
5284 return 0; 5203 return false;
5285 5204
5286 prop = XCDR (prop); 5205 prop = XCDR (prop);
5287 if (!CONSP (prop)) 5206 if (!CONSP (prop))
5288 return 0; 5207 return false;
5289 } 5208 }
5290 5209
5291 return EQ (prop, string) || (CONSP (prop) && EQ (XCAR (prop), string)); 5210 return EQ (prop, string) || (CONSP (prop) && EQ (XCAR (prop), string));
5292} 5211}
5293 5212
5294 5213
5295/* Return 1 if STRING appears in the `display' property PROP. */ 5214/* Return true if STRING appears in the `display' property PROP. */
5296 5215
5297static int 5216static bool
5298display_prop_string_p (Lisp_Object prop, Lisp_Object string) 5217display_prop_string_p (Lisp_Object prop, Lisp_Object string)
5299{ 5218{
5300 if (CONSP (prop) 5219 if (CONSP (prop)
@@ -5305,7 +5224,7 @@ display_prop_string_p (Lisp_Object prop, Lisp_Object string)
5305 while (CONSP (prop)) 5224 while (CONSP (prop))
5306 { 5225 {
5307 if (single_display_spec_string_p (XCAR (prop), string)) 5226 if (single_display_spec_string_p (XCAR (prop), string))
5308 return 1; 5227 return true;
5309 prop = XCDR (prop); 5228 prop = XCDR (prop);
5310 } 5229 }
5311 } 5230 }
@@ -5315,17 +5234,17 @@ display_prop_string_p (Lisp_Object prop, Lisp_Object string)
5315 ptrdiff_t i; 5234 ptrdiff_t i;
5316 for (i = 0; i < ASIZE (prop); ++i) 5235 for (i = 0; i < ASIZE (prop); ++i)
5317 if (single_display_spec_string_p (AREF (prop, i), string)) 5236 if (single_display_spec_string_p (AREF (prop, i), string))
5318 return 1; 5237 return true;
5319 } 5238 }
5320 else 5239 else
5321 return single_display_spec_string_p (prop, string); 5240 return single_display_spec_string_p (prop, string);
5322 5241
5323 return 0; 5242 return false;
5324} 5243}
5325 5244
5326/* Look for STRING in overlays and text properties in the current 5245/* Look for STRING in overlays and text properties in the current
5327 buffer, between character positions FROM and TO (excluding TO). 5246 buffer, between character positions FROM and TO (excluding TO).
5328 BACK_P non-zero means look back (in this case, TO is supposed to be 5247 BACK_P means look back (in this case, TO is supposed to be
5329 less than FROM). 5248 less than FROM).
5330 Value is the first character position where STRING was found, or 5249 Value is the first character position where STRING was found, or
5331 zero if it wasn't found before hitting TO. 5250 zero if it wasn't found before hitting TO.
@@ -5335,10 +5254,10 @@ display_prop_string_p (Lisp_Object prop, Lisp_Object string)
5335 5254
5336static ptrdiff_t 5255static ptrdiff_t
5337string_buffer_position_lim (Lisp_Object string, 5256string_buffer_position_lim (Lisp_Object string,
5338 ptrdiff_t from, ptrdiff_t to, int back_p) 5257 ptrdiff_t from, ptrdiff_t to, bool back_p)
5339{ 5258{
5340 Lisp_Object limit, prop, pos; 5259 Lisp_Object limit, prop, pos;
5341 int found = 0; 5260 bool found = false;
5342 5261
5343 pos = make_number (max (from, BEGV)); 5262 pos = make_number (max (from, BEGV));
5344 5263
@@ -5349,7 +5268,7 @@ string_buffer_position_lim (Lisp_Object string,
5349 { 5268 {
5350 prop = Fget_char_property (pos, Qdisplay, Qnil); 5269 prop = Fget_char_property (pos, Qdisplay, Qnil);
5351 if (!NILP (prop) && display_prop_string_p (prop, string)) 5270 if (!NILP (prop) && display_prop_string_p (prop, string))
5352 found = 1; 5271 found = true;
5353 else 5272 else
5354 pos = Fnext_single_char_property_change (pos, Qdisplay, Qnil, 5273 pos = Fnext_single_char_property_change (pos, Qdisplay, Qnil,
5355 limit); 5274 limit);
@@ -5362,7 +5281,7 @@ string_buffer_position_lim (Lisp_Object string,
5362 { 5281 {
5363 prop = Fget_char_property (pos, Qdisplay, Qnil); 5282 prop = Fget_char_property (pos, Qdisplay, Qnil);
5364 if (!NILP (prop) && display_prop_string_p (prop, string)) 5283 if (!NILP (prop) && display_prop_string_p (prop, string))
5365 found = 1; 5284 found = true;
5366 else 5285 else
5367 pos = Fprevious_single_char_property_change (pos, Qdisplay, Qnil, 5286 pos = Fprevious_single_char_property_change (pos, Qdisplay, Qnil,
5368 limit); 5287 limit);
@@ -5387,11 +5306,11 @@ string_buffer_position (Lisp_Object string, ptrdiff_t around_charpos)
5387 const int MAX_DISTANCE = 1000; 5306 const int MAX_DISTANCE = 1000;
5388 ptrdiff_t found = string_buffer_position_lim (string, around_charpos, 5307 ptrdiff_t found = string_buffer_position_lim (string, around_charpos,
5389 around_charpos + MAX_DISTANCE, 5308 around_charpos + MAX_DISTANCE,
5390 0); 5309 false);
5391 5310
5392 if (!found) 5311 if (!found)
5393 found = string_buffer_position_lim (string, around_charpos, 5312 found = string_buffer_position_lim (string, around_charpos,
5394 around_charpos - MAX_DISTANCE, 1); 5313 around_charpos - MAX_DISTANCE, true);
5395 return found; 5314 return found;
5396} 5315}
5397 5316
@@ -5475,7 +5394,7 @@ struct overlay_entry
5475 Lisp_Object overlay; 5394 Lisp_Object overlay;
5476 Lisp_Object string; 5395 Lisp_Object string;
5477 EMACS_INT priority; 5396 EMACS_INT priority;
5478 int after_string_p; 5397 bool after_string_p;
5479}; 5398};
5480 5399
5481 5400
@@ -5509,7 +5428,7 @@ next_overlay_string (struct it *it)
5509 they were before overlay strings were processed, and 5428 they were before overlay strings were processed, and
5510 continue to deliver from current_buffer. */ 5429 continue to deliver from current_buffer. */
5511 5430
5512 it->ellipsis_p = (it->stack[it->sp - 1].display_ellipsis_p != 0); 5431 it->ellipsis_p = it->stack[it->sp - 1].display_ellipsis_p;
5513 pop_it (it); 5432 pop_it (it);
5514 eassert (it->sp > 0 5433 eassert (it->sp > 0
5515 || (NILP (it->string) 5434 || (NILP (it->string)
@@ -5655,7 +5574,7 @@ load_overlay_strings (struct it *it, ptrdiff_t charpos)
5655 struct Lisp_Overlay *ov; 5574 struct Lisp_Overlay *ov;
5656 ptrdiff_t start, end; 5575 ptrdiff_t start, end;
5657 ptrdiff_t n = 0, i, j; 5576 ptrdiff_t n = 0, i, j;
5658 int invis_p; 5577 int invis;
5659 struct overlay_entry entriesbuf[20]; 5578 struct overlay_entry entriesbuf[20];
5660 ptrdiff_t size = ARRAYELTS (entriesbuf); 5579 ptrdiff_t size = ARRAYELTS (entriesbuf);
5661 struct overlay_entry *entries = entriesbuf; 5580 struct overlay_entry *entries = entriesbuf;
@@ -5666,7 +5585,7 @@ load_overlay_strings (struct it *it, ptrdiff_t charpos)
5666 5585
5667 /* Append the overlay string STRING of overlay OVERLAY to vector 5586 /* Append the overlay string STRING of overlay OVERLAY to vector
5668 `entries' which has size `size' and currently contains `n' 5587 `entries' which has size `size' and currently contains `n'
5669 elements. AFTER_P non-zero means STRING is an after-string of 5588 elements. AFTER_P means STRING is an after-string of
5670 OVERLAY. */ 5589 OVERLAY. */
5671#define RECORD_OVERLAY_STRING(OVERLAY, STRING, AFTER_P) \ 5590#define RECORD_OVERLAY_STRING(OVERLAY, STRING, AFTER_P) \
5672 do \ 5591 do \
@@ -5688,7 +5607,7 @@ load_overlay_strings (struct it *it, ptrdiff_t charpos)
5688 entries[n].after_string_p = (AFTER_P); \ 5607 entries[n].after_string_p = (AFTER_P); \
5689 ++n; \ 5608 ++n; \
5690 } \ 5609 } \
5691 while (0) 5610 while (false)
5692 5611
5693 /* Process overlay before the overlay center. */ 5612 /* Process overlay before the overlay center. */
5694 for (ov = current_buffer->overlays_before; ov; ov = ov->next) 5613 for (ov = current_buffer->overlays_before; ov; ov = ov->next)
@@ -5715,19 +5634,19 @@ load_overlay_strings (struct it *it, ptrdiff_t charpos)
5715 and after-strings from this overlay are visible; start and 5634 and after-strings from this overlay are visible; start and
5716 end position are indistinguishable. */ 5635 end position are indistinguishable. */
5717 invisible = Foverlay_get (overlay, Qinvisible); 5636 invisible = Foverlay_get (overlay, Qinvisible);
5718 invis_p = TEXT_PROP_MEANS_INVISIBLE (invisible); 5637 invis = TEXT_PROP_MEANS_INVISIBLE (invisible);
5719 5638
5720 /* If overlay has a non-empty before-string, record it. */ 5639 /* If overlay has a non-empty before-string, record it. */
5721 if ((start == charpos || (end == charpos && invis_p)) 5640 if ((start == charpos || (end == charpos && invis != 0))
5722 && (str = Foverlay_get (overlay, Qbefore_string), STRINGP (str)) 5641 && (str = Foverlay_get (overlay, Qbefore_string), STRINGP (str))
5723 && SCHARS (str)) 5642 && SCHARS (str))
5724 RECORD_OVERLAY_STRING (overlay, str, 0); 5643 RECORD_OVERLAY_STRING (overlay, str, false);
5725 5644
5726 /* If overlay has a non-empty after-string, record it. */ 5645 /* If overlay has a non-empty after-string, record it. */
5727 if ((end == charpos || (start == charpos && invis_p)) 5646 if ((end == charpos || (start == charpos && invis != 0))
5728 && (str = Foverlay_get (overlay, Qafter_string), STRINGP (str)) 5647 && (str = Foverlay_get (overlay, Qafter_string), STRINGP (str))
5729 && SCHARS (str)) 5648 && SCHARS (str))
5730 RECORD_OVERLAY_STRING (overlay, str, 1); 5649 RECORD_OVERLAY_STRING (overlay, str, true);
5731 } 5650 }
5732 5651
5733 /* Process overlays after the overlay center. */ 5652 /* Process overlays after the overlay center. */
@@ -5754,19 +5673,19 @@ load_overlay_strings (struct it *it, ptrdiff_t charpos)
5754 /* If the text ``under'' the overlay is invisible, it has a zero 5673 /* If the text ``under'' the overlay is invisible, it has a zero
5755 dimension, and both before- and after-strings apply. */ 5674 dimension, and both before- and after-strings apply. */
5756 invisible = Foverlay_get (overlay, Qinvisible); 5675 invisible = Foverlay_get (overlay, Qinvisible);
5757 invis_p = TEXT_PROP_MEANS_INVISIBLE (invisible); 5676 invis = TEXT_PROP_MEANS_INVISIBLE (invisible);
5758 5677
5759 /* If overlay has a non-empty before-string, record it. */ 5678 /* If overlay has a non-empty before-string, record it. */
5760 if ((start == charpos || (end == charpos && invis_p)) 5679 if ((start == charpos || (end == charpos && invis != 0))
5761 && (str = Foverlay_get (overlay, Qbefore_string), STRINGP (str)) 5680 && (str = Foverlay_get (overlay, Qbefore_string), STRINGP (str))
5762 && SCHARS (str)) 5681 && SCHARS (str))
5763 RECORD_OVERLAY_STRING (overlay, str, 0); 5682 RECORD_OVERLAY_STRING (overlay, str, false);
5764 5683
5765 /* If overlay has a non-empty after-string, record it. */ 5684 /* If overlay has a non-empty after-string, record it. */
5766 if ((end == charpos || (start == charpos && invis_p)) 5685 if ((end == charpos || (start == charpos && invis != 0))
5767 && (str = Foverlay_get (overlay, Qafter_string), STRINGP (str)) 5686 && (str = Foverlay_get (overlay, Qafter_string), STRINGP (str))
5768 && SCHARS (str)) 5687 && SCHARS (str))
5769 RECORD_OVERLAY_STRING (overlay, str, 1); 5688 RECORD_OVERLAY_STRING (overlay, str, true);
5770 } 5689 }
5771 5690
5772#undef RECORD_OVERLAY_STRING 5691#undef RECORD_OVERLAY_STRING
@@ -5796,11 +5715,11 @@ load_overlay_strings (struct it *it, ptrdiff_t charpos)
5796 5715
5797 5716
5798/* Get the first chunk of overlay strings at IT's current buffer 5717/* Get the first chunk of overlay strings at IT's current buffer
5799 position, or at CHARPOS if that is > 0. Value is non-zero if at 5718 position, or at CHARPOS if that is > 0. Value is true if at
5800 least one overlay string was found. */ 5719 least one overlay string was found. */
5801 5720
5802static int 5721static bool
5803get_overlay_strings_1 (struct it *it, ptrdiff_t charpos, int compute_stop_p) 5722get_overlay_strings_1 (struct it *it, ptrdiff_t charpos, bool compute_stop_p)
5804{ 5723{
5805 /* Get the first OVERLAY_STRING_CHUNK_SIZE overlay strings to 5724 /* Get the first OVERLAY_STRING_CHUNK_SIZE overlay strings to
5806 process. This fills IT->overlay_strings with strings, and sets 5725 process. This fills IT->overlay_strings with strings, and sets
@@ -5875,24 +5794,24 @@ get_overlay_strings_1 (struct it *it, ptrdiff_t charpos, int compute_stop_p)
5875 it->bidi_it.w = it->w; 5794 it->bidi_it.w = it->w;
5876 bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it); 5795 bidi_init_it (0, 0, FRAME_WINDOW_P (it->f), &it->bidi_it);
5877 } 5796 }
5878 return 1; 5797 return true;
5879 } 5798 }
5880 5799
5881 it->current.overlay_string_index = -1; 5800 it->current.overlay_string_index = -1;
5882 return 0; 5801 return false;
5883} 5802}
5884 5803
5885static int 5804static bool
5886get_overlay_strings (struct it *it, ptrdiff_t charpos) 5805get_overlay_strings (struct it *it, ptrdiff_t charpos)
5887{ 5806{
5888 it->string = Qnil; 5807 it->string = Qnil;
5889 it->method = GET_FROM_BUFFER; 5808 it->method = GET_FROM_BUFFER;
5890 5809
5891 (void) get_overlay_strings_1 (it, charpos, 1); 5810 get_overlay_strings_1 (it, charpos, true);
5892 5811
5893 CHECK_IT (it); 5812 CHECK_IT (it);
5894 5813
5895 /* Value is non-zero if we found at least one overlay string. */ 5814 /* Value is true if we found at least one overlay string. */
5896 return STRINGP (it->string); 5815 return STRINGP (it->string);
5897} 5816}
5898 5817
@@ -5948,7 +5867,7 @@ push_it (struct it *it, struct text_pos *position)
5948 p->voffset = it->voffset; 5867 p->voffset = it->voffset;
5949 p->string_from_display_prop_p = it->string_from_display_prop_p; 5868 p->string_from_display_prop_p = it->string_from_display_prop_p;
5950 p->string_from_prefix_prop_p = it->string_from_prefix_prop_p; 5869 p->string_from_prefix_prop_p = it->string_from_prefix_prop_p;
5951 p->display_ellipsis_p = 0; 5870 p->display_ellipsis_p = false;
5952 p->line_wrap = it->line_wrap; 5871 p->line_wrap = it->line_wrap;
5953 p->bidi_p = it->bidi_p; 5872 p->bidi_p = it->bidi_p;
5954 p->paragraph_embedding = it->paragraph_embedding; 5873 p->paragraph_embedding = it->paragraph_embedding;
@@ -5963,7 +5882,7 @@ push_it (struct it *it, struct text_pos *position)
5963static void 5882static void
5964iterate_out_of_display_property (struct it *it) 5883iterate_out_of_display_property (struct it *it)
5965{ 5884{
5966 int buffer_p = !STRINGP (it->string); 5885 bool buffer_p = !STRINGP (it->string);
5967 ptrdiff_t eob = (buffer_p ? ZV : it->end_charpos); 5886 ptrdiff_t eob = (buffer_p ? ZV : it->end_charpos);
5968 ptrdiff_t bob = (buffer_p ? BEGV : 0); 5887 ptrdiff_t bob = (buffer_p ? BEGV : 0);
5969 5888
@@ -5973,7 +5892,7 @@ iterate_out_of_display_property (struct it *it)
5973 of a new paragraph, next_element_from_buffer may not have a 5892 of a new paragraph, next_element_from_buffer may not have a
5974 chance to do that. */ 5893 chance to do that. */
5975 if (it->bidi_it.first_elt && it->bidi_it.charpos < eob) 5894 if (it->bidi_it.first_elt && it->bidi_it.charpos < eob)
5976 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, 1); 5895 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, true);
5977 /* prev_stop can be zero, so check against BEGV as well. */ 5896 /* prev_stop can be zero, so check against BEGV as well. */
5978 while (it->bidi_it.charpos >= bob 5897 while (it->bidi_it.charpos >= bob
5979 && it->prev_stop <= it->bidi_it.charpos 5898 && it->prev_stop <= it->bidi_it.charpos
@@ -6004,7 +5923,7 @@ static void
6004pop_it (struct it *it) 5923pop_it (struct it *it)
6005{ 5924{
6006 struct iterator_stack_entry *p; 5925 struct iterator_stack_entry *p;
6007 int from_display_prop = it->from_disp_prop_p; 5926 bool from_display_prop = it->from_disp_prop_p;
6008 5927
6009 eassert (it->sp > 0); 5928 eassert (it->sp > 0);
6010 --it->sp; 5929 --it->sp;
@@ -6115,7 +6034,7 @@ back_to_previous_line_start (struct it *it)
6115 6034
6116/* Move IT to the next line start. 6035/* Move IT to the next line start.
6117 6036
6118 Value is non-zero if a newline was found. Set *SKIPPED_P to 1 if 6037 Value is true if a newline was found. Set *SKIPPED_P to true if
6119 we skipped over part of the text (as opposed to moving the iterator 6038 we skipped over part of the text (as opposed to moving the iterator
6120 continuously over the text). Otherwise, don't change the value 6039 continuously over the text). Otherwise, don't change the value
6121 of *SKIPPED_P. 6040 of *SKIPPED_P.
@@ -6134,12 +6053,13 @@ back_to_previous_line_start (struct it *it)
6134 characters following a newline part of the wrong glyph row, which 6053 characters following a newline part of the wrong glyph row, which
6135 leads to wrong cursor motion. */ 6054 leads to wrong cursor motion. */
6136 6055
6137static int 6056static bool
6138forward_to_next_line_start (struct it *it, int *skipped_p, 6057forward_to_next_line_start (struct it *it, bool *skipped_p,
6139 struct bidi_it *bidi_it_prev) 6058 struct bidi_it *bidi_it_prev)
6140{ 6059{
6141 ptrdiff_t old_selective; 6060 ptrdiff_t old_selective;
6142 int newline_found_p, n; 6061 bool newline_found_p = false;
6062 int n;
6143 const int MAX_NEWLINE_DISTANCE = 500; 6063 const int MAX_NEWLINE_DISTANCE = 500;
6144 6064
6145 /* If already on a newline, just consume it to avoid unintended 6065 /* If already on a newline, just consume it to avoid unintended
@@ -6150,9 +6070,9 @@ forward_to_next_line_start (struct it *it, int *skipped_p,
6150 { 6070 {
6151 if (it->bidi_p && bidi_it_prev) 6071 if (it->bidi_p && bidi_it_prev)
6152 *bidi_it_prev = it->bidi_it; 6072 *bidi_it_prev = it->bidi_it;
6153 set_iterator_to_next (it, 0); 6073 set_iterator_to_next (it, false);
6154 it->c = 0; 6074 it->c = 0;
6155 return 1; 6075 return true;
6156 } 6076 }
6157 6077
6158 /* Don't handle selective display in the following. It's (a) 6078 /* Don't handle selective display in the following. It's (a)
@@ -6164,16 +6084,16 @@ forward_to_next_line_start (struct it *it, int *skipped_p,
6164 6084
6165 /* Scan for a newline within MAX_NEWLINE_DISTANCE display elements 6085 /* Scan for a newline within MAX_NEWLINE_DISTANCE display elements
6166 from buffer text. */ 6086 from buffer text. */
6167 for (n = newline_found_p = 0; 6087 for (n = 0;
6168 !newline_found_p && n < MAX_NEWLINE_DISTANCE; 6088 !newline_found_p && n < MAX_NEWLINE_DISTANCE;
6169 n += STRINGP (it->string) ? 0 : 1) 6089 n += !STRINGP (it->string))
6170 { 6090 {
6171 if (!get_next_display_element (it)) 6091 if (!get_next_display_element (it))
6172 return 0; 6092 return false;
6173 newline_found_p = it->what == IT_CHARACTER && it->c == '\n'; 6093 newline_found_p = it->what == IT_CHARACTER && it->c == '\n';
6174 if (newline_found_p && it->bidi_p && bidi_it_prev) 6094 if (newline_found_p && it->bidi_p && bidi_it_prev)
6175 *bidi_it_prev = it->bidi_it; 6095 *bidi_it_prev = it->bidi_it;
6176 set_iterator_to_next (it, 0); 6096 set_iterator_to_next (it, false);
6177 } 6097 }
6178 6098
6179 /* If we didn't find a newline near enough, see if we can use a 6099 /* If we didn't find a newline near enough, see if we can use a
@@ -6233,7 +6153,7 @@ forward_to_next_line_start (struct it *it, int *skipped_p,
6233 newline_found_p = ITERATOR_AT_END_OF_LINE_P (it); 6153 newline_found_p = ITERATOR_AT_END_OF_LINE_P (it);
6234 if (newline_found_p && it->bidi_p && bidi_it_prev) 6154 if (newline_found_p && it->bidi_p && bidi_it_prev)
6235 *bidi_it_prev = it->bidi_it; 6155 *bidi_it_prev = it->bidi_it;
6236 set_iterator_to_next (it, 0); 6156 set_iterator_to_next (it, false);
6237 } 6157 }
6238 } 6158 }
6239 } 6159 }
@@ -6270,7 +6190,7 @@ back_to_previous_visible_line_start (struct it *it)
6270 Lisp_Object prop; 6190 Lisp_Object prop;
6271 prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1), 6191 prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1),
6272 Qinvisible, it->window); 6192 Qinvisible, it->window);
6273 if (TEXT_PROP_MEANS_INVISIBLE (prop)) 6193 if (TEXT_PROP_MEANS_INVISIBLE (prop) != 0)
6274 continue; 6194 continue;
6275 } 6195 }
6276 6196
@@ -6296,9 +6216,9 @@ back_to_previous_visible_line_start (struct it *it)
6296 pos = --IT_CHARPOS (it2); 6216 pos = --IT_CHARPOS (it2);
6297 --IT_BYTEPOS (it2); 6217 --IT_BYTEPOS (it2);
6298 it2.sp = 0; 6218 it2.sp = 0;
6299 bidi_unshelve_cache (NULL, 0); 6219 bidi_unshelve_cache (NULL, false);
6300 it2.string_from_display_prop_p = 0; 6220 it2.string_from_display_prop_p = false;
6301 it2.from_disp_prop_p = 0; 6221 it2.from_disp_prop_p = false;
6302 if (handle_display_prop (&it2) == HANDLED_RETURN 6222 if (handle_display_prop (&it2) == HANDLED_RETURN
6303 && !NILP (val = get_char_property_and_overlay 6223 && !NILP (val = get_char_property_and_overlay
6304 (make_number (pos), Qdisplay, Qnil, &overlay)) 6224 (make_number (pos), Qdisplay, Qnil, &overlay))
@@ -6340,25 +6260,25 @@ void
6340reseat_at_previous_visible_line_start (struct it *it) 6260reseat_at_previous_visible_line_start (struct it *it)
6341{ 6261{
6342 back_to_previous_visible_line_start (it); 6262 back_to_previous_visible_line_start (it);
6343 reseat (it, it->current.pos, 1); 6263 reseat (it, it->current.pos, true);
6344 CHECK_IT (it); 6264 CHECK_IT (it);
6345} 6265}
6346 6266
6347 6267
6348/* Reseat iterator IT on the next visible line start in the current 6268/* Reseat iterator IT on the next visible line start in the current
6349 buffer. ON_NEWLINE_P non-zero means position IT on the newline 6269 buffer. ON_NEWLINE_P means position IT on the newline
6350 preceding the line start. Skip over invisible text that is so 6270 preceding the line start. Skip over invisible text that is so
6351 because of selective display. Compute faces, overlays etc at the 6271 because of selective display. Compute faces, overlays etc at the
6352 new position. Note that this function does not skip over text that 6272 new position. Note that this function does not skip over text that
6353 is invisible because of text properties. */ 6273 is invisible because of text properties. */
6354 6274
6355static void 6275static void
6356reseat_at_next_visible_line_start (struct it *it, int on_newline_p) 6276reseat_at_next_visible_line_start (struct it *it, bool on_newline_p)
6357{ 6277{
6358 int newline_found_p, skipped_p = 0; 6278 bool skipped_p = false;
6359 struct bidi_it bidi_it_prev; 6279 struct bidi_it bidi_it_prev;
6360 6280 bool newline_found_p
6361 newline_found_p = forward_to_next_line_start (it, &skipped_p, &bidi_it_prev); 6281 = forward_to_next_line_start (it, &skipped_p, &bidi_it_prev);
6362 6282
6363 /* Skip over lines that are invisible because they are indented 6283 /* Skip over lines that are invisible because they are indented
6364 more than the value of IT->selective. */ 6284 more than the value of IT->selective. */
@@ -6411,11 +6331,11 @@ reseat_at_next_visible_line_start (struct it *it, int on_newline_p)
6411 IT_CHARPOS (*it) = it->bidi_it.charpos; 6331 IT_CHARPOS (*it) = it->bidi_it.charpos;
6412 IT_BYTEPOS (*it) = it->bidi_it.bytepos; 6332 IT_BYTEPOS (*it) = it->bidi_it.bytepos;
6413 } 6333 }
6414 reseat (it, it->current.pos, 0); 6334 reseat (it, it->current.pos, false);
6415 } 6335 }
6416 } 6336 }
6417 else if (skipped_p) 6337 else if (skipped_p)
6418 reseat (it, it->current.pos, 0); 6338 reseat (it, it->current.pos, false);
6419 6339
6420 CHECK_IT (it); 6340 CHECK_IT (it);
6421} 6341}
@@ -6426,17 +6346,17 @@ reseat_at_next_visible_line_start (struct it *it, int on_newline_p)
6426 Changing an iterator's position 6346 Changing an iterator's position
6427***********************************************************************/ 6347***********************************************************************/
6428 6348
6429/* Change IT's current position to POS in current_buffer. If FORCE_P 6349/* Change IT's current position to POS in current_buffer.
6430 is non-zero, always check for text properties at the new position. 6350 If FORCE_P, always check for text properties at the new position.
6431 Otherwise, text properties are only looked up if POS >= 6351 Otherwise, text properties are only looked up if POS >=
6432 IT->check_charpos of a property. */ 6352 IT->check_charpos of a property. */
6433 6353
6434static void 6354static void
6435reseat (struct it *it, struct text_pos pos, int force_p) 6355reseat (struct it *it, struct text_pos pos, bool force_p)
6436{ 6356{
6437 ptrdiff_t original_pos = IT_CHARPOS (*it); 6357 ptrdiff_t original_pos = IT_CHARPOS (*it);
6438 6358
6439 reseat_1 (it, pos, 0); 6359 reseat_1 (it, pos, false);
6440 6360
6441 /* Determine where to check text properties. Avoid doing it 6361 /* Determine where to check text properties. Avoid doing it
6442 where possible because text property lookup is very expensive. */ 6362 where possible because text property lookup is very expensive. */
@@ -6474,11 +6394,11 @@ reseat (struct it *it, struct text_pos pos, int force_p)
6474} 6394}
6475 6395
6476 6396
6477/* Change IT's buffer position to POS. SET_STOP_P non-zero means set 6397/* Change IT's buffer position to POS. SET_STOP_P means set
6478 IT->stop_pos to POS, also. */ 6398 IT->stop_pos to POS, also. */
6479 6399
6480static void 6400static void
6481reseat_1 (struct it *it, struct text_pos pos, int set_stop_p) 6401reseat_1 (struct it *it, struct text_pos pos, bool set_stop_p)
6482{ 6402{
6483 /* Don't call this function when scanning a C string. */ 6403 /* Don't call this function when scanning a C string. */
6484 eassert (it->s == NULL); 6404 eassert (it->s == NULL);
@@ -6499,22 +6419,22 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p)
6499 it->area = TEXT_AREA; 6419 it->area = TEXT_AREA;
6500 it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 6420 it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters));
6501 it->sp = 0; 6421 it->sp = 0;
6502 it->string_from_display_prop_p = 0; 6422 it->string_from_display_prop_p = false;
6503 it->string_from_prefix_prop_p = 0; 6423 it->string_from_prefix_prop_p = false;
6504 6424
6505 it->from_disp_prop_p = 0; 6425 it->from_disp_prop_p = false;
6506 it->face_before_selective_p = 0; 6426 it->face_before_selective_p = false;
6507 if (it->bidi_p) 6427 if (it->bidi_p)
6508 { 6428 {
6509 bidi_init_it (IT_CHARPOS (*it), IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), 6429 bidi_init_it (IT_CHARPOS (*it), IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f),
6510 &it->bidi_it); 6430 &it->bidi_it);
6511 bidi_unshelve_cache (NULL, 0); 6431 bidi_unshelve_cache (NULL, false);
6512 it->bidi_it.paragraph_dir = NEUTRAL_DIR; 6432 it->bidi_it.paragraph_dir = NEUTRAL_DIR;
6513 it->bidi_it.string.s = NULL; 6433 it->bidi_it.string.s = NULL;
6514 it->bidi_it.string.lstring = Qnil; 6434 it->bidi_it.string.lstring = Qnil;
6515 it->bidi_it.string.bufpos = 0; 6435 it->bidi_it.string.bufpos = 0;
6516 it->bidi_it.string.from_disp_str = 0; 6436 it->bidi_it.string.from_disp_str = false;
6517 it->bidi_it.string.unibyte = 0; 6437 it->bidi_it.string.unibyte = false;
6518 it->bidi_it.w = it->w; 6438 it->bidi_it.w = it->w;
6519 } 6439 }
6520 6440
@@ -6588,7 +6508,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string,
6588 it->bidi_it.string.s = NULL; 6508 it->bidi_it.string.s = NULL;
6589 it->bidi_it.string.schars = it->end_charpos; 6509 it->bidi_it.string.schars = it->end_charpos;
6590 it->bidi_it.string.bufpos = 0; 6510 it->bidi_it.string.bufpos = 0;
6591 it->bidi_it.string.from_disp_str = 0; 6511 it->bidi_it.string.from_disp_str = false;
6592 it->bidi_it.string.unibyte = !it->multibyte_p; 6512 it->bidi_it.string.unibyte = !it->multibyte_p;
6593 it->bidi_it.w = it->w; 6513 it->bidi_it.w = it->w;
6594 bidi_init_it (charpos, IT_STRING_BYTEPOS (*it), 6514 bidi_init_it (charpos, IT_STRING_BYTEPOS (*it),
@@ -6605,8 +6525,8 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string,
6605 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = -1; 6525 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = -1;
6606 if (it->multibyte_p) 6526 if (it->multibyte_p)
6607 { 6527 {
6608 it->current.pos = c_string_pos (charpos, s, 1); 6528 it->current.pos = c_string_pos (charpos, s, true);
6609 it->end_charpos = it->string_nchars = number_of_chars (s, 1); 6529 it->end_charpos = it->string_nchars = number_of_chars (s, true);
6610 } 6530 }
6611 else 6531 else
6612 { 6532 {
@@ -6620,7 +6540,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string,
6620 it->bidi_it.string.s = (const unsigned char *) s; 6540 it->bidi_it.string.s = (const unsigned char *) s;
6621 it->bidi_it.string.schars = it->end_charpos; 6541 it->bidi_it.string.schars = it->end_charpos;
6622 it->bidi_it.string.bufpos = 0; 6542 it->bidi_it.string.bufpos = 0;
6623 it->bidi_it.string.from_disp_str = 0; 6543 it->bidi_it.string.from_disp_str = false;
6624 it->bidi_it.string.unibyte = !it->multibyte_p; 6544 it->bidi_it.string.unibyte = !it->multibyte_p;
6625 it->bidi_it.w = it->w; 6545 it->bidi_it.w = it->w;
6626 bidi_init_it (charpos, IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f), 6546 bidi_init_it (charpos, IT_BYTEPOS (*it), FRAME_WINDOW_P (it->f),
@@ -6659,7 +6579,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string,
6659 it->base_level_stop = 0; 6579 it->base_level_stop = 0;
6660 if (it->bidi_p) 6580 if (it->bidi_p)
6661 { 6581 {
6662 it->bidi_it.first_elt = 1; 6582 it->bidi_it.first_elt = true;
6663 it->bidi_it.paragraph_dir = NEUTRAL_DIR; 6583 it->bidi_it.paragraph_dir = NEUTRAL_DIR;
6664 it->bidi_it.disp_pos = -1; 6584 it->bidi_it.disp_pos = -1;
6665 } 6585 }
@@ -6682,7 +6602,9 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string,
6682 6602
6683/* Map enum it_method value to corresponding next_element_from_* function. */ 6603/* Map enum it_method value to corresponding next_element_from_* function. */
6684 6604
6685static int (* get_next_element[NUM_IT_METHODS]) (struct it *it) = 6605typedef bool (*next_element_function) (struct it *);
6606
6607static next_element_function const get_next_element[NUM_IT_METHODS] =
6686{ 6608{
6687 next_element_from_buffer, 6609 next_element_from_buffer,
6688 next_element_from_display_vector, 6610 next_element_from_display_vector,
@@ -6695,7 +6617,7 @@ static int (* get_next_element[NUM_IT_METHODS]) (struct it *it) =
6695#define GET_NEXT_DISPLAY_ELEMENT(it) (*get_next_element[(it)->method]) (it) 6617#define GET_NEXT_DISPLAY_ELEMENT(it) (*get_next_element[(it)->method]) (it)
6696 6618
6697 6619
6698/* Return 1 iff a character at CHARPOS (and BYTEPOS) is composed 6620/* Return true iff a character at CHARPOS (and BYTEPOS) is composed
6699 (possibly with the following characters). */ 6621 (possibly with the following characters). */
6700 6622
6701#define CHAR_COMPOSED_P(IT,CHARPOS,BYTEPOS,END_CHARPOS) \ 6623#define CHAR_COMPOSED_P(IT,CHARPOS,BYTEPOS,END_CHARPOS) \
@@ -6819,17 +6741,17 @@ merge_glyphless_glyph_face (struct it *it)
6819} 6741}
6820 6742
6821/* Load IT's display element fields with information about the next 6743/* Load IT's display element fields with information about the next
6822 display element from the current position of IT. Value is zero if 6744 display element from the current position of IT. Value is false if
6823 end of buffer (or C string) is reached. */ 6745 end of buffer (or C string) is reached. */
6824 6746
6825static int 6747static bool
6826get_next_display_element (struct it *it) 6748get_next_display_element (struct it *it)
6827{ 6749{
6828 /* Non-zero means that we found a display element. Zero means that 6750 /* True means that we found a display element. False means that
6829 we hit the end of what we iterate over. Performance note: the 6751 we hit the end of what we iterate over. Performance note: the
6830 function pointer `method' used here turns out to be faster than 6752 function pointer `method' used here turns out to be faster than
6831 using a sequence of if-statements. */ 6753 using a sequence of if-statements. */
6832 int success_p; 6754 bool success_p;
6833 6755
6834 get_next: 6756 get_next:
6835 success_p = GET_NEXT_DISPLAY_ELEMENT (it); 6757 success_p = GET_NEXT_DISPLAY_ELEMENT (it);
@@ -6857,8 +6779,8 @@ get_next_display_element (struct it *it)
6857 { 6779 {
6858 Lisp_Object dv; 6780 Lisp_Object dv;
6859 struct charset *unibyte = CHARSET_FROM_ID (charset_unibyte); 6781 struct charset *unibyte = CHARSET_FROM_ID (charset_unibyte);
6860 int nonascii_space_p = 0; 6782 bool nonascii_space_p = false;
6861 int nonascii_hyphen_p = 0; 6783 bool nonascii_hyphen_p = false;
6862 int c = it->c; /* This is the character to display. */ 6784 int c = it->c; /* This is the character to display. */
6863 6785
6864 if (! it->multibyte_p && ! ASCII_CHAR_P (c)) 6786 if (! it->multibyte_p && ! ASCII_CHAR_P (c))
@@ -6892,11 +6814,11 @@ get_next_display_element (struct it *it)
6892 it->dpvec_face_id = -1; 6814 it->dpvec_face_id = -1;
6893 it->saved_face_id = it->face_id; 6815 it->saved_face_id = it->face_id;
6894 it->method = GET_FROM_DISPLAY_VECTOR; 6816 it->method = GET_FROM_DISPLAY_VECTOR;
6895 it->ellipsis_p = 0; 6817 it->ellipsis_p = false;
6896 } 6818 }
6897 else 6819 else
6898 { 6820 {
6899 set_iterator_to_next (it, 0); 6821 set_iterator_to_next (it, false);
6900 } 6822 }
6901 goto get_next; 6823 goto get_next;
6902 } 6824 }
@@ -6906,7 +6828,7 @@ get_next_display_element (struct it *it)
6906 if (it->what == IT_GLYPHLESS) 6828 if (it->what == IT_GLYPHLESS)
6907 goto done; 6829 goto done;
6908 /* Don't display this character. */ 6830 /* Don't display this character. */
6909 set_iterator_to_next (it, 0); 6831 set_iterator_to_next (it, false);
6910 goto get_next; 6832 goto get_next;
6911 } 6833 }
6912 6834
@@ -7052,7 +6974,7 @@ get_next_display_element (struct it *it)
7052 it->dpvec_face_id = face_id; 6974 it->dpvec_face_id = face_id;
7053 it->saved_face_id = it->face_id; 6975 it->saved_face_id = it->face_id;
7054 it->method = GET_FROM_DISPLAY_VECTOR; 6976 it->method = GET_FROM_DISPLAY_VECTOR;
7055 it->ellipsis_p = 0; 6977 it->ellipsis_p = false;
7056 goto get_next; 6978 goto get_next;
7057 } 6979 }
7058 it->char_to_display = c; 6980 it->char_to_display = c;
@@ -7108,7 +7030,7 @@ get_next_display_element (struct it *it)
7108 7030
7109 done: 7031 done:
7110 /* Is this character the last one of a run of characters with 7032 /* Is this character the last one of a run of characters with
7111 box? If yes, set IT->end_of_box_run_p to 1. */ 7033 box? If yes, set IT->end_of_box_run_p to true. */
7112 if (it->face_box_p 7034 if (it->face_box_p
7113 && it->s == NULL) 7035 && it->s == NULL)
7114 { 7036 {
@@ -7186,22 +7108,22 @@ get_next_display_element (struct it *it)
7186 /* If we reached the end of the object we've been iterating (e.g., a 7108 /* If we reached the end of the object we've been iterating (e.g., a
7187 display string or an overlay string), and there's something on 7109 display string or an overlay string), and there's something on
7188 IT->stack, proceed with what's on the stack. It doesn't make 7110 IT->stack, proceed with what's on the stack. It doesn't make
7189 sense to return zero if there's unprocessed stuff on the stack, 7111 sense to return false if there's unprocessed stuff on the stack,
7190 because otherwise that stuff will never be displayed. */ 7112 because otherwise that stuff will never be displayed. */
7191 if (!success_p && it->sp > 0) 7113 if (!success_p && it->sp > 0)
7192 { 7114 {
7193 set_iterator_to_next (it, 0); 7115 set_iterator_to_next (it, false);
7194 success_p = get_next_display_element (it); 7116 success_p = get_next_display_element (it);
7195 } 7117 }
7196 7118
7197 /* Value is 0 if end of buffer or string reached. */ 7119 /* Value is false if end of buffer or string reached. */
7198 return success_p; 7120 return success_p;
7199} 7121}
7200 7122
7201 7123
7202/* Move IT to the next display element. 7124/* Move IT to the next display element.
7203 7125
7204 RESEAT_P non-zero means if called on a newline in buffer text, 7126 RESEAT_P means if called on a newline in buffer text,
7205 skip to the next visible line start. 7127 skip to the next visible line start.
7206 7128
7207 Functions get_next_display_element and set_iterator_to_next are 7129 Functions get_next_display_element and set_iterator_to_next are
@@ -7215,12 +7137,12 @@ get_next_display_element (struct it *it)
7215 decrement position function which would not be easy to write. */ 7137 decrement position function which would not be easy to write. */
7216 7138
7217void 7139void
7218set_iterator_to_next (struct it *it, int reseat_p) 7140set_iterator_to_next (struct it *it, bool reseat_p)
7219{ 7141{
7220 /* Reset flags indicating start and end of a sequence of characters 7142 /* Reset flags indicating start and end of a sequence of characters
7221 with box. Reset them at the start of this function because 7143 with box. Reset them at the start of this function because
7222 moving the iterator to a new position might set them. */ 7144 moving the iterator to a new position might set them. */
7223 it->start_of_box_run_p = it->end_of_box_run_p = 0; 7145 it->start_of_box_run_p = it->end_of_box_run_p = false;
7224 7146
7225 switch (it->method) 7147 switch (it->method)
7226 { 7148 {
@@ -7229,7 +7151,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
7229 current_buffer. Advance in the buffer, and maybe skip over 7151 current_buffer. Advance in the buffer, and maybe skip over
7230 invisible lines that are so because of selective display. */ 7152 invisible lines that are so because of selective display. */
7231 if (ITERATOR_AT_END_OF_LINE_P (it) && reseat_p) 7153 if (ITERATOR_AT_END_OF_LINE_P (it) && reseat_p)
7232 reseat_at_next_visible_line_start (it, 0); 7154 reseat_at_next_visible_line_start (it, false);
7233 else if (it->cmp_it.id >= 0) 7155 else if (it->cmp_it.id >= 0)
7234 { 7156 {
7235 /* We are currently getting glyphs from a composition. */ 7157 /* We are currently getting glyphs from a composition. */
@@ -7294,7 +7216,8 @@ set_iterator_to_next (struct it *it, int reseat_p)
7294 /* If this is a new paragraph, determine its base 7216 /* If this is a new paragraph, determine its base
7295 direction (a.k.a. its base embedding level). */ 7217 direction (a.k.a. its base embedding level). */
7296 if (it->bidi_it.new_paragraph) 7218 if (it->bidi_it.new_paragraph)
7297 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, 0); 7219 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it,
7220 false);
7298 bidi_move_to_visually_next (&it->bidi_it); 7221 bidi_move_to_visually_next (&it->bidi_it);
7299 IT_BYTEPOS (*it) = it->bidi_it.bytepos; 7222 IT_BYTEPOS (*it) = it->bidi_it.bytepos;
7300 IT_CHARPOS (*it) = it->bidi_it.charpos; 7223 IT_CHARPOS (*it) = it->bidi_it.charpos;
@@ -7346,7 +7269,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
7346 7269
7347 if (it->dpvec + it->current.dpvec_index >= it->dpend) 7270 if (it->dpvec + it->current.dpvec_index >= it->dpend)
7348 { 7271 {
7349 int recheck_faces = it->ellipsis_p; 7272 bool recheck_faces = it->ellipsis_p;
7350 7273
7351 if (it->s) 7274 if (it->s)
7352 it->method = GET_FROM_C_STRING; 7275 it->method = GET_FROM_C_STRING;
@@ -7363,7 +7286,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
7363 7286
7364 /* Skip over characters which were displayed via IT->dpvec. */ 7287 /* Skip over characters which were displayed via IT->dpvec. */
7365 if (it->dpvec_char_len < 0) 7288 if (it->dpvec_char_len < 0)
7366 reseat_at_next_visible_line_start (it, 1); 7289 reseat_at_next_visible_line_start (it, true);
7367 else if (it->dpvec_char_len > 0) 7290 else if (it->dpvec_char_len > 0)
7368 { 7291 {
7369 if (it->method == GET_FROM_STRING 7292 if (it->method == GET_FROM_STRING
@@ -7511,7 +7434,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
7511 next, if there is one. */ 7434 next, if there is one. */
7512 if (IT_STRING_CHARPOS (*it) >= SCHARS (it->string)) 7435 if (IT_STRING_CHARPOS (*it) >= SCHARS (it->string))
7513 { 7436 {
7514 it->ellipsis_p = 0; 7437 it->ellipsis_p = false;
7515 next_overlay_string (it); 7438 next_overlay_string (it);
7516 if (it->ellipsis_p) 7439 if (it->ellipsis_p)
7517 setup_for_ellipsis (it, 0); 7440 setup_for_ellipsis (it, 0);
@@ -7563,7 +7486,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
7563 IT->saved_face_id holds the face id before the display vector--it 7486 IT->saved_face_id holds the face id before the display vector--it
7564 is restored into IT->face_id in set_iterator_to_next. */ 7487 is restored into IT->face_id in set_iterator_to_next. */
7565 7488
7566static int 7489static bool
7567next_element_from_display_vector (struct it *it) 7490next_element_from_display_vector (struct it *it)
7568{ 7491{
7569 Lisp_Object gc; 7492 Lisp_Object gc;
@@ -7642,7 +7565,7 @@ next_element_from_display_vector (struct it *it)
7642 still the values of the character that had this display table 7565 still the values of the character that had this display table
7643 entry or was translated, and that's what we want. */ 7566 entry or was translated, and that's what we want. */
7644 it->what = IT_CHARACTER; 7567 it->what = IT_CHARACTER;
7645 return 1; 7568 return true;
7646} 7569}
7647 7570
7648/* Get the first element of string/buffer in the visual order, after 7571/* Get the first element of string/buffer in the visual order, after
@@ -7650,7 +7573,7 @@ next_element_from_display_vector (struct it *it)
7650static void 7573static void
7651get_visually_first_element (struct it *it) 7574get_visually_first_element (struct it *it)
7652{ 7575{
7653 int string_p = STRINGP (it->string) || it->s; 7576 bool string_p = STRINGP (it->string) || it->s;
7654 ptrdiff_t eob = (string_p ? it->bidi_it.string.schars : ZV); 7577 ptrdiff_t eob = (string_p ? it->bidi_it.string.schars : ZV);
7655 ptrdiff_t bob = (string_p ? 0 : BEGV); 7578 ptrdiff_t bob = (string_p ? 0 : BEGV);
7656 7579
@@ -7670,7 +7593,7 @@ get_visually_first_element (struct it *it)
7670 /* Nothing to do, but reset the FIRST_ELT flag, like 7593 /* Nothing to do, but reset the FIRST_ELT flag, like
7671 bidi_paragraph_init does, because we are not going to 7594 bidi_paragraph_init does, because we are not going to
7672 call it. */ 7595 call it. */
7673 it->bidi_it.first_elt = 0; 7596 it->bidi_it.first_elt = false;
7674 } 7597 }
7675 else if (it->bidi_it.charpos == bob 7598 else if (it->bidi_it.charpos == bob
7676 || (!string_p 7599 || (!string_p
@@ -7679,7 +7602,7 @@ get_visually_first_element (struct it *it)
7679 { 7602 {
7680 /* If we are at the beginning of a line/string, we can produce 7603 /* If we are at the beginning of a line/string, we can produce
7681 the next element right away. */ 7604 the next element right away. */
7682 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, 1); 7605 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, true);
7683 bidi_move_to_visually_next (&it->bidi_it); 7606 bidi_move_to_visually_next (&it->bidi_it);
7684 } 7607 }
7685 else 7608 else
@@ -7695,7 +7618,7 @@ get_visually_first_element (struct it *it)
7695 it->bidi_it.charpos = find_newline_no_quit (IT_CHARPOS (*it), 7618 it->bidi_it.charpos = find_newline_no_quit (IT_CHARPOS (*it),
7696 IT_BYTEPOS (*it), -1, 7619 IT_BYTEPOS (*it), -1,
7697 &it->bidi_it.bytepos); 7620 &it->bidi_it.bytepos);
7698 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, 1); 7621 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, true);
7699 do 7622 do
7700 { 7623 {
7701 /* Now return to buffer/string position where we were asked 7624 /* Now return to buffer/string position where we were asked
@@ -7749,7 +7672,7 @@ get_visually_first_element (struct it *it)
7749 If IT->current.overlay_string_index >= 0, the Lisp string is an 7672 If IT->current.overlay_string_index >= 0, the Lisp string is an
7750 overlay string. */ 7673 overlay string. */
7751 7674
7752static int 7675static bool
7753next_element_from_string (struct it *it) 7676next_element_from_string (struct it *it)
7754{ 7677{
7755 struct text_pos position; 7678 struct text_pos position;
@@ -7760,7 +7683,7 @@ next_element_from_string (struct it *it)
7760 position = it->current.string_pos; 7683 position = it->current.string_pos;
7761 7684
7762 /* With bidi reordering, the character to display might not be the 7685 /* With bidi reordering, the character to display might not be the
7763 character at IT_STRING_CHARPOS. BIDI_IT.FIRST_ELT non-zero means 7686 character at IT_STRING_CHARPOS. BIDI_IT.FIRST_ELT means
7764 that we were reseat()ed to a new string, whose paragraph 7687 that we were reseat()ed to a new string, whose paragraph
7765 direction is not known. */ 7688 direction is not known. */
7766 if (it->bidi_p && it->bidi_it.first_elt) 7689 if (it->bidi_p && it->bidi_it.first_elt)
@@ -7838,7 +7761,7 @@ next_element_from_string (struct it *it)
7838 if (IT_STRING_CHARPOS (*it) >= SCHARS (it->string)) 7761 if (IT_STRING_CHARPOS (*it) >= SCHARS (it->string))
7839 { 7762 {
7840 it->what = IT_EOB; 7763 it->what = IT_EOB;
7841 return 0; 7764 return false;
7842 } 7765 }
7843 else if (CHAR_COMPOSED_P (it, IT_STRING_CHARPOS (*it), 7766 else if (CHAR_COMPOSED_P (it, IT_STRING_CHARPOS (*it),
7844 IT_STRING_BYTEPOS (*it), 7767 IT_STRING_BYTEPOS (*it),
@@ -7847,7 +7770,7 @@ next_element_from_string (struct it *it)
7847 : SCHARS (it->string)) 7770 : SCHARS (it->string))
7848 && next_element_from_composition (it)) 7771 && next_element_from_composition (it))
7849 { 7772 {
7850 return 1; 7773 return true;
7851 } 7774 }
7852 else if (STRING_MULTIBYTE (it->string)) 7775 else if (STRING_MULTIBYTE (it->string))
7853 { 7776 {
@@ -7870,7 +7793,7 @@ next_element_from_string (struct it *it)
7870 if (IT_STRING_CHARPOS (*it) >= it->end_charpos) 7793 if (IT_STRING_CHARPOS (*it) >= it->end_charpos)
7871 { 7794 {
7872 it->what = IT_EOB; 7795 it->what = IT_EOB;
7873 return 0; 7796 return false;
7874 } 7797 }
7875 else if (IT_STRING_CHARPOS (*it) >= it->string_nchars) 7798 else if (IT_STRING_CHARPOS (*it) >= it->string_nchars)
7876 { 7799 {
@@ -7885,7 +7808,7 @@ next_element_from_string (struct it *it)
7885 : it->string_nchars) 7808 : it->string_nchars)
7886 && next_element_from_composition (it)) 7809 && next_element_from_composition (it))
7887 { 7810 {
7888 return 1; 7811 return true;
7889 } 7812 }
7890 else if (STRING_MULTIBYTE (it->string)) 7813 else if (STRING_MULTIBYTE (it->string))
7891 { 7814 {
@@ -7904,7 +7827,7 @@ next_element_from_string (struct it *it)
7904 it->what = IT_CHARACTER; 7827 it->what = IT_CHARACTER;
7905 it->object = it->string; 7828 it->object = it->string;
7906 it->position = position; 7829 it->position = position;
7907 return 1; 7830 return true;
7908} 7831}
7909 7832
7910 7833
@@ -7912,10 +7835,10 @@ next_element_from_string (struct it *it)
7912 IT->string_nchars is the maximum number of characters to return 7835 IT->string_nchars is the maximum number of characters to return
7913 from the string. IT->end_charpos may be greater than 7836 from the string. IT->end_charpos may be greater than
7914 IT->string_nchars when this function is called, in which case we 7837 IT->string_nchars when this function is called, in which case we
7915 may have to return padding spaces. Value is zero if end of string 7838 may have to return padding spaces. Value is false if end of string
7916 reached, including padding spaces. */ 7839 reached, including padding spaces. */
7917 7840
7918static int 7841static bool
7919next_element_from_c_string (struct it *it) 7842next_element_from_c_string (struct it *it)
7920{ 7843{
7921 bool success_p = true; 7844 bool success_p = true;
@@ -7927,7 +7850,7 @@ next_element_from_c_string (struct it *it)
7927 it->object = make_number (0); 7850 it->object = make_number (0);
7928 7851
7929 /* With bidi reordering, the character to display might not be the 7852 /* With bidi reordering, the character to display might not be the
7930 character at IT_CHARPOS. BIDI_IT.FIRST_ELT non-zero means that 7853 character at IT_CHARPOS. BIDI_IT.FIRST_ELT means that
7931 we were reseated to a new string, whose paragraph direction is 7854 we were reseated to a new string, whose paragraph direction is
7932 not known. */ 7855 not known. */
7933 if (it->bidi_p && it->bidi_it.first_elt) 7856 if (it->bidi_p && it->bidi_it.first_elt)
@@ -7940,7 +7863,7 @@ next_element_from_c_string (struct it *it)
7940 { 7863 {
7941 /* End of the game. */ 7864 /* End of the game. */
7942 it->what = IT_EOB; 7865 it->what = IT_EOB;
7943 success_p = 0; 7866 success_p = false;
7944 } 7867 }
7945 else if (IT_CHARPOS (*it) >= it->string_nchars) 7868 else if (IT_CHARPOS (*it) >= it->string_nchars)
7946 { 7869 {
@@ -7962,7 +7885,7 @@ next_element_from_c_string (struct it *it)
7962 entry. This function fills IT with the first glyph from the 7885 entry. This function fills IT with the first glyph from the
7963 ellipsis if an ellipsis is to be displayed. */ 7886 ellipsis if an ellipsis is to be displayed. */
7964 7887
7965static int 7888static bool
7966next_element_from_ellipsis (struct it *it) 7889next_element_from_ellipsis (struct it *it)
7967{ 7890{
7968 if (it->selective_display_ellipsis_p) 7891 if (it->selective_display_ellipsis_p)
@@ -7976,7 +7899,7 @@ next_element_from_ellipsis (struct it *it)
7976 it->saved_face_id = it->face_id; 7899 it->saved_face_id = it->face_id;
7977 it->method = GET_FROM_BUFFER; 7900 it->method = GET_FROM_BUFFER;
7978 it->object = it->w->contents; 7901 it->object = it->w->contents;
7979 reseat_at_next_visible_line_start (it, 1); 7902 reseat_at_next_visible_line_start (it, true);
7980 it->face_before_selective_p = true; 7903 it->face_before_selective_p = true;
7981 } 7904 }
7982 7905
@@ -7986,27 +7909,27 @@ next_element_from_ellipsis (struct it *it)
7986 7909
7987/* Deliver an image display element. The iterator IT is already 7910/* Deliver an image display element. The iterator IT is already
7988 filled with image information (done in handle_display_prop). Value 7911 filled with image information (done in handle_display_prop). Value
7989 is always 1. */ 7912 is always true. */
7990 7913
7991 7914
7992static int 7915static bool
7993next_element_from_image (struct it *it) 7916next_element_from_image (struct it *it)
7994{ 7917{
7995 it->what = IT_IMAGE; 7918 it->what = IT_IMAGE;
7996 it->ignore_overlay_strings_at_pos_p = 0; 7919 it->ignore_overlay_strings_at_pos_p = false;
7997 return 1; 7920 return true;
7998} 7921}
7999 7922
8000 7923
8001/* Fill iterator IT with next display element from a stretch glyph 7924/* Fill iterator IT with next display element from a stretch glyph
8002 property. IT->object is the value of the text property. Value is 7925 property. IT->object is the value of the text property. Value is
8003 always 1. */ 7926 always true. */
8004 7927
8005static int 7928static bool
8006next_element_from_stretch (struct it *it) 7929next_element_from_stretch (struct it *it)
8007{ 7930{
8008 it->what = IT_STRETCH; 7931 it->what = IT_STRETCH;
8009 return 1; 7932 return true;
8010} 7933}
8011 7934
8012/* Scan backwards from IT's current position until we find a stop 7935/* Scan backwards from IT's current position until we find a stop
@@ -8028,13 +7951,13 @@ compute_stop_pos_backwards (struct it *it)
8028 7951
8029 eassert (NILP (it->string) && !it->s); 7952 eassert (NILP (it->string) && !it->s);
8030 eassert (it->bidi_p); 7953 eassert (it->bidi_p);
8031 it->bidi_p = 0; 7954 it->bidi_p = false;
8032 do 7955 do
8033 { 7956 {
8034 it->end_charpos = min (charpos + 1, ZV); 7957 it->end_charpos = min (charpos + 1, ZV);
8035 charpos = max (charpos - SCAN_BACK_LIMIT, BEGV); 7958 charpos = max (charpos - SCAN_BACK_LIMIT, BEGV);
8036 SET_TEXT_POS (pos, charpos, CHAR_TO_BYTE (charpos)); 7959 SET_TEXT_POS (pos, charpos, CHAR_TO_BYTE (charpos));
8037 reseat_1 (it, pos, 0); 7960 reseat_1 (it, pos, false);
8038 compute_stop_pos (it); 7961 compute_stop_pos (it);
8039 /* We must advance forward, right? */ 7962 /* We must advance forward, right? */
8040 if (it->stop_charpos <= charpos) 7963 if (it->stop_charpos <= charpos)
@@ -8064,7 +7987,7 @@ compute_stop_pos_backwards (struct it *it)
8064static void 7987static void
8065handle_stop_backwards (struct it *it, ptrdiff_t charpos) 7988handle_stop_backwards (struct it *it, ptrdiff_t charpos)
8066{ 7989{
8067 int bufp = !STRINGP (it->string); 7990 bool bufp = !STRINGP (it->string);
8068 ptrdiff_t where_we_are = (bufp ? IT_CHARPOS (*it) : IT_STRING_CHARPOS (*it)); 7991 ptrdiff_t where_we_are = (bufp ? IT_CHARPOS (*it) : IT_STRING_CHARPOS (*it));
8069 struct display_pos save_current = it->current; 7992 struct display_pos save_current = it->current;
8070 struct text_pos save_position = it->position; 7993 struct text_pos save_position = it->position;
@@ -8073,14 +7996,14 @@ handle_stop_backwards (struct it *it, ptrdiff_t charpos)
8073 7996
8074 /* Scan in strict logical order. */ 7997 /* Scan in strict logical order. */
8075 eassert (it->bidi_p); 7998 eassert (it->bidi_p);
8076 it->bidi_p = 0; 7999 it->bidi_p = false;
8077 do 8000 do
8078 { 8001 {
8079 it->prev_stop = charpos; 8002 it->prev_stop = charpos;
8080 if (bufp) 8003 if (bufp)
8081 { 8004 {
8082 SET_TEXT_POS (pos1, charpos, CHAR_TO_BYTE (charpos)); 8005 SET_TEXT_POS (pos1, charpos, CHAR_TO_BYTE (charpos));
8083 reseat_1 (it, pos1, 0); 8006 reseat_1 (it, pos1, false);
8084 } 8007 }
8085 else 8008 else
8086 it->current.string_pos = string_pos (charpos, it->string); 8009 it->current.string_pos = string_pos (charpos, it->string);
@@ -8102,11 +8025,11 @@ handle_stop_backwards (struct it *it, ptrdiff_t charpos)
8102} 8025}
8103 8026
8104/* Load IT with the next display element from current_buffer. Value 8027/* Load IT with the next display element from current_buffer. Value
8105 is zero if end of buffer reached. IT->stop_charpos is the next 8028 is false if end of buffer reached. IT->stop_charpos is the next
8106 position at which to stop and check for text properties or buffer 8029 position at which to stop and check for text properties or buffer
8107 end. */ 8030 end. */
8108 8031
8109static int 8032static bool
8110next_element_from_buffer (struct it *it) 8033next_element_from_buffer (struct it *it)
8111{ 8034{
8112 bool success_p = true; 8035 bool success_p = true;
@@ -8118,7 +8041,7 @@ next_element_from_buffer (struct it *it)
8118 && it->bidi_it.string.s == NULL)); 8041 && it->bidi_it.string.s == NULL));
8119 8042
8120 /* With bidi reordering, the character to display might not be the 8043 /* With bidi reordering, the character to display might not be the
8121 character at IT_CHARPOS. BIDI_IT.FIRST_ELT non-zero means that 8044 character at IT_CHARPOS. BIDI_IT.FIRST_ELT means that
8122 we were reseat()ed to a new buffer position, which is potentially 8045 we were reseat()ed to a new buffer position, which is potentially
8123 a different paragraph. */ 8046 a different paragraph. */
8124 if (it->bidi_p && it->bidi_it.first_elt) 8047 if (it->bidi_p && it->bidi_it.first_elt)
@@ -8131,12 +8054,12 @@ next_element_from_buffer (struct it *it)
8131 { 8054 {
8132 if (IT_CHARPOS (*it) >= it->end_charpos) 8055 if (IT_CHARPOS (*it) >= it->end_charpos)
8133 { 8056 {
8134 int overlay_strings_follow_p; 8057 bool overlay_strings_follow_p;
8135 8058
8136 /* End of the game, except when overlay strings follow that 8059 /* End of the game, except when overlay strings follow that
8137 haven't been returned yet. */ 8060 haven't been returned yet. */
8138 if (it->overlay_strings_at_end_processed_p) 8061 if (it->overlay_strings_at_end_processed_p)
8139 overlay_strings_follow_p = 0; 8062 overlay_strings_follow_p = false;
8140 else 8063 else
8141 { 8064 {
8142 it->overlay_strings_at_end_processed_p = true; 8065 it->overlay_strings_at_end_processed_p = true;
@@ -8149,7 +8072,7 @@ next_element_from_buffer (struct it *it)
8149 { 8072 {
8150 it->what = IT_EOB; 8073 it->what = IT_EOB;
8151 it->position = it->current.pos; 8074 it->position = it->current.pos;
8152 success_p = 0; 8075 success_p = false;
8153 } 8076 }
8154 } 8077 }
8155 else if (!(!it->bidi_p 8078 else if (!(!it->bidi_p
@@ -8217,7 +8140,7 @@ next_element_from_buffer (struct it *it)
8217 8140
8218 /* We moved to the next buffer position, so any info about 8141 /* We moved to the next buffer position, so any info about
8219 previously seen overlays is no longer valid. */ 8142 previously seen overlays is no longer valid. */
8220 it->ignore_overlay_strings_at_pos_p = 0; 8143 it->ignore_overlay_strings_at_pos_p = false;
8221 8144
8222 /* Maybe run the redisplay end trigger hook. Performance note: 8145 /* Maybe run the redisplay end trigger hook. Performance note:
8223 This doesn't seem to cost measurable time. */ 8146 This doesn't seem to cost measurable time. */
@@ -8231,7 +8154,7 @@ next_element_from_buffer (struct it *it)
8231 stop) 8154 stop)
8232 && next_element_from_composition (it)) 8155 && next_element_from_composition (it))
8233 { 8156 {
8234 return 1; 8157 return true;
8235 } 8158 }
8236 8159
8237 /* Get the next character, maybe multibyte. */ 8160 /* Get the next character, maybe multibyte. */
@@ -8275,7 +8198,7 @@ next_element_from_buffer (struct it *it)
8275 } 8198 }
8276 } 8199 }
8277 8200
8278 /* Value is zero if end of buffer reached. */ 8201 /* Value is false if end of buffer reached. */
8279 eassert (!success_p || it->what != IT_CHARACTER || it->len > 0); 8202 eassert (!success_p || it->what != IT_CHARACTER || it->len > 0);
8280 return success_p; 8203 return success_p;
8281} 8204}
@@ -8309,7 +8232,7 @@ run_redisplay_end_trigger_hook (struct it *it)
8309 get_next_element[]. It is called from next_element_from_buffer and 8232 get_next_element[]. It is called from next_element_from_buffer and
8310 next_element_from_string when necessary. */ 8233 next_element_from_string when necessary. */
8311 8234
8312static int 8235static bool
8313next_element_from_composition (struct it *it) 8236next_element_from_composition (struct it *it)
8314{ 8237{
8315 it->what = IT_COMPOSITION; 8238 it->what = IT_COMPOSITION;
@@ -8320,7 +8243,7 @@ next_element_from_composition (struct it *it)
8320 { 8243 {
8321 IT_STRING_CHARPOS (*it) += it->cmp_it.nchars; 8244 IT_STRING_CHARPOS (*it) += it->cmp_it.nchars;
8322 IT_STRING_BYTEPOS (*it) += it->cmp_it.nbytes; 8245 IT_STRING_BYTEPOS (*it) += it->cmp_it.nbytes;
8323 return 0; 8246 return false;
8324 } 8247 }
8325 it->position = it->current.string_pos; 8248 it->position = it->current.string_pos;
8326 it->object = it->string; 8249 it->object = it->string;
@@ -8336,20 +8259,21 @@ next_element_from_composition (struct it *it)
8336 if (it->bidi_p) 8259 if (it->bidi_p)
8337 { 8260 {
8338 if (it->bidi_it.new_paragraph) 8261 if (it->bidi_it.new_paragraph)
8339 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, 0); 8262 bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it,
8263 false);
8340 /* Resync the bidi iterator with IT's new position. 8264 /* Resync the bidi iterator with IT's new position.
8341 FIXME: this doesn't support bidirectional text. */ 8265 FIXME: this doesn't support bidirectional text. */
8342 while (it->bidi_it.charpos < IT_CHARPOS (*it)) 8266 while (it->bidi_it.charpos < IT_CHARPOS (*it))
8343 bidi_move_to_visually_next (&it->bidi_it); 8267 bidi_move_to_visually_next (&it->bidi_it);
8344 } 8268 }
8345 return 0; 8269 return false;
8346 } 8270 }
8347 it->position = it->current.pos; 8271 it->position = it->current.pos;
8348 it->object = it->w->contents; 8272 it->object = it->w->contents;
8349 it->c = composition_update_it (&it->cmp_it, IT_CHARPOS (*it), 8273 it->c = composition_update_it (&it->cmp_it, IT_CHARPOS (*it),
8350 IT_BYTEPOS (*it), Qnil); 8274 IT_BYTEPOS (*it), Qnil);
8351 } 8275 }
8352 return 1; 8276 return true;
8353} 8277}
8354 8278
8355 8279
@@ -8362,9 +8286,7 @@ next_element_from_composition (struct it *it)
8362 position after some move_it_ call. */ 8286 position after some move_it_ call. */
8363 8287
8364#define IT_POS_VALID_AFTER_MOVE_P(it) \ 8288#define IT_POS_VALID_AFTER_MOVE_P(it) \
8365 ((it)->method == GET_FROM_STRING \ 8289 ((it)->method != GET_FROM_STRING || IT_STRING_CHARPOS (*it) == 0)
8366 ? IT_STRING_CHARPOS (*it) == 0 \
8367 : 1)
8368 8290
8369 8291
8370/* Move iterator IT to a specified buffer or X position within one 8292/* Move iterator IT to a specified buffer or X position within one
@@ -8410,10 +8332,10 @@ move_it_in_display_line_to (struct it *it,
8410 struct it wrap_it, atpos_it, atx_it, ppos_it; 8332 struct it wrap_it, atpos_it, atx_it, ppos_it;
8411 void *wrap_data = NULL, *atpos_data = NULL, *atx_data = NULL; 8333 void *wrap_data = NULL, *atpos_data = NULL, *atx_data = NULL;
8412 void *ppos_data = NULL; 8334 void *ppos_data = NULL;
8413 int may_wrap = 0; 8335 bool may_wrap = false;
8414 enum it_method prev_method = it->method; 8336 enum it_method prev_method = it->method;
8415 ptrdiff_t closest_pos IF_LINT (= 0), prev_pos = IT_CHARPOS (*it); 8337 ptrdiff_t closest_pos IF_LINT (= 0), prev_pos = IT_CHARPOS (*it);
8416 int saw_smaller_pos = prev_pos < to_charpos; 8338 bool saw_smaller_pos = prev_pos < to_charpos;
8417 8339
8418 /* Don't produce glyphs in produce_glyphs. */ 8340 /* Don't produce glyphs in produce_glyphs. */
8419 saved_glyph_row = it->glyph_row; 8341 saved_glyph_row = it->glyph_row;
@@ -8470,7 +8392,7 @@ move_it_in_display_line_to (struct it *it,
8470 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos)) 8392 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
8471 SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it)); 8393 SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it));
8472 8394
8473 while (1) 8395 while (true)
8474 { 8396 {
8475 int x, i, ascent = 0, descent = 0; 8397 int x, i, ascent = 0, descent = 0;
8476 8398
@@ -8537,7 +8459,7 @@ move_it_in_display_line_to (struct it *it,
8537 if (it->line_wrap == WORD_WRAP && it->area == TEXT_AREA) 8459 if (it->line_wrap == WORD_WRAP && it->area == TEXT_AREA)
8538 { 8460 {
8539 if (IT_DISPLAYING_WHITESPACE (it)) 8461 if (IT_DISPLAYING_WHITESPACE (it))
8540 may_wrap = 1; 8462 may_wrap = true;
8541 else if (may_wrap) 8463 else if (may_wrap)
8542 { 8464 {
8543 /* We have reached a glyph that follows one or more 8465 /* We have reached a glyph that follows one or more
@@ -8557,7 +8479,7 @@ move_it_in_display_line_to (struct it *it,
8557 } 8479 }
8558 /* Otherwise, we can wrap here. */ 8480 /* Otherwise, we can wrap here. */
8559 SAVE_IT (wrap_it, *it, wrap_data); 8481 SAVE_IT (wrap_it, *it, wrap_data);
8560 may_wrap = 0; 8482 may_wrap = false;
8561 } 8483 }
8562 } 8484 }
8563 } 8485 }
@@ -8580,7 +8502,7 @@ move_it_in_display_line_to (struct it *it,
8580 prev_method = it->method; 8502 prev_method = it->method;
8581 if (it->method == GET_FROM_BUFFER) 8503 if (it->method == GET_FROM_BUFFER)
8582 prev_pos = IT_CHARPOS (*it); 8504 prev_pos = IT_CHARPOS (*it);
8583 set_iterator_to_next (it, 1); 8505 set_iterator_to_next (it, true);
8584 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos)) 8506 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
8585 SET_TEXT_POS (this_line_min_pos, 8507 SET_TEXT_POS (this_line_min_pos,
8586 IT_CHARPOS (*it), IT_BYTEPOS (*it)); 8508 IT_CHARPOS (*it), IT_BYTEPOS (*it));
@@ -8702,7 +8624,7 @@ move_it_in_display_line_to (struct it *it,
8702 prev_method = it->method; 8624 prev_method = it->method;
8703 if (it->method == GET_FROM_BUFFER) 8625 if (it->method == GET_FROM_BUFFER)
8704 prev_pos = IT_CHARPOS (*it); 8626 prev_pos = IT_CHARPOS (*it);
8705 set_iterator_to_next (it, 1); 8627 set_iterator_to_next (it, true);
8706 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos)) 8628 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
8707 SET_TEXT_POS (this_line_min_pos, 8629 SET_TEXT_POS (this_line_min_pos,
8708 IT_CHARPOS (*it), IT_BYTEPOS (*it)); 8630 IT_CHARPOS (*it), IT_BYTEPOS (*it));
@@ -8840,11 +8762,11 @@ move_it_in_display_line_to (struct it *it,
8840 prev_pos = IT_CHARPOS (*it); 8762 prev_pos = IT_CHARPOS (*it);
8841 /* The current display element has been consumed. Advance 8763 /* The current display element has been consumed. Advance
8842 to the next. */ 8764 to the next. */
8843 set_iterator_to_next (it, 1); 8765 set_iterator_to_next (it, true);
8844 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos)) 8766 if (IT_CHARPOS (*it) < CHARPOS (this_line_min_pos))
8845 SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it)); 8767 SET_TEXT_POS (this_line_min_pos, IT_CHARPOS (*it), IT_BYTEPOS (*it));
8846 if (IT_CHARPOS (*it) < to_charpos) 8768 if (IT_CHARPOS (*it) < to_charpos)
8847 saw_smaller_pos = 1; 8769 saw_smaller_pos = true;
8848 if (it->bidi_p 8770 if (it->bidi_p
8849 && (op & MOVE_TO_POS) 8771 && (op & MOVE_TO_POS)
8850 && IT_CHARPOS (*it) >= to_charpos 8772 && IT_CHARPOS (*it) >= to_charpos
@@ -8862,7 +8784,7 @@ move_it_in_display_line_to (struct it *it,
8862 : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) == 0 8784 : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) == 0
8863 || IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) 8785 || IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
8864 { 8786 {
8865 int at_eob_p = 0; 8787 bool at_eob_p = false;
8866 8788
8867 if ((at_eob_p = !get_next_display_element (it)) 8789 if ((at_eob_p = !get_next_display_element (it))
8868 || BUFFER_POS_REACHED_P () 8790 || BUFFER_POS_REACHED_P ()
@@ -8924,13 +8846,13 @@ move_it_in_display_line_to (struct it *it,
8924 done: 8846 done:
8925 8847
8926 if (atpos_data) 8848 if (atpos_data)
8927 bidi_unshelve_cache (atpos_data, 1); 8849 bidi_unshelve_cache (atpos_data, true);
8928 if (atx_data) 8850 if (atx_data)
8929 bidi_unshelve_cache (atx_data, 1); 8851 bidi_unshelve_cache (atx_data, true);
8930 if (wrap_data) 8852 if (wrap_data)
8931 bidi_unshelve_cache (wrap_data, 1); 8853 bidi_unshelve_cache (wrap_data, true);
8932 if (ppos_data) 8854 if (ppos_data)
8933 bidi_unshelve_cache (ppos_data, 1); 8855 bidi_unshelve_cache (ppos_data, true);
8934 8856
8935 /* Restore the iterator settings altered at the beginning of this 8857 /* Restore the iterator settings altered at the beginning of this
8936 function. */ 8858 function. */
@@ -8965,7 +8887,7 @@ move_it_in_display_line (struct it *it,
8965 (it, -1, prev_x, MOVE_TO_X); 8887 (it, -1, prev_x, MOVE_TO_X);
8966 } 8888 }
8967 else 8889 else
8968 bidi_unshelve_cache (save_data, 1); 8890 bidi_unshelve_cache (save_data, true);
8969 } 8891 }
8970 else 8892 else
8971 move_it_in_display_line_to (it, to_charpos, to_x, op); 8893 move_it_in_display_line_to (it, to_charpos, to_x, op);
@@ -9172,14 +9094,14 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos
9172 9094
9173 case MOVE_NEWLINE_OR_CR: 9095 case MOVE_NEWLINE_OR_CR:
9174 max_current_x = max (it->current_x, max_current_x); 9096 max_current_x = max (it->current_x, max_current_x);
9175 set_iterator_to_next (it, 1); 9097 set_iterator_to_next (it, true);
9176 it->continuation_lines_width = 0; 9098 it->continuation_lines_width = 0;
9177 break; 9099 break;
9178 9100
9179 case MOVE_LINE_TRUNCATED: 9101 case MOVE_LINE_TRUNCATED:
9180 max_current_x = it->last_visible_x; 9102 max_current_x = it->last_visible_x;
9181 it->continuation_lines_width = 0; 9103 it->continuation_lines_width = 0;
9182 reseat_at_next_visible_line_start (it, 0); 9104 reseat_at_next_visible_line_start (it, false);
9183 if ((op & MOVE_TO_POS) != 0 9105 if ((op & MOVE_TO_POS) != 0
9184 && IT_CHARPOS (*it) > to_charpos) 9106 && IT_CHARPOS (*it) > to_charpos)
9185 { 9107 {
@@ -9225,7 +9147,7 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos
9225 += it->tab_width * face_font->space_width; 9147 += it->tab_width * face_font->space_width;
9226 } 9148 }
9227 } 9149 }
9228 set_iterator_to_next (it, 0); 9150 set_iterator_to_next (it, false);
9229 } 9151 }
9230 } 9152 }
9231 else 9153 else
@@ -9274,7 +9196,7 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos
9274 } 9196 }
9275 9197
9276 if (backup_data) 9198 if (backup_data)
9277 bidi_unshelve_cache (backup_data, 1); 9199 bidi_unshelve_cache (backup_data, true);
9278 9200
9279 TRACE_MOVE ((stderr, "move_it_to: reached %d\n", reached)); 9201 TRACE_MOVE ((stderr, "move_it_to: reached %d\n", reached));
9280 9202
@@ -9323,7 +9245,7 @@ move_it_vertically_backward (struct it *it, int dy)
9323 reseat to skip forward over invisible text, set up the iterator 9245 reseat to skip forward over invisible text, set up the iterator
9324 to deliver from overlay strings at the new position etc. So, 9246 to deliver from overlay strings at the new position etc. So,
9325 use reseat_1 here. */ 9247 use reseat_1 here. */
9326 reseat_1 (it, it->current.pos, 1); 9248 reseat_1 (it, it->current.pos, true);
9327 9249
9328 /* We are now surely at a line start. */ 9250 /* We are now surely at a line start. */
9329 it->current_x = it->hpos = 0; /* FIXME: this is incorrect when bidi 9251 it->current_x = it->hpos = 0; /* FIXME: this is incorrect when bidi
@@ -9393,7 +9315,7 @@ move_it_vertically_backward (struct it *it, int dy)
9393 cp = find_newline_no_quit (cp, bp, -1, NULL); 9315 cp = find_newline_no_quit (cp, bp, -1, NULL);
9394 move_it_to (it, cp, -1, -1, -1, MOVE_TO_POS); 9316 move_it_to (it, cp, -1, -1, -1, MOVE_TO_POS);
9395 } 9317 }
9396 bidi_unshelve_cache (it3data, 1); 9318 bidi_unshelve_cache (it3data, true);
9397 } 9319 }
9398 else 9320 else
9399 { 9321 {
@@ -9485,7 +9407,7 @@ move_it_past_eol (struct it *it)
9485 9407
9486 rc = move_it_in_display_line_to (it, Z, 0, MOVE_TO_POS); 9408 rc = move_it_in_display_line_to (it, Z, 0, MOVE_TO_POS);
9487 if (rc == MOVE_NEWLINE_OR_CR) 9409 if (rc == MOVE_NEWLINE_OR_CR)
9488 set_iterator_to_next (it, 0); 9410 set_iterator_to_next (it, false);
9489} 9411}
9490 9412
9491 9413
@@ -9511,7 +9433,7 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos)
9511 9433
9512 pos = *vmotion (IT_CHARPOS (*it), dvpos, it->w); 9434 pos = *vmotion (IT_CHARPOS (*it), dvpos, it->w);
9513 SET_TEXT_POS (textpos, pos.bufpos, pos.bytepos); 9435 SET_TEXT_POS (textpos, pos.bufpos, pos.bytepos);
9514 reseat (it, textpos, 1); 9436 reseat (it, textpos, true);
9515 it->vpos += pos.vpos; 9437 it->vpos += pos.vpos;
9516 it->current_y += pos.vpos; 9438 it->current_y += pos.vpos;
9517 } 9439 }
@@ -9572,7 +9494,7 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos)
9572 back_to_previous_visible_line_start (it); 9494 back_to_previous_visible_line_start (it);
9573 if (i > 0 && IT_CHARPOS (*it) <= pos_limit) 9495 if (i > 0 && IT_CHARPOS (*it) <= pos_limit)
9574 hit_pos_limit = true; 9496 hit_pos_limit = true;
9575 reseat (it, it->current.pos, 1); 9497 reseat (it, it->current.pos, true);
9576 9498
9577 /* Move further back if we end up in a string or an image. */ 9499 /* Move further back if we end up in a string or an image. */
9578 while (!IT_POS_VALID_AFTER_MOVE_P (it)) 9500 while (!IT_POS_VALID_AFTER_MOVE_P (it))
@@ -9586,7 +9508,7 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos)
9586 /* If start of line is still in string or image, 9508 /* If start of line is still in string or image,
9587 move further back. */ 9509 move further back. */
9588 back_to_previous_visible_line_start (it); 9510 back_to_previous_visible_line_start (it);
9589 reseat (it, it->current.pos, 1); 9511 reseat (it, it->current.pos, true);
9590 dvpos--; 9512 dvpos--;
9591 } 9513 }
9592 9514
@@ -9613,7 +9535,7 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos)
9613 if (IT_CHARPOS (*it) >= start_charpos) 9535 if (IT_CHARPOS (*it) >= start_charpos)
9614 RESTORE_IT (it, &it2, it2data); 9536 RESTORE_IT (it, &it2, it2data);
9615 else 9537 else
9616 bidi_unshelve_cache (it2data, 1); 9538 bidi_unshelve_cache (it2data, true);
9617 } 9539 }
9618 else if (hit_pos_limit && pos_limit > BEGV 9540 else if (hit_pos_limit && pos_limit > BEGV
9619 && dvpos < 0 && it2.vpos < -dvpos) 9541 && dvpos < 0 && it2.vpos < -dvpos)
@@ -9633,7 +9555,7 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos)
9633 back_to_previous_visible_line_start (it); 9555 back_to_previous_visible_line_start (it);
9634 it->vpos--; 9556 it->vpos--;
9635 } 9557 }
9636 reseat_1 (it, it->current.pos, 1); 9558 reseat_1 (it, it->current.pos, true);
9637 } 9559 }
9638 else 9560 else
9639 RESTORE_IT (it, it, it2data); 9561 RESTORE_IT (it, it, it2data);
@@ -9777,7 +9699,7 @@ include the height of both, if present, in the return value. */)
9777 start_display. */ 9699 start_display. */
9778 y = y + WINDOW_MODE_LINE_HEIGHT (w); 9700 y = y + WINDOW_MODE_LINE_HEIGHT (w);
9779 9701
9780 bidi_unshelve_cache (itdata, 0); 9702 bidi_unshelve_cache (itdata, false);
9781 9703
9782 if (old_b) 9704 if (old_b)
9783 set_buffer_internal (old_b); 9705 set_buffer_internal (old_b);
@@ -9812,7 +9734,7 @@ add_to_log (const char *format, Lisp_Object arg1, Lisp_Object arg2)
9812 buffer = SAFE_ALLOCA (len); 9734 buffer = SAFE_ALLOCA (len);
9813 memcpy (buffer, SDATA (msg), len); 9735 memcpy (buffer, SDATA (msg), len);
9814 9736
9815 message_dolog (buffer, len - 1, 1, 0); 9737 message_dolog (buffer, len - 1, true, false);
9816 SAFE_FREE (); 9738 SAFE_FREE ();
9817 9739
9818 UNGCPRO; 9740 UNGCPRO;
@@ -9825,7 +9747,7 @@ void
9825message_log_maybe_newline (void) 9747message_log_maybe_newline (void)
9826{ 9748{
9827 if (message_log_need_newline) 9749 if (message_log_need_newline)
9828 message_dolog ("", 0, 1, 0); 9750 message_dolog ("", 0, true, false);
9829} 9751}
9830 9752
9831 9753
@@ -9861,16 +9783,11 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte)
9861 9783
9862 /* Ensure the Messages buffer exists, and switch to it. 9784 /* Ensure the Messages buffer exists, and switch to it.
9863 If we created it, set the major-mode. */ 9785 If we created it, set the major-mode. */
9864 { 9786 bool newbuffer = NILP (Fget_buffer (Vmessages_buffer_name));
9865 int newbuffer = 0; 9787 Fset_buffer (Fget_buffer_create (Vmessages_buffer_name));
9866 if (NILP (Fget_buffer (Vmessages_buffer_name))) newbuffer = 1; 9788 if (newbuffer
9867 9789 && !NILP (Ffboundp (intern ("messages-buffer-mode"))))
9868 Fset_buffer (Fget_buffer_create (Vmessages_buffer_name)); 9790 call0 (intern ("messages-buffer-mode"));
9869
9870 if (newbuffer
9871 && !NILP (Ffboundp (intern ("messages-buffer-mode"))))
9872 call0 (intern ("messages-buffer-mode"));
9873 }
9874 9791
9875 bset_undo_list (current_buffer, Qt); 9792 bset_undo_list (current_buffer, Qt);
9876 bset_cache_long_scans (current_buffer, Qnil); 9793 bset_cache_long_scans (current_buffer, Qnil);
@@ -9909,7 +9826,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte)
9909 { 9826 {
9910 c = string_char_and_length (msg + i, &char_bytes); 9827 c = string_char_and_length (msg + i, &char_bytes);
9911 work[0] = CHAR_TO_BYTE8 (c); 9828 work[0] = CHAR_TO_BYTE8 (c);
9912 insert_1_both (work, 1, 1, 1, 0, 0); 9829 insert_1_both (work, 1, 1, true, false, false);
9913 } 9830 }
9914 } 9831 }
9915 else if (! multibyte 9832 else if (! multibyte
@@ -9925,20 +9842,21 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte)
9925 c = msg[i]; 9842 c = msg[i];
9926 MAKE_CHAR_MULTIBYTE (c); 9843 MAKE_CHAR_MULTIBYTE (c);
9927 char_bytes = CHAR_STRING (c, str); 9844 char_bytes = CHAR_STRING (c, str);
9928 insert_1_both ((char *) str, 1, char_bytes, 1, 0, 0); 9845 insert_1_both ((char *) str, 1, char_bytes, true, false, false);
9929 } 9846 }
9930 } 9847 }
9931 else if (nbytes) 9848 else if (nbytes)
9932 insert_1_both (m, chars_in_text (msg, nbytes), nbytes, 1, 0, 0); 9849 insert_1_both (m, chars_in_text (msg, nbytes), nbytes,
9850 true, false, false);
9933 9851
9934 if (nlflag) 9852 if (nlflag)
9935 { 9853 {
9936 ptrdiff_t this_bol, this_bol_byte, prev_bol, prev_bol_byte; 9854 ptrdiff_t this_bol, this_bol_byte, prev_bol, prev_bol_byte;
9937 printmax_t dups; 9855 printmax_t dups;
9938 9856
9939 insert_1_both ("\n", 1, 1, 1, 0, 0); 9857 insert_1_both ("\n", 1, 1, true, false, false);
9940 9858
9941 scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0); 9859 scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, false);
9942 this_bol = PT; 9860 this_bol = PT;
9943 this_bol_byte = PT_BYTE; 9861 this_bol_byte = PT_BYTE;
9944 9862
@@ -9946,7 +9864,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte)
9946 If so, combine duplicates. */ 9864 If so, combine duplicates. */
9947 if (this_bol > BEG) 9865 if (this_bol > BEG)
9948 { 9866 {
9949 scan_newline (PT, PT_BYTE, BEG, BEG_BYTE, -2, 0); 9867 scan_newline (PT, PT_BYTE, BEG, BEG_BYTE, -2, false);
9950 prev_bol = PT; 9868 prev_bol = PT;
9951 prev_bol_byte = PT_BYTE; 9869 prev_bol_byte = PT_BYTE;
9952 9870
@@ -9955,7 +9873,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte)
9955 if (dups) 9873 if (dups)
9956 { 9874 {
9957 del_range_both (prev_bol, prev_bol_byte, 9875 del_range_both (prev_bol, prev_bol_byte,
9958 this_bol, this_bol_byte, 0); 9876 this_bol, this_bol_byte, false);
9959 if (dups > 1) 9877 if (dups > 1)
9960 { 9878 {
9961 char dupstr[sizeof " [ times]" 9879 char dupstr[sizeof " [ times]"
@@ -9965,7 +9883,8 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte)
9965 change message_log_check_duplicate. */ 9883 change message_log_check_duplicate. */
9966 int duplen = sprintf (dupstr, " [%"pMd" times]", dups); 9884 int duplen = sprintf (dupstr, " [%"pMd" times]", dups);
9967 TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1); 9885 TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1);
9968 insert_1_both (dupstr, duplen, duplen, 1, 0, 1); 9886 insert_1_both (dupstr, duplen, duplen,
9887 true, false, true);
9969 } 9888 }
9970 } 9889 }
9971 } 9890 }
@@ -9977,8 +9896,8 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte)
9977 if (NATNUMP (Vmessage_log_max)) 9896 if (NATNUMP (Vmessage_log_max))
9978 { 9897 {
9979 scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, 9898 scan_newline (Z, Z_BYTE, BEG, BEG_BYTE,
9980 -XFASTINT (Vmessage_log_max) - 1, 0); 9899 -XFASTINT (Vmessage_log_max) - 1, false);
9981 del_range_both (BEG, BEG_BYTE, PT, PT_BYTE, 0); 9900 del_range_both (BEG, BEG_BYTE, PT, PT_BYTE, false);
9982 } 9901 }
9983 } 9902 }
9984 BEGV = marker_position (oldbegv); 9903 BEGV = marker_position (oldbegv);
@@ -10009,7 +9928,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte)
10009 unchain_marker (XMARKER (oldzv)); 9928 unchain_marker (XMARKER (oldzv));
10010 9929
10011 /* We called insert_1_both above with its 5th argument (PREPARE) 9930 /* We called insert_1_both above with its 5th argument (PREPARE)
10012 zero, which prevents insert_1_both from calling 9931 false, which prevents insert_1_both from calling
10013 prepare_to_modify_buffer, which in turns prevents us from 9932 prepare_to_modify_buffer, which in turns prevents us from
10014 incrementing windows_or_buffers_changed even if *Messages* is 9933 incrementing windows_or_buffers_changed even if *Messages* is
10015 shown in some window. So we must manually set 9934 shown in some window. So we must manually set
@@ -10036,14 +9955,14 @@ message_log_check_duplicate (ptrdiff_t prev_bol_byte, ptrdiff_t this_bol_byte)
10036{ 9955{
10037 ptrdiff_t i; 9956 ptrdiff_t i;
10038 ptrdiff_t len = Z_BYTE - 1 - this_bol_byte; 9957 ptrdiff_t len = Z_BYTE - 1 - this_bol_byte;
10039 int seen_dots = 0; 9958 bool seen_dots = false;
10040 unsigned char *p1 = BUF_BYTE_ADDRESS (current_buffer, prev_bol_byte); 9959 unsigned char *p1 = BUF_BYTE_ADDRESS (current_buffer, prev_bol_byte);
10041 unsigned char *p2 = BUF_BYTE_ADDRESS (current_buffer, this_bol_byte); 9960 unsigned char *p2 = BUF_BYTE_ADDRESS (current_buffer, this_bol_byte);
10042 9961
10043 for (i = 0; i < len; i++) 9962 for (i = 0; i < len; i++)
10044 { 9963 {
10045 if (i >= 3 && p1[i - 3] == '.' && p1[i - 2] == '.' && p1[i - 1] == '.') 9964 if (i >= 3 && p1[i - 3] == '.' && p1[i - 2] == '.' && p1[i - 1] == '.')
10046 seen_dots = 1; 9965 seen_dots = true;
10047 if (p1[i] != p2[i]) 9966 if (p1[i] != p2[i])
10048 return seen_dots; 9967 return seen_dots;
10049 } 9968 }
@@ -10086,7 +10005,7 @@ message3 (Lisp_Object m)
10086 char *buffer; 10005 char *buffer;
10087 USE_SAFE_ALLOCA; 10006 USE_SAFE_ALLOCA;
10088 SAFE_ALLOCA_STRING (buffer, m); 10007 SAFE_ALLOCA_STRING (buffer, m);
10089 message_dolog (buffer, nbytes, 1, multibyte); 10008 message_dolog (buffer, nbytes, true, multibyte);
10090 SAFE_FREE (); 10009 SAFE_FREE ();
10091 } 10010 }
10092 message3_nolog (m); 10011 message3_nolog (m);
@@ -10109,7 +10028,7 @@ message3_nolog (Lisp_Object m)
10109 { 10028 {
10110 if (noninteractive_need_newline) 10029 if (noninteractive_need_newline)
10111 putc ('\n', stderr); 10030 putc ('\n', stderr);
10112 noninteractive_need_newline = 0; 10031 noninteractive_need_newline = false;
10113 if (STRINGP (m)) 10032 if (STRINGP (m))
10114 { 10033 {
10115 Lisp_Object s = ENCODE_SYSTEM (m); 10034 Lisp_Object s = ENCODE_SYSTEM (m);
@@ -10182,7 +10101,7 @@ message1_nolog (const char *m)
10182 which gets replaced with STRING. */ 10101 which gets replaced with STRING. */
10183 10102
10184void 10103void
10185message_with_string (const char *m, Lisp_Object string, int log) 10104message_with_string (const char *m, Lisp_Object string, bool log)
10186{ 10105{
10187 CHECK_STRING (string); 10106 CHECK_STRING (string);
10188 10107
@@ -10196,7 +10115,7 @@ message_with_string (const char *m, Lisp_Object string, int log)
10196 10115
10197 if (noninteractive_need_newline) 10116 if (noninteractive_need_newline)
10198 putc ('\n', stderr); 10117 putc ('\n', stderr);
10199 noninteractive_need_newline = 0; 10118 noninteractive_need_newline = false;
10200 fprintf (stderr, m, SDATA (ENCODE_SYSTEM (string))); 10119 fprintf (stderr, m, SDATA (ENCODE_SYSTEM (string)));
10201 if (!cursor_in_echo_area) 10120 if (!cursor_in_echo_area)
10202 fprintf (stderr, "\n"); 10121 fprintf (stderr, "\n");
@@ -10238,7 +10157,7 @@ message_with_string (const char *m, Lisp_Object string, int log)
10238 10157
10239 /* Print should start at the beginning of the message 10158 /* Print should start at the beginning of the message
10240 buffer next time. */ 10159 buffer next time. */
10241 message_buf_print = 0; 10160 message_buf_print = false;
10242 } 10161 }
10243 } 10162 }
10244} 10163}
@@ -10247,7 +10166,7 @@ message_with_string (const char *m, Lisp_Object string, int log)
10247/* Dump an informative message to the minibuf. If M is 0, clear out 10166/* Dump an informative message to the minibuf. If M is 0, clear out
10248 any existing message, and let the mini-buffer text show through. */ 10167 any existing message, and let the mini-buffer text show through. */
10249 10168
10250static void 10169static void ATTRIBUTE_FORMAT_PRINTF (1, 0)
10251vmessage (const char *m, va_list ap) 10170vmessage (const char *m, va_list ap)
10252{ 10171{
10253 if (noninteractive) 10172 if (noninteractive)
@@ -10256,7 +10175,7 @@ vmessage (const char *m, va_list ap)
10256 { 10175 {
10257 if (noninteractive_need_newline) 10176 if (noninteractive_need_newline)
10258 putc ('\n', stderr); 10177 putc ('\n', stderr);
10259 noninteractive_need_newline = 0; 10178 noninteractive_need_newline = false;
10260 vfprintf (stderr, m, ap); 10179 vfprintf (stderr, m, ap);
10261 if (!cursor_in_echo_area) 10180 if (!cursor_in_echo_area)
10262 fprintf (stderr, "\n"); 10181 fprintf (stderr, "\n");
@@ -10298,7 +10217,7 @@ vmessage (const char *m, va_list ap)
10298 10217
10299 /* Print should start at the beginning of the message 10218 /* Print should start at the beginning of the message
10300 buffer next time. */ 10219 buffer next time. */
10301 message_buf_print = 0; 10220 message_buf_print = false;
10302 } 10221 }
10303 } 10222 }
10304} 10223}
@@ -10313,7 +10232,7 @@ message (const char *m, ...)
10313} 10232}
10314 10233
10315 10234
10316#if 0 10235#if false
10317/* The non-logging version of message. */ 10236/* The non-logging version of message. */
10318 10237
10319void 10238void
@@ -10394,27 +10313,27 @@ ensure_echo_area_buffers (void)
10394 10313
10395 Value is what FN returns. */ 10314 Value is what FN returns. */
10396 10315
10397static int 10316static bool
10398with_echo_area_buffer (struct window *w, int which, 10317with_echo_area_buffer (struct window *w, int which,
10399 int (*fn) (ptrdiff_t, Lisp_Object), 10318 bool (*fn) (ptrdiff_t, Lisp_Object),
10400 ptrdiff_t a1, Lisp_Object a2) 10319 ptrdiff_t a1, Lisp_Object a2)
10401{ 10320{
10402 Lisp_Object buffer; 10321 Lisp_Object buffer;
10403 int this_one, the_other, clear_buffer_p, rc; 10322 bool this_one, the_other, clear_buffer_p, rc;
10404 ptrdiff_t count = SPECPDL_INDEX (); 10323 ptrdiff_t count = SPECPDL_INDEX ();
10405 10324
10406 /* If buffers aren't live, make new ones. */ 10325 /* If buffers aren't live, make new ones. */
10407 ensure_echo_area_buffers (); 10326 ensure_echo_area_buffers ();
10408 10327
10409 clear_buffer_p = 0; 10328 clear_buffer_p = false;
10410 10329
10411 if (which == 0) 10330 if (which == 0)
10412 this_one = 0, the_other = 1; 10331 this_one = false, the_other = true;
10413 else if (which > 0) 10332 else if (which > 0)
10414 this_one = 1, the_other = 0; 10333 this_one = true, the_other = false;
10415 else 10334 else
10416 { 10335 {
10417 this_one = 0, the_other = 1; 10336 this_one = false, the_other = true;
10418 clear_buffer_p = true; 10337 clear_buffer_p = true;
10419 10338
10420 /* We need a fresh one in case the current echo buffer equals 10339 /* We need a fresh one in case the current echo buffer equals
@@ -10560,10 +10479,10 @@ unwind_with_echo_area_buffer (Lisp_Object vector)
10560 10479
10561 10480
10562/* Set up the echo area for use by print functions. MULTIBYTE_P 10481/* Set up the echo area for use by print functions. MULTIBYTE_P
10563 non-zero means we will print multibyte. */ 10482 means we will print multibyte. */
10564 10483
10565void 10484void
10566setup_echo_area_for_printing (int multibyte_p) 10485setup_echo_area_for_printing (bool multibyte_p)
10567{ 10486{
10568 /* If we can't find an echo area any more, exit. */ 10487 /* If we can't find an echo area any more, exit. */
10569 if (! FRAME_LIVE_P (XFRAME (selected_frame))) 10488 if (! FRAME_LIVE_P (XFRAME (selected_frame)))
@@ -10609,7 +10528,7 @@ setup_echo_area_for_printing (int multibyte_p)
10609 } 10528 }
10610 10529
10611 message_log_maybe_newline (); 10530 message_log_maybe_newline ();
10612 message_buf_print = 1; 10531 message_buf_print = true;
10613 } 10532 }
10614 else 10533 else
10615 { 10534 {
@@ -10631,15 +10550,15 @@ setup_echo_area_for_printing (int multibyte_p)
10631} 10550}
10632 10551
10633 10552
10634/* Display an echo area message in window W. Value is non-zero if W's 10553/* Display an echo area message in window W. Value is true if W's
10635 height is changed. If display_last_displayed_message_p is 10554 height is changed. If display_last_displayed_message_p,
10636 non-zero, display the message that was last displayed, otherwise 10555 display the message that was last displayed, otherwise
10637 display the current message. */ 10556 display the current message. */
10638 10557
10639static int 10558static bool
10640display_echo_area (struct window *w) 10559display_echo_area (struct window *w)
10641{ 10560{
10642 int i, no_message_p, window_height_changed_p; 10561 bool no_message_p, window_height_changed_p;
10643 10562
10644 /* Temporarily disable garbage collections while displaying the echo 10563 /* Temporarily disable garbage collections while displaying the echo
10645 area. This is done because a GC can print a message itself. 10564 area. This is done because a GC can print a message itself.
@@ -10652,7 +10571,7 @@ display_echo_area (struct window *w)
10652 nevertheless because it resizes the window. But we will have to 10571 nevertheless because it resizes the window. But we will have to
10653 reset the echo_area_buffer in question to nil at the end because 10572 reset the echo_area_buffer in question to nil at the end because
10654 with_echo_area_buffer will sets it to an empty buffer. */ 10573 with_echo_area_buffer will sets it to an empty buffer. */
10655 i = display_last_displayed_message_p ? 1 : 0; 10574 bool i = display_last_displayed_message_p;
10656 no_message_p = NILP (echo_area_buffer[i]); 10575 no_message_p = NILP (echo_area_buffer[i]);
10657 10576
10658 window_height_changed_p 10577 window_height_changed_p
@@ -10672,21 +10591,20 @@ display_echo_area (struct window *w)
10672 contains the current echo area message in window W, a mini-window, 10591 contains the current echo area message in window W, a mini-window,
10673 a pointer to which is passed in A1. A2..A4 are currently not used. 10592 a pointer to which is passed in A1. A2..A4 are currently not used.
10674 Change the height of W so that all of the message is displayed. 10593 Change the height of W so that all of the message is displayed.
10675 Value is non-zero if height of W was changed. */ 10594 Value is true if height of W was changed. */
10676 10595
10677static int 10596static bool
10678display_echo_area_1 (ptrdiff_t a1, Lisp_Object a2) 10597display_echo_area_1 (ptrdiff_t a1, Lisp_Object a2)
10679{ 10598{
10680 intptr_t i1 = a1; 10599 intptr_t i1 = a1;
10681 struct window *w = (struct window *) i1; 10600 struct window *w = (struct window *) i1;
10682 Lisp_Object window; 10601 Lisp_Object window;
10683 struct text_pos start; 10602 struct text_pos start;
10684 int window_height_changed_p = 0;
10685 10603
10686 /* Do this before displaying, so that we have a large enough glyph 10604 /* Do this before displaying, so that we have a large enough glyph
10687 matrix for the display. If we can't get enough space for the 10605 matrix for the display. If we can't get enough space for the
10688 whole text, display the last N lines. That works by setting w->start. */ 10606 whole text, display the last N lines. That works by setting w->start. */
10689 window_height_changed_p = resize_mini_window (w, 0); 10607 bool window_height_changed_p = resize_mini_window (w, false);
10690 10608
10691 /* Use the starting position chosen by resize_mini_window. */ 10609 /* Use the starting position chosen by resize_mini_window. */
10692 SET_TEXT_POS_FROM_MARKER (start, w->start); 10610 SET_TEXT_POS_FROM_MARKER (start, w->start);
@@ -10712,8 +10630,8 @@ resize_echo_area_exactly (void)
10712 { 10630 {
10713 struct window *w = XWINDOW (echo_area_window); 10631 struct window *w = XWINDOW (echo_area_window);
10714 Lisp_Object resize_exactly = (minibuf_level == 0 ? Qt : Qnil); 10632 Lisp_Object resize_exactly = (minibuf_level == 0 ? Qt : Qnil);
10715 int resized_p = with_echo_area_buffer (w, 0, resize_mini_window_1, 10633 bool resized_p = with_echo_area_buffer (w, 0, resize_mini_window_1,
10716 (intptr_t) w, resize_exactly); 10634 (intptr_t) w, resize_exactly);
10717 if (resized_p) 10635 if (resized_p)
10718 { 10636 {
10719 windows_or_buffers_changed = 42; 10637 windows_or_buffers_changed = 42;
@@ -10730,7 +10648,7 @@ resize_echo_area_exactly (void)
10730 size of the text displayed. A3 and A4 are not used. Value is what 10648 size of the text displayed. A3 and A4 are not used. Value is what
10731 resize_mini_window returns. */ 10649 resize_mini_window returns. */
10732 10650
10733static int 10651static bool
10734resize_mini_window_1 (ptrdiff_t a1, Lisp_Object exactly) 10652resize_mini_window_1 (ptrdiff_t a1, Lisp_Object exactly)
10735{ 10653{
10736 intptr_t i1 = a1; 10654 intptr_t i1 = a1;
@@ -10747,13 +10665,13 @@ resize_mini_window_1 (ptrdiff_t a1, Lisp_Object exactly)
10747 to make the end of the contents appear. This is particularly 10665 to make the end of the contents appear. This is particularly
10748 important for y-or-n-p, but seems desirable generally. 10666 important for y-or-n-p, but seems desirable generally.
10749 10667
10750 Value is non-zero if the window height has been changed. */ 10668 Value is true if the window height has been changed. */
10751 10669
10752int 10670bool
10753resize_mini_window (struct window *w, int exact_p) 10671resize_mini_window (struct window *w, bool exact_p)
10754{ 10672{
10755 struct frame *f = XFRAME (w->frame); 10673 struct frame *f = XFRAME (w->frame);
10756 int window_height_changed_p = 0; 10674 bool window_height_changed_p = false;
10757 10675
10758 eassert (MINI_WINDOW_P (w)); 10676 eassert (MINI_WINDOW_P (w));
10759 10677
@@ -10769,12 +10687,12 @@ resize_mini_window (struct window *w, int exact_p)
10769 we are running fontification-functions. We're running these 10687 we are running fontification-functions. We're running these
10770 functions with safe_call which binds inhibit-redisplay to t. */ 10688 functions with safe_call which binds inhibit-redisplay to t. */
10771 if (!NILP (Vinhibit_redisplay)) 10689 if (!NILP (Vinhibit_redisplay))
10772 return 0; 10690 return false;
10773 10691
10774 /* Nil means don't try to resize. */ 10692 /* Nil means don't try to resize. */
10775 if (NILP (Vresize_mini_windows) 10693 if (NILP (Vresize_mini_windows)
10776 || (FRAME_X_P (f) && FRAME_X_OUTPUT (f) == NULL)) 10694 || (FRAME_X_P (f) && FRAME_X_OUTPUT (f) == NULL))
10777 return 0; 10695 return false;
10778 10696
10779 if (!FRAME_MINIBUF_ONLY_P (f)) 10697 if (!FRAME_MINIBUF_ONLY_P (f))
10780 { 10698 {
@@ -10839,8 +10757,8 @@ resize_mini_window (struct window *w, int exact_p)
10839 { 10757 {
10840 int old_height = WINDOW_PIXEL_HEIGHT (w); 10758 int old_height = WINDOW_PIXEL_HEIGHT (w);
10841 10759
10842 FRAME_WINDOWS_FROZEN (f) = 1; 10760 FRAME_WINDOWS_FROZEN (f) = true;
10843 grow_mini_window (w, height - WINDOW_PIXEL_HEIGHT (w), 1); 10761 grow_mini_window (w, height - WINDOW_PIXEL_HEIGHT (w), true);
10844 window_height_changed_p = WINDOW_PIXEL_HEIGHT (w) != old_height; 10762 window_height_changed_p = WINDOW_PIXEL_HEIGHT (w) != old_height;
10845 } 10763 }
10846 else if (height < WINDOW_PIXEL_HEIGHT (w) 10764 else if (height < WINDOW_PIXEL_HEIGHT (w)
@@ -10848,8 +10766,8 @@ resize_mini_window (struct window *w, int exact_p)
10848 { 10766 {
10849 int old_height = WINDOW_PIXEL_HEIGHT (w); 10767 int old_height = WINDOW_PIXEL_HEIGHT (w);
10850 10768
10851 FRAME_WINDOWS_FROZEN (f) = 0; 10769 FRAME_WINDOWS_FROZEN (f) = false;
10852 shrink_mini_window (w, 1); 10770 shrink_mini_window (w, true);
10853 window_height_changed_p = WINDOW_PIXEL_HEIGHT (w) != old_height; 10771 window_height_changed_p = WINDOW_PIXEL_HEIGHT (w) != old_height;
10854 } 10772 }
10855 } 10773 }
@@ -10860,21 +10778,21 @@ resize_mini_window (struct window *w, int exact_p)
10860 { 10778 {
10861 int old_height = WINDOW_PIXEL_HEIGHT (w); 10779 int old_height = WINDOW_PIXEL_HEIGHT (w);
10862 10780
10863 FRAME_WINDOWS_FROZEN (f) = 1; 10781 FRAME_WINDOWS_FROZEN (f) = true;
10864 grow_mini_window (w, height - WINDOW_PIXEL_HEIGHT (w), 1); 10782 grow_mini_window (w, height - WINDOW_PIXEL_HEIGHT (w), true);
10865 window_height_changed_p = WINDOW_PIXEL_HEIGHT (w) != old_height; 10783 window_height_changed_p = WINDOW_PIXEL_HEIGHT (w) != old_height;
10866 } 10784 }
10867 else if (height < WINDOW_PIXEL_HEIGHT (w)) 10785 else if (height < WINDOW_PIXEL_HEIGHT (w))
10868 { 10786 {
10869 int old_height = WINDOW_PIXEL_HEIGHT (w); 10787 int old_height = WINDOW_PIXEL_HEIGHT (w);
10870 10788
10871 FRAME_WINDOWS_FROZEN (f) = 0; 10789 FRAME_WINDOWS_FROZEN (f) = false;
10872 shrink_mini_window (w, 1); 10790 shrink_mini_window (w, true);
10873 10791
10874 if (height) 10792 if (height)
10875 { 10793 {
10876 FRAME_WINDOWS_FROZEN (f) = 1; 10794 FRAME_WINDOWS_FROZEN (f) = true;
10877 grow_mini_window (w, height - WINDOW_PIXEL_HEIGHT (w), 1); 10795 grow_mini_window (w, height - WINDOW_PIXEL_HEIGHT (w), true);
10878 } 10796 }
10879 10797
10880 window_height_changed_p = WINDOW_PIXEL_HEIGHT (w) != old_height; 10798 window_height_changed_p = WINDOW_PIXEL_HEIGHT (w) != old_height;
@@ -10911,22 +10829,22 @@ current_message (void)
10911} 10829}
10912 10830
10913 10831
10914static int 10832static bool
10915current_message_1 (ptrdiff_t a1, Lisp_Object a2) 10833current_message_1 (ptrdiff_t a1, Lisp_Object a2)
10916{ 10834{
10917 intptr_t i1 = a1; 10835 intptr_t i1 = a1;
10918 Lisp_Object *msg = (Lisp_Object *) i1; 10836 Lisp_Object *msg = (Lisp_Object *) i1;
10919 10837
10920 if (Z > BEG) 10838 if (Z > BEG)
10921 *msg = make_buffer_string (BEG, Z, 1); 10839 *msg = make_buffer_string (BEG, Z, true);
10922 else 10840 else
10923 *msg = Qnil; 10841 *msg = Qnil;
10924 return 0; 10842 return false;
10925} 10843}
10926 10844
10927 10845
10928/* Push the current message on Vmessage_stack for later restoration 10846/* Push the current message on Vmessage_stack for later restoration
10929 by restore_message. Value is non-zero if the current message isn't 10847 by restore_message. Value is true if the current message isn't
10930 empty. This is a relatively infrequent operation, so it's not 10848 empty. This is a relatively infrequent operation, so it's not
10931 worth optimizing. */ 10849 worth optimizing. */
10932 10850
@@ -10997,14 +10915,14 @@ truncate_echo_area (ptrdiff_t nchars)
10997/* Helper function for truncate_echo_area. Truncate the current 10915/* Helper function for truncate_echo_area. Truncate the current
10998 message to at most NCHARS characters. */ 10916 message to at most NCHARS characters. */
10999 10917
11000static int 10918static bool
11001truncate_message_1 (ptrdiff_t nchars, Lisp_Object a2) 10919truncate_message_1 (ptrdiff_t nchars, Lisp_Object a2)
11002{ 10920{
11003 if (BEG + nchars < Z) 10921 if (BEG + nchars < Z)
11004 del_range (BEG + nchars, Z); 10922 del_range (BEG + nchars, Z);
11005 if (Z == BEG) 10923 if (Z == BEG)
11006 echo_area_buffer[0] = Qnil; 10924 echo_area_buffer[0] = Qnil;
11007 return 0; 10925 return false;
11008} 10926}
11009 10927
11010/* Set the current message to STRING. */ 10928/* Set the current message to STRING. */
@@ -11017,8 +10935,8 @@ set_message (Lisp_Object string)
11017 message_enable_multibyte = STRING_MULTIBYTE (string); 10935 message_enable_multibyte = STRING_MULTIBYTE (string);
11018 10936
11019 with_echo_area_buffer (0, -1, set_message_1, 0, string); 10937 with_echo_area_buffer (0, -1, set_message_1, 0, string);
11020 message_buf_print = 0; 10938 message_buf_print = false;
11021 help_echo_showing_p = 0; 10939 help_echo_showing_p = false;
11022 10940
11023 if (STRINGP (Vdebug_on_message) 10941 if (STRINGP (Vdebug_on_message)
11024 && STRINGP (string) 10942 && STRINGP (string)
@@ -11031,7 +10949,7 @@ set_message (Lisp_Object string)
11031 argument has the same meaning as for set_message. 10949 argument has the same meaning as for set_message.
11032 This function is called with the echo area buffer being current. */ 10950 This function is called with the echo area buffer being current. */
11033 10951
11034static int 10952static bool
11035set_message_1 (ptrdiff_t a1, Lisp_Object string) 10953set_message_1 (ptrdiff_t a1, Lisp_Object string)
11036{ 10954{
11037 eassert (STRINGP (string)); 10955 eassert (STRINGP (string));
@@ -11051,15 +10969,14 @@ set_message_1 (ptrdiff_t a1, Lisp_Object string)
11051 /* This function takes care of single/multibyte conversion. 10969 /* This function takes care of single/multibyte conversion.
11052 We just have to ensure that the echo area buffer has the right 10970 We just have to ensure that the echo area buffer has the right
11053 setting of enable_multibyte_characters. */ 10971 setting of enable_multibyte_characters. */
11054 insert_from_string (string, 0, 0, SCHARS (string), SBYTES (string), 1); 10972 insert_from_string (string, 0, 0, SCHARS (string), SBYTES (string), true);
11055 10973
11056 return 0; 10974 return false;
11057} 10975}
11058 10976
11059 10977
11060/* Clear messages. CURRENT_P non-zero means clear the current 10978/* Clear messages. CURRENT_P means clear the current message.
11061 message. LAST_DISPLAYED_P non-zero means clear the message 10979 LAST_DISPLAYED_P means clear the message last displayed. */
11062 last displayed. */
11063 10980
11064void 10981void
11065clear_message (bool current_p, bool last_displayed_p) 10982clear_message (bool current_p, bool last_displayed_p)
@@ -11073,7 +10990,7 @@ clear_message (bool current_p, bool last_displayed_p)
11073 if (last_displayed_p) 10990 if (last_displayed_p)
11074 echo_area_buffer[1] = Qnil; 10991 echo_area_buffer[1] = Qnil;
11075 10992
11076 message_buf_print = 0; 10993 message_buf_print = false;
11077} 10994}
11078 10995
11079/* Clear garbaged frames. 10996/* Clear garbaged frames.
@@ -11113,9 +11030,9 @@ clear_garbaged_frames (void)
11113} 11030}
11114 11031
11115 11032
11116/* Redisplay the echo area of the selected frame. If UPDATE_FRAME_P 11033/* Redisplay the echo area of the selected frame. If UPDATE_FRAME_P,
11117 is non-zero update selected_frame. Value is non-zero if the 11034 update selected_frame. Value is true if the mini-windows height
11118 mini-windows height has been changed. */ 11035 has been changed. */
11119 11036
11120static bool 11037static bool
11121echo_area_display (bool update_frame_p) 11038echo_area_display (bool update_frame_p)
@@ -11132,14 +11049,14 @@ echo_area_display (bool update_frame_p)
11132 11049
11133 /* Don't display if frame is invisible or not yet initialized. */ 11050 /* Don't display if frame is invisible or not yet initialized. */
11134 if (!FRAME_VISIBLE_P (f) || !f->glyphs_initialized_p) 11051 if (!FRAME_VISIBLE_P (f) || !f->glyphs_initialized_p)
11135 return 0; 11052 return false;
11136 11053
11137#ifdef HAVE_WINDOW_SYSTEM 11054#ifdef HAVE_WINDOW_SYSTEM
11138 /* When Emacs starts, selected_frame may be the initial terminal 11055 /* When Emacs starts, selected_frame may be the initial terminal
11139 frame. If we let this through, a message would be displayed on 11056 frame. If we let this through, a message would be displayed on
11140 the terminal. */ 11057 the terminal. */
11141 if (FRAME_INITIAL_P (XFRAME (selected_frame))) 11058 if (FRAME_INITIAL_P (XFRAME (selected_frame)))
11142 return 0; 11059 return false;
11143#endif /* HAVE_WINDOW_SYSTEM */ 11060#endif /* HAVE_WINDOW_SYSTEM */
11144 11061
11145 /* Redraw garbaged frames. */ 11062 /* Redraw garbaged frames. */
@@ -11216,21 +11133,21 @@ echo_area_display (bool update_frame_p)
11216 return window_height_changed_p; 11133 return window_height_changed_p;
11217} 11134}
11218 11135
11219/* Nonzero if W's buffer was changed but not saved. */ 11136/* True if W's buffer was changed but not saved. */
11220 11137
11221static int 11138static bool
11222window_buffer_changed (struct window *w) 11139window_buffer_changed (struct window *w)
11223{ 11140{
11224 struct buffer *b = XBUFFER (w->contents); 11141 struct buffer *b = XBUFFER (w->contents);
11225 11142
11226 eassert (BUFFER_LIVE_P (b)); 11143 eassert (BUFFER_LIVE_P (b));
11227 11144
11228 return (((BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) != w->last_had_star)); 11145 return (BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)) != w->last_had_star;
11229} 11146}
11230 11147
11231/* Nonzero if W has %c in its mode line and mode line should be updated. */ 11148/* True if W has %c in its mode line and mode line should be updated. */
11232 11149
11233static int 11150static bool
11234mode_line_update_needed (struct window *w) 11151mode_line_update_needed (struct window *w)
11235{ 11152{
11236 return (w->column_number_displayed != -1 11153 return (w->column_number_displayed != -1
@@ -11238,7 +11155,7 @@ mode_line_update_needed (struct window *w)
11238 && (w->column_number_displayed != current_column ())); 11155 && (w->column_number_displayed != current_column ()));
11239} 11156}
11240 11157
11241/* Nonzero if window start of W is frozen and may not be changed during 11158/* True if window start of W is frozen and may not be changed during
11242 redisplay. */ 11159 redisplay. */
11243 11160
11244static bool 11161static bool
@@ -11250,17 +11167,17 @@ window_frozen_p (struct window *w)
11250 11167
11251 XSETWINDOW (window, w); 11168 XSETWINDOW (window, w);
11252 if (MINI_WINDOW_P (w)) 11169 if (MINI_WINDOW_P (w))
11253 return 0; 11170 return false;
11254 else if (EQ (window, selected_window)) 11171 else if (EQ (window, selected_window))
11255 return 0; 11172 return false;
11256 else if (MINI_WINDOW_P (XWINDOW (selected_window)) 11173 else if (MINI_WINDOW_P (XWINDOW (selected_window))
11257 && EQ (window, Vminibuf_scroll_window)) 11174 && EQ (window, Vminibuf_scroll_window))
11258 /* This special window can't be frozen too. */ 11175 /* This special window can't be frozen too. */
11259 return 0; 11176 return false;
11260 else 11177 else
11261 return 1; 11178 return true;
11262 } 11179 }
11263 return 0; 11180 return false;
11264} 11181}
11265 11182
11266/*********************************************************************** 11183/***********************************************************************
@@ -11308,7 +11225,7 @@ static Lisp_Object
11308format_mode_line_unwind_data (struct frame *target_frame, 11225format_mode_line_unwind_data (struct frame *target_frame,
11309 struct buffer *obuf, 11226 struct buffer *obuf,
11310 Lisp_Object owin, 11227 Lisp_Object owin,
11311 int save_proptrans) 11228 bool save_proptrans)
11312{ 11229{
11313 Lisp_Object vector, tmp; 11230 Lisp_Object vector, tmp;
11314 11231
@@ -11493,7 +11410,7 @@ x_consider_frame_title (Lisp_Object frame)
11493 mode_line_noprop_buf; then display the title. */ 11410 mode_line_noprop_buf; then display the title. */
11494 record_unwind_protect (unwind_format_mode_line, 11411 record_unwind_protect (unwind_format_mode_line,
11495 format_mode_line_unwind_data 11412 format_mode_line_unwind_data
11496 (f, current_buffer, selected_window, 0)); 11413 (f, current_buffer, selected_window, false));
11497 11414
11498 Fselect_window (f->selected_window, Qt); 11415 Fselect_window (f->selected_window, Qt);
11499 set_buffer_internal_1 11416 set_buffer_internal_1
@@ -11504,7 +11421,7 @@ x_consider_frame_title (Lisp_Object frame)
11504 title_start = MODE_LINE_NOPROP_LEN (0); 11421 title_start = MODE_LINE_NOPROP_LEN (0);
11505 init_iterator (&it, XWINDOW (f->selected_window), -1, -1, 11422 init_iterator (&it, XWINDOW (f->selected_window), -1, -1,
11506 NULL, DEFAULT_FACE_ID); 11423 NULL, DEFAULT_FACE_ID);
11507 display_mode_element (&it, 0, -1, -1, fmt, Qnil, 0); 11424 display_mode_element (&it, 0, -1, -1, fmt, Qnil, false);
11508 len = MODE_LINE_NOPROP_LEN (title_start); 11425 len = MODE_LINE_NOPROP_LEN (title_start);
11509 title = mode_line_noprop_buf + title_start; 11426 title = mode_line_noprop_buf + title_start;
11510 unbind_to (count, Qnil); 11427 unbind_to (count, Qnil);
@@ -11528,7 +11445,7 @@ x_consider_frame_title (Lisp_Object frame)
11528 Menu Bars 11445 Menu Bars
11529 ***********************************************************************/ 11446 ***********************************************************************/
11530 11447
11531/* Non-zero if we will not redisplay all visible windows. */ 11448/* True if we will not redisplay all visible windows. */
11532#define REDISPLAY_SOME_P() \ 11449#define REDISPLAY_SOME_P() \
11533 ((windows_or_buffers_changed == 0 \ 11450 ((windows_or_buffers_changed == 0 \
11534 || windows_or_buffers_changed == REDISPLAY_SOME) \ 11451 || windows_or_buffers_changed == REDISPLAY_SOME) \
@@ -11616,9 +11533,9 @@ prepare_menu_bars (void)
11616 { 11533 {
11617 Lisp_Object tail, frame; 11534 Lisp_Object tail, frame;
11618 ptrdiff_t count = SPECPDL_INDEX (); 11535 ptrdiff_t count = SPECPDL_INDEX ();
11619 /* 1 means that update_menu_bar has run its hooks 11536 /* True means that update_menu_bar has run its hooks
11620 so any further calls to update_menu_bar shouldn't do so again. */ 11537 so any further calls to update_menu_bar shouldn't do so again. */
11621 int menu_bar_hooks_run = 0; 11538 bool menu_bar_hooks_run = false;
11622 11539
11623 record_unwind_save_match_data (); 11540 record_unwind_save_match_data ();
11624 11541
@@ -11644,7 +11561,7 @@ prepare_menu_bars (void)
11644 Lisp_Object functions; 11561 Lisp_Object functions;
11645 11562
11646 /* Clear flag first in case we get an error below. */ 11563 /* Clear flag first in case we get an error below. */
11647 FRAME_WINDOW_SIZES_CHANGED (f) = 0; 11564 FRAME_WINDOW_SIZES_CHANGED (f) = false;
11648 functions = Vwindow_size_change_functions; 11565 functions = Vwindow_size_change_functions;
11649 GCPRO2 (tail, functions); 11566 GCPRO2 (tail, functions);
11650 11567
@@ -11658,9 +11575,9 @@ prepare_menu_bars (void)
11658 } 11575 }
11659 11576
11660 GCPRO1 (tail); 11577 GCPRO1 (tail);
11661 menu_bar_hooks_run = update_menu_bar (f, 0, menu_bar_hooks_run); 11578 menu_bar_hooks_run = update_menu_bar (f, false, menu_bar_hooks_run);
11662#ifdef HAVE_WINDOW_SYSTEM 11579#ifdef HAVE_WINDOW_SYSTEM
11663 update_tool_bar (f, 0); 11580 update_tool_bar (f, false);
11664#endif 11581#endif
11665 UNGCPRO; 11582 UNGCPRO;
11666 } 11583 }
@@ -11670,9 +11587,9 @@ prepare_menu_bars (void)
11670 else 11587 else
11671 { 11588 {
11672 struct frame *sf = SELECTED_FRAME (); 11589 struct frame *sf = SELECTED_FRAME ();
11673 update_menu_bar (sf, 1, 0); 11590 update_menu_bar (sf, true, false);
11674#ifdef HAVE_WINDOW_SYSTEM 11591#ifdef HAVE_WINDOW_SYSTEM
11675 update_tool_bar (sf, 1); 11592 update_tool_bar (sf, true);
11676#endif 11593#endif
11677 } 11594 }
11678} 11595}
@@ -11682,18 +11599,18 @@ prepare_menu_bars (void)
11682 before we start to fill in any display lines, because it can call 11599 before we start to fill in any display lines, because it can call
11683 eval. 11600 eval.
11684 11601
11685 If SAVE_MATCH_DATA is non-zero, we must save and restore it here. 11602 If SAVE_MATCH_DATA, we must save and restore it here.
11686 11603
11687 If HOOKS_RUN is 1, that means a previous call to update_menu_bar 11604 If HOOKS_RUN, a previous call to update_menu_bar
11688 already ran the menu bar hooks for this redisplay, so there 11605 already ran the menu bar hooks for this redisplay, so there
11689 is no need to run them again. The return value is the 11606 is no need to run them again. The return value is the
11690 updated value of this flag, to pass to the next call. */ 11607 updated value of this flag, to pass to the next call. */
11691 11608
11692static int 11609static bool
11693update_menu_bar (struct frame *f, int save_match_data, int hooks_run) 11610update_menu_bar (struct frame *f, bool save_match_data, bool hooks_run)
11694{ 11611{
11695 Lisp_Object window; 11612 Lisp_Object window;
11696 register struct window *w; 11613 struct window *w;
11697 11614
11698 /* If called recursively during a menu update, do nothing. This can 11615 /* If called recursively during a menu update, do nothing. This can
11699 happen when, for instance, an activate-menubar-hook causes a 11616 happen when, for instance, an activate-menubar-hook causes a
@@ -11753,7 +11670,7 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
11753 11670
11754 safe_run_hooks (Qmenu_bar_update_hook); 11671 safe_run_hooks (Qmenu_bar_update_hook);
11755 11672
11756 hooks_run = 1; 11673 hooks_run = true;
11757 } 11674 }
11758 11675
11759 XSETFRAME (Vmenu_updating_frame, f); 11676 XSETFRAME (Vmenu_updating_frame, f);
@@ -11769,16 +11686,16 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
11769 the selected frame should be allowed to set it. */ 11686 the selected frame should be allowed to set it. */
11770 if (f == SELECTED_FRAME ()) 11687 if (f == SELECTED_FRAME ())
11771#endif 11688#endif
11772 set_frame_menubar (f, 0, 0); 11689 set_frame_menubar (f, false, false);
11773 } 11690 }
11774 else 11691 else
11775 /* On a terminal screen, the menu bar is an ordinary screen 11692 /* On a terminal screen, the menu bar is an ordinary screen
11776 line, and this makes it get updated. */ 11693 line, and this makes it get updated. */
11777 w->update_mode_line = 1; 11694 w->update_mode_line = true;
11778#else /* ! (USE_X_TOOLKIT || HAVE_NTGUI || HAVE_NS || USE_GTK) */ 11695#else /* ! (USE_X_TOOLKIT || HAVE_NTGUI || HAVE_NS || USE_GTK) */
11779 /* In the non-toolkit version, the menu bar is an ordinary screen 11696 /* In the non-toolkit version, the menu bar is an ordinary screen
11780 line, and this makes it get updated. */ 11697 line, and this makes it get updated. */
11781 w->update_mode_line = 1; 11698 w->update_mode_line = true;
11782#endif /* ! (USE_X_TOOLKIT || HAVE_NTGUI || HAVE_NS || USE_GTK) */ 11699#endif /* ! (USE_X_TOOLKIT || HAVE_NTGUI || HAVE_NS || USE_GTK) */
11783 11700
11784 unbind_to (count, Qnil); 11701 unbind_to (count, Qnil);
@@ -11811,17 +11728,17 @@ fast_set_selected_frame (Lisp_Object frame)
11811 11728
11812/* Update the tool-bar item list for frame F. This has to be done 11729/* Update the tool-bar item list for frame F. This has to be done
11813 before we start to fill in any display lines. Called from 11730 before we start to fill in any display lines. Called from
11814 prepare_menu_bars. If SAVE_MATCH_DATA is non-zero, we must save 11731 prepare_menu_bars. If SAVE_MATCH_DATA, we must save
11815 and restore it here. */ 11732 and restore it here. */
11816 11733
11817static void 11734static void
11818update_tool_bar (struct frame *f, int save_match_data) 11735update_tool_bar (struct frame *f, bool save_match_data)
11819{ 11736{
11820#if defined (USE_GTK) || defined (HAVE_NS) 11737#if defined (USE_GTK) || defined (HAVE_NS)
11821 int do_update = FRAME_EXTERNAL_TOOL_BAR (f); 11738 bool do_update = FRAME_EXTERNAL_TOOL_BAR (f);
11822#else 11739#else
11823 int do_update = (WINDOWP (f->tool_bar_window) 11740 bool do_update = (WINDOWP (f->tool_bar_window)
11824 && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0); 11741 && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0);
11825#endif 11742#endif
11826 11743
11827 if (do_update) 11744 if (do_update)
@@ -11895,7 +11812,7 @@ update_tool_bar (struct frame *f, int save_match_data)
11895 block_input (); 11812 block_input ();
11896 fset_tool_bar_items (f, new_tool_bar); 11813 fset_tool_bar_items (f, new_tool_bar);
11897 f->n_tool_bar_items = new_n_tool_bar; 11814 f->n_tool_bar_items = new_n_tool_bar;
11898 w->update_mode_line = 1; 11815 w->update_mode_line = true;
11899 unblock_input (); 11816 unblock_input ();
11900 } 11817 }
11901 11818
@@ -11956,8 +11873,8 @@ build_desired_tool_bar_string (struct frame *f)
11956#define PROP(IDX) \ 11873#define PROP(IDX) \
11957 AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX)) 11874 AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX))
11958 11875
11959 int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); 11876 bool enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P));
11960 int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); 11877 bool selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
11961 int hmargin, vmargin, relief, idx, end; 11878 int hmargin, vmargin, relief, idx, end;
11962 11879
11963 /* If image is a vector, choose the image according to the 11880 /* If image is a vector, choose the image according to the
@@ -12104,7 +12021,7 @@ display_tool_bar_line (struct it *it, int height)
12104 12021
12105 /* Note that this isn't made use of if the face hasn't a box, 12022 /* Note that this isn't made use of if the face hasn't a box,
12106 so there's no need to check the face here. */ 12023 so there's no need to check the face here. */
12107 it->start_of_box_run_p = 1; 12024 it->start_of_box_run_p = true;
12108 12025
12109 while (it->current_x < max_x) 12026 while (it->current_x < max_x)
12110 { 12027 {
@@ -12156,7 +12073,7 @@ display_tool_bar_line (struct it *it, int height)
12156 if (ITERATOR_AT_END_OF_LINE_P (it)) 12073 if (ITERATOR_AT_END_OF_LINE_P (it))
12157 break; 12074 break;
12158 12075
12159 set_iterator_to_next (it, 1); 12076 set_iterator_to_next (it, true);
12160 } 12077 }
12161 12078
12162 out:; 12079 out:;
@@ -12175,9 +12092,9 @@ display_tool_bar_line (struct it *it, int height)
12175 12092
12176 extend_face_to_end_of_line (it); 12093 extend_face_to_end_of_line (it);
12177 last = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1; 12094 last = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1;
12178 last->right_box_line_p = 1; 12095 last->right_box_line_p = true;
12179 if (last == row->glyphs[TEXT_AREA]) 12096 if (last == row->glyphs[TEXT_AREA])
12180 last->left_box_line_p = 1; 12097 last->left_box_line_p = true;
12181 12098
12182 /* Make line the desired height and center it vertically. */ 12099 /* Make line the desired height and center it vertically. */
12183 if ((height -= it->max_ascent + it->max_descent) > 0) 12100 if ((height -= it->max_ascent + it->max_descent) > 0)
@@ -12199,10 +12116,10 @@ display_tool_bar_line (struct it *it, int height)
12199 row->extra_line_spacing = 0; 12116 row->extra_line_spacing = 0;
12200 } 12117 }
12201 12118
12202 row->full_width_p = 1; 12119 row->full_width_p = true;
12203 row->continued_p = 0; 12120 row->continued_p = false;
12204 row->truncated_on_left_p = 0; 12121 row->truncated_on_left_p = false;
12205 row->truncated_on_right_p = 0; 12122 row->truncated_on_right_p = false;
12206 12123
12207 it->current_x = it->hpos = 0; 12124 it->current_x = it->hpos = 0;
12208 it->current_y += row->height; 12125 it->current_y += row->height;
@@ -12268,11 +12185,11 @@ PIXELWISE non-nil means return the height of the tool bar in pixels. */)
12268 if (WINDOWP (f->tool_bar_window) 12185 if (WINDOWP (f->tool_bar_window)
12269 && WINDOW_PIXEL_HEIGHT (XWINDOW (f->tool_bar_window)) > 0) 12186 && WINDOW_PIXEL_HEIGHT (XWINDOW (f->tool_bar_window)) > 0)
12270 { 12187 {
12271 update_tool_bar (f, 1); 12188 update_tool_bar (f, true);
12272 if (f->n_tool_bar_items) 12189 if (f->n_tool_bar_items)
12273 { 12190 {
12274 build_desired_tool_bar_string (f); 12191 build_desired_tool_bar_string (f);
12275 height = tool_bar_height (f, NULL, NILP (pixelwise) ? 0 : 1); 12192 height = tool_bar_height (f, NULL, !NILP (pixelwise));
12276 } 12193 }
12277 } 12194 }
12278#endif 12195#endif
@@ -12281,16 +12198,16 @@ PIXELWISE non-nil means return the height of the tool bar in pixels. */)
12281} 12198}
12282 12199
12283 12200
12284/* Display the tool-bar of frame F. Value is non-zero if tool-bar's 12201/* Display the tool-bar of frame F. Value is true if tool-bar's
12285 height should be changed. */ 12202 height should be changed. */
12286static int 12203static bool
12287redisplay_tool_bar (struct frame *f) 12204redisplay_tool_bar (struct frame *f)
12288{ 12205{
12289#if defined (USE_GTK) || defined (HAVE_NS) 12206#if defined (USE_GTK) || defined (HAVE_NS)
12290 12207
12291 if (FRAME_EXTERNAL_TOOL_BAR (f)) 12208 if (FRAME_EXTERNAL_TOOL_BAR (f))
12292 update_frame_tool_bar (f); 12209 update_frame_tool_bar (f);
12293 return 0; 12210 return false;
12294 12211
12295#else /* !USE_GTK && !HAVE_NS */ 12212#else /* !USE_GTK && !HAVE_NS */
12296 12213
@@ -12305,7 +12222,7 @@ redisplay_tool_bar (struct frame *f)
12305 if (!WINDOWP (f->tool_bar_window) 12222 if (!WINDOWP (f->tool_bar_window)
12306 || (w = XWINDOW (f->tool_bar_window), 12223 || (w = XWINDOW (f->tool_bar_window),
12307 WINDOW_TOTAL_LINES (w) == 0)) 12224 WINDOW_TOTAL_LINES (w) == 0))
12308 return 0; 12225 return false;
12309 12226
12310 /* Set up an iterator for the tool-bar window. */ 12227 /* Set up an iterator for the tool-bar window. */
12311 init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID); 12228 init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID);
@@ -12328,7 +12245,7 @@ redisplay_tool_bar (struct frame *f)
12328 12245
12329 if (f->n_tool_bar_rows == 0) 12246 if (f->n_tool_bar_rows == 0)
12330 { 12247 {
12331 int new_height = tool_bar_height (f, &f->n_tool_bar_rows, 1); 12248 int new_height = tool_bar_height (f, &f->n_tool_bar_rows, true);
12332 12249
12333 if (new_height != WINDOW_PIXEL_HEIGHT (w)) 12250 if (new_height != WINDOW_PIXEL_HEIGHT (w))
12334 { 12251 {
@@ -12336,8 +12253,8 @@ redisplay_tool_bar (struct frame *f)
12336 frame_default_tool_bar_height = new_height; 12253 frame_default_tool_bar_height = new_height;
12337 /* Always do that now. */ 12254 /* Always do that now. */
12338 clear_glyph_matrix (w->desired_matrix); 12255 clear_glyph_matrix (w->desired_matrix);
12339 f->fonts_changed = 1; 12256 f->fonts_changed = true;
12340 return 1; 12257 return true;
12341 } 12258 }
12342 } 12259 }
12343 12260
@@ -12381,17 +12298,17 @@ redisplay_tool_bar (struct frame *f)
12381 12298
12382 /* It doesn't make much sense to try scrolling in the tool-bar 12299 /* It doesn't make much sense to try scrolling in the tool-bar
12383 window, so don't do it. */ 12300 window, so don't do it. */
12384 w->desired_matrix->no_scrolling_p = 1; 12301 w->desired_matrix->no_scrolling_p = true;
12385 w->must_be_updated_p = 1; 12302 w->must_be_updated_p = true;
12386 12303
12387 if (!NILP (Vauto_resize_tool_bars)) 12304 if (!NILP (Vauto_resize_tool_bars))
12388 { 12305 {
12389 int change_height_p = 0; 12306 bool change_height_p = true;
12390 12307
12391 /* If we couldn't display everything, change the tool-bar's 12308 /* If we couldn't display everything, change the tool-bar's
12392 height if there is room for more. */ 12309 height if there is room for more. */
12393 if (IT_STRING_CHARPOS (it) < it.end_charpos) 12310 if (IT_STRING_CHARPOS (it) < it.end_charpos)
12394 change_height_p = 1; 12311 change_height_p = true;
12395 12312
12396 /* We subtract 1 because display_tool_bar_line advances the 12313 /* We subtract 1 because display_tool_bar_line advances the
12397 glyph_row pointer before returning to its caller. We want to 12314 glyph_row pointer before returning to its caller. We want to
@@ -12404,26 +12321,26 @@ redisplay_tool_bar (struct frame *f)
12404 FRAME_LINE_HEIGHT, change the tool-bar's height. */ 12321 FRAME_LINE_HEIGHT, change the tool-bar's height. */
12405 if (!MATRIX_ROW_DISPLAYS_TEXT_P (row) 12322 if (!MATRIX_ROW_DISPLAYS_TEXT_P (row)
12406 && row->height >= FRAME_LINE_HEIGHT (f)) 12323 && row->height >= FRAME_LINE_HEIGHT (f))
12407 change_height_p = 1; 12324 change_height_p = true;
12408 12325
12409 /* If row displays tool-bar items, but is partially visible, 12326 /* If row displays tool-bar items, but is partially visible,
12410 change the tool-bar's height. */ 12327 change the tool-bar's height. */
12411 if (MATRIX_ROW_DISPLAYS_TEXT_P (row) 12328 if (MATRIX_ROW_DISPLAYS_TEXT_P (row)
12412 && MATRIX_ROW_BOTTOM_Y (row) > it.last_visible_y) 12329 && MATRIX_ROW_BOTTOM_Y (row) > it.last_visible_y)
12413 change_height_p = 1; 12330 change_height_p = true;
12414 12331
12415 /* Resize windows as needed by changing the `tool-bar-lines' 12332 /* Resize windows as needed by changing the `tool-bar-lines'
12416 frame parameter. */ 12333 frame parameter. */
12417 if (change_height_p) 12334 if (change_height_p)
12418 { 12335 {
12419 int nrows; 12336 int nrows;
12420 int new_height = tool_bar_height (f, &nrows, 1); 12337 int new_height = tool_bar_height (f, &nrows, true);
12421 12338
12422 change_height_p = ((EQ (Vauto_resize_tool_bars, Qgrow_only) 12339 change_height_p = ((EQ (Vauto_resize_tool_bars, Qgrow_only)
12423 && !f->minimize_tool_bar_window_p) 12340 && !f->minimize_tool_bar_window_p)
12424 ? (new_height > WINDOW_PIXEL_HEIGHT (w)) 12341 ? (new_height > WINDOW_PIXEL_HEIGHT (w))
12425 : (new_height != WINDOW_PIXEL_HEIGHT (w))); 12342 : (new_height != WINDOW_PIXEL_HEIGHT (w)));
12426 f->minimize_tool_bar_window_p = 0; 12343 f->minimize_tool_bar_window_p = false;
12427 12344
12428 if (change_height_p) 12345 if (change_height_p)
12429 { 12346 {
@@ -12431,15 +12348,15 @@ redisplay_tool_bar (struct frame *f)
12431 frame_default_tool_bar_height = new_height; 12348 frame_default_tool_bar_height = new_height;
12432 clear_glyph_matrix (w->desired_matrix); 12349 clear_glyph_matrix (w->desired_matrix);
12433 f->n_tool_bar_rows = nrows; 12350 f->n_tool_bar_rows = nrows;
12434 f->fonts_changed = 1; 12351 f->fonts_changed = true;
12435 12352
12436 return 1; 12353 return true;
12437 } 12354 }
12438 } 12355 }
12439 } 12356 }
12440 12357
12441 f->minimize_tool_bar_window_p = 0; 12358 f->minimize_tool_bar_window_p = false;
12442 return 0; 12359 return false;
12443 12360
12444#endif /* USE_GTK || HAVE_NS */ 12361#endif /* USE_GTK || HAVE_NS */
12445} 12362}
@@ -12448,14 +12365,13 @@ redisplay_tool_bar (struct frame *f)
12448 12365
12449/* Get information about the tool-bar item which is displayed in GLYPH 12366/* Get information about the tool-bar item which is displayed in GLYPH
12450 on frame F. Return in *PROP_IDX the index where tool-bar item 12367 on frame F. Return in *PROP_IDX the index where tool-bar item
12451 properties start in F->tool_bar_items. Value is zero if 12368 properties start in F->tool_bar_items. Value is false if
12452 GLYPH doesn't display a tool-bar item. */ 12369 GLYPH doesn't display a tool-bar item. */
12453 12370
12454static int 12371static bool
12455tool_bar_item_info (struct frame *f, struct glyph *glyph, int *prop_idx) 12372tool_bar_item_info (struct frame *f, struct glyph *glyph, int *prop_idx)
12456{ 12373{
12457 Lisp_Object prop; 12374 Lisp_Object prop;
12458 int success_p;
12459 int charpos; 12375 int charpos;
12460 12376
12461 /* This function can be called asynchronously, which means we must 12377 /* This function can be called asynchronously, which means we must
@@ -12469,15 +12385,10 @@ tool_bar_item_info (struct frame *f, struct glyph *glyph, int *prop_idx)
12469 F->tool_bar_items. */ 12385 F->tool_bar_items. */
12470 prop = Fget_text_property (make_number (charpos), 12386 prop = Fget_text_property (make_number (charpos),
12471 Qmenu_item, f->current_tool_bar_string); 12387 Qmenu_item, f->current_tool_bar_string);
12472 if (INTEGERP (prop)) 12388 if (! INTEGERP (prop))
12473 { 12389 return false;
12474 *prop_idx = XINT (prop); 12390 *prop_idx = XINT (prop);
12475 success_p = 1; 12391 return true;
12476 }
12477 else
12478 success_p = 0;
12479
12480 return success_p;
12481} 12392}
12482 12393
12483 12394
@@ -12526,12 +12437,12 @@ get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph,
12526 12437
12527/* EXPORT: 12438/* EXPORT:
12528 Handle mouse button event on the tool-bar of frame F, at 12439 Handle mouse button event on the tool-bar of frame F, at
12529 frame-relative coordinates X/Y. DOWN_P is 1 for a button press, 12440 frame-relative coordinates X/Y. DOWN_P is true for a button press,
12530 0 for button release. MODIFIERS is event modifiers for button 12441 false for button release. MODIFIERS is event modifiers for button
12531 release. */ 12442 release. */
12532 12443
12533void 12444void
12534handle_tool_bar_click (struct frame *f, int x, int y, int down_p, 12445handle_tool_bar_click (struct frame *f, int x, int y, bool down_p,
12535 int modifiers) 12446 int modifiers)
12536{ 12447{
12537 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 12448 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
@@ -12618,7 +12529,8 @@ note_tool_bar_highlight (struct frame *f, int x, int y)
12618 Lisp_Object enabled_p; 12529 Lisp_Object enabled_p;
12619 int prop_idx; 12530 int prop_idx;
12620 enum draw_glyphs_face draw = DRAW_IMAGE_RAISED; 12531 enum draw_glyphs_face draw = DRAW_IMAGE_RAISED;
12621 int mouse_down_p, rc; 12532 bool mouse_down_p;
12533 int rc;
12622 12534
12623 /* Function note_mouse_highlight is called with negative X/Y 12535 /* Function note_mouse_highlight is called with negative X/Y
12624 values when mouse moves outside of the frame. */ 12536 values when mouse moves outside of the frame. */
@@ -12664,7 +12576,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y)
12664 hlinfo->mouse_face_beg_col = hpos; 12576 hlinfo->mouse_face_beg_col = hpos;
12665 hlinfo->mouse_face_beg_row = vpos; 12577 hlinfo->mouse_face_beg_row = vpos;
12666 hlinfo->mouse_face_beg_x = x; 12578 hlinfo->mouse_face_beg_x = x;
12667 hlinfo->mouse_face_past_end = 0; 12579 hlinfo->mouse_face_past_end = false;
12668 12580
12669 hlinfo->mouse_face_end_col = hpos + 1; 12581 hlinfo->mouse_face_end_col = hpos + 1;
12670 hlinfo->mouse_face_end_row = vpos; 12582 hlinfo->mouse_face_end_row = vpos;
@@ -12697,20 +12609,17 @@ note_tool_bar_highlight (struct frame *f, int x, int y)
12697 Horizontal scrolling 12609 Horizontal scrolling
12698 ************************************************************************/ 12610 ************************************************************************/
12699 12611
12700static int hscroll_window_tree (Lisp_Object);
12701static int hscroll_windows (Lisp_Object);
12702
12703/* For all leaf windows in the window tree rooted at WINDOW, set their 12612/* For all leaf windows in the window tree rooted at WINDOW, set their
12704 hscroll value so that PT is (i) visible in the window, and (ii) so 12613 hscroll value so that PT is (i) visible in the window, and (ii) so
12705 that it is not within a certain margin at the window's left and 12614 that it is not within a certain margin at the window's left and
12706 right border. Value is non-zero if any window's hscroll has been 12615 right border. Value is true if any window's hscroll has been
12707 changed. */ 12616 changed. */
12708 12617
12709static int 12618static bool
12710hscroll_window_tree (Lisp_Object window) 12619hscroll_window_tree (Lisp_Object window)
12711{ 12620{
12712 int hscrolled_p = 0; 12621 bool hscrolled_p = false;
12713 int hscroll_relative_p = FLOATP (Vhscroll_step); 12622 bool hscroll_relative_p = FLOATP (Vhscroll_step);
12714 int hscroll_step_abs = 0; 12623 int hscroll_step_abs = 0;
12715 double hscroll_step_rel = 0; 12624 double hscroll_step_rel = 0;
12716 12625
@@ -12719,7 +12628,7 @@ hscroll_window_tree (Lisp_Object window)
12719 hscroll_step_rel = XFLOAT_DATA (Vhscroll_step); 12628 hscroll_step_rel = XFLOAT_DATA (Vhscroll_step);
12720 if (hscroll_step_rel < 0) 12629 if (hscroll_step_rel < 0)
12721 { 12630 {
12722 hscroll_relative_p = 0; 12631 hscroll_relative_p = false;
12723 hscroll_step_abs = 0; 12632 hscroll_step_abs = 0;
12724 } 12633 }
12725 } 12634 }
@@ -12744,7 +12653,6 @@ hscroll_window_tree (Lisp_Object window)
12744 int text_area_width; 12653 int text_area_width;
12745 struct glyph_row *cursor_row; 12654 struct glyph_row *cursor_row;
12746 struct glyph_row *bottom_row; 12655 struct glyph_row *bottom_row;
12747 int row_r2l_p;
12748 12656
12749 bottom_row = MATRIX_BOTTOM_TEXT_ROW (w->desired_matrix, w); 12657 bottom_row = MATRIX_BOTTOM_TEXT_ROW (w->desired_matrix, w);
12750 if (w->cursor.vpos < bottom_row - w->desired_matrix->rows) 12658 if (w->cursor.vpos < bottom_row - w->desired_matrix->rows)
@@ -12760,7 +12668,7 @@ hscroll_window_tree (Lisp_Object window)
12760 else 12668 else
12761 cursor_row = bottom_row - 1; 12669 cursor_row = bottom_row - 1;
12762 } 12670 }
12763 row_r2l_p = cursor_row->reversed_p; 12671 bool row_r2l_p = cursor_row->reversed_p;
12764 12672
12765 text_area_width = window_box_width (w, TEXT_AREA); 12673 text_area_width = window_box_width (w, TEXT_AREA);
12766 12674
@@ -12770,7 +12678,7 @@ hscroll_window_tree (Lisp_Object window)
12770 /* If the position of this window's point has explicitly 12678 /* If the position of this window's point has explicitly
12771 changed, no more suspend auto hscrolling. */ 12679 changed, no more suspend auto hscrolling. */
12772 if (NILP (Fequal (Fwindow_point (window), Fwindow_old_point (window)))) 12680 if (NILP (Fequal (Fwindow_point (window), Fwindow_old_point (window))))
12773 w->suspend_auto_hscroll = 0; 12681 w->suspend_auto_hscroll = false;
12774 12682
12775 /* Remember window point. */ 12683 /* Remember window point. */
12776 Fset_marker (w->old_pointm, 12684 Fset_marker (w->old_pointm,
@@ -12780,7 +12688,7 @@ hscroll_window_tree (Lisp_Object window)
12780 w->contents); 12688 w->contents);
12781 12689
12782 if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, w->contents)) 12690 if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, w->contents))
12783 && w->suspend_auto_hscroll == 0 12691 && !w->suspend_auto_hscroll
12784 /* In some pathological cases, like restoring a window 12692 /* In some pathological cases, like restoring a window
12785 configuration into a frame that is much smaller than 12693 configuration into a frame that is much smaller than
12786 the one from which the configuration was saved, we 12694 the one from which the configuration was saved, we
@@ -12874,9 +12782,10 @@ hscroll_window_tree (Lisp_Object window)
12874 redisplay. */ 12782 redisplay. */
12875 if (w->hscroll != hscroll) 12783 if (w->hscroll != hscroll)
12876 { 12784 {
12877 XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; 12785 struct buffer *b = XBUFFER (w->contents);
12786 b->prevent_redisplay_optimizations_p = true;
12878 w->hscroll = hscroll; 12787 w->hscroll = hscroll;
12879 hscrolled_p = 1; 12788 hscrolled_p = true;
12880 } 12789 }
12881 } 12790 }
12882 } 12791 }
@@ -12884,21 +12793,21 @@ hscroll_window_tree (Lisp_Object window)
12884 window = w->next; 12793 window = w->next;
12885 } 12794 }
12886 12795
12887 /* Value is non-zero if hscroll of any leaf window has been changed. */ 12796 /* Value is true if hscroll of any leaf window has been changed. */
12888 return hscrolled_p; 12797 return hscrolled_p;
12889} 12798}
12890 12799
12891 12800
12892/* Set hscroll so that cursor is visible and not inside horizontal 12801/* Set hscroll so that cursor is visible and not inside horizontal
12893 scroll margins for all windows in the tree rooted at WINDOW. See 12802 scroll margins for all windows in the tree rooted at WINDOW. See
12894 also hscroll_window_tree above. Value is non-zero if any window's 12803 also hscroll_window_tree above. Value is true if any window's
12895 hscroll has been changed. If it has, desired matrices on the frame 12804 hscroll has been changed. If it has, desired matrices on the frame
12896 of WINDOW are cleared. */ 12805 of WINDOW are cleared. */
12897 12806
12898static int 12807static bool
12899hscroll_windows (Lisp_Object window) 12808hscroll_windows (Lisp_Object window)
12900{ 12809{
12901 int hscrolled_p = hscroll_window_tree (window); 12810 bool hscrolled_p = hscroll_window_tree (window);
12902 if (hscrolled_p) 12811 if (hscrolled_p)
12903 clear_desired_matrices (XFRAME (WINDOW_FRAME (XWINDOW (window)))); 12812 clear_desired_matrices (XFRAME (WINDOW_FRAME (XWINDOW (window))));
12904 return hscrolled_p; 12813 return hscrolled_p;
@@ -12910,9 +12819,8 @@ hscroll_windows (Lisp_Object window)
12910 Redisplay 12819 Redisplay
12911 ************************************************************************/ 12820 ************************************************************************/
12912 12821
12913/* Variables holding some state of redisplay if GLYPH_DEBUG is defined 12822/* Variables holding some state of redisplay if GLYPH_DEBUG is defined.
12914 to a non-zero value. This is sometimes handy to have in a debugger 12823 This is sometimes handy to have in a debugger session. */
12915 session. */
12916 12824
12917#ifdef GLYPH_DEBUG 12825#ifdef GLYPH_DEBUG
12918 12826
@@ -12974,29 +12882,29 @@ debug_method_add (struct window *w, char const *fmt, ...)
12974#endif /* GLYPH_DEBUG */ 12882#endif /* GLYPH_DEBUG */
12975 12883
12976 12884
12977/* Value is non-zero if all changes in window W, which displays 12885/* Value is true if all changes in window W, which displays
12978 current_buffer, are in the text between START and END. START is a 12886 current_buffer, are in the text between START and END. START is a
12979 buffer position, END is given as a distance from Z. Used in 12887 buffer position, END is given as a distance from Z. Used in
12980 redisplay_internal for display optimization. */ 12888 redisplay_internal for display optimization. */
12981 12889
12982static int 12890static bool
12983text_outside_line_unchanged_p (struct window *w, 12891text_outside_line_unchanged_p (struct window *w,
12984 ptrdiff_t start, ptrdiff_t end) 12892 ptrdiff_t start, ptrdiff_t end)
12985{ 12893{
12986 int unchanged_p = 1; 12894 bool unchanged_p = true;
12987 12895
12988 /* If text or overlays have changed, see where. */ 12896 /* If text or overlays have changed, see where. */
12989 if (window_outdated (w)) 12897 if (window_outdated (w))
12990 { 12898 {
12991 /* Gap in the line? */ 12899 /* Gap in the line? */
12992 if (GPT < start || Z - GPT < end) 12900 if (GPT < start || Z - GPT < end)
12993 unchanged_p = 0; 12901 unchanged_p = false;
12994 12902
12995 /* Changes start in front of the line, or end after it? */ 12903 /* Changes start in front of the line, or end after it? */
12996 if (unchanged_p 12904 if (unchanged_p
12997 && (BEG_UNCHANGED < start - 1 12905 && (BEG_UNCHANGED < start - 1
12998 || END_UNCHANGED < end)) 12906 || END_UNCHANGED < end))
12999 unchanged_p = 0; 12907 unchanged_p = false;
13000 12908
13001 /* If selective display, can't optimize if changes start at the 12909 /* If selective display, can't optimize if changes start at the
13002 beginning of the line. */ 12910 beginning of the line. */
@@ -13004,7 +12912,7 @@ text_outside_line_unchanged_p (struct window *w,
13004 && INTEGERP (BVAR (current_buffer, selective_display)) 12912 && INTEGERP (BVAR (current_buffer, selective_display))
13005 && XINT (BVAR (current_buffer, selective_display)) > 0 12913 && XINT (BVAR (current_buffer, selective_display)) > 0
13006 && (BEG_UNCHANGED < start || GPT <= start)) 12914 && (BEG_UNCHANGED < start || GPT <= start))
13007 unchanged_p = 0; 12915 unchanged_p = false;
13008 12916
13009 /* If there are overlays at the start or end of the line, these 12917 /* If there are overlays at the start or end of the line, these
13010 may have overlay strings with newlines in them. A change at 12918 may have overlay strings with newlines in them. A change at
@@ -13017,10 +12925,10 @@ text_outside_line_unchanged_p (struct window *w,
13017 { 12925 {
13018 if (BEG + BEG_UNCHANGED == start 12926 if (BEG + BEG_UNCHANGED == start
13019 && overlay_touches_p (start)) 12927 && overlay_touches_p (start))
13020 unchanged_p = 0; 12928 unchanged_p = false;
13021 if (END_UNCHANGED == end 12929 if (END_UNCHANGED == end
13022 && overlay_touches_p (Z - end)) 12930 && overlay_touches_p (Z - end))
13023 unchanged_p = 0; 12931 unchanged_p = false;
13024 } 12932 }
13025 12933
13026 /* Under bidi reordering, adding or deleting a character in the 12934 /* Under bidi reordering, adding or deleting a character in the
@@ -13032,7 +12940,7 @@ text_outside_line_unchanged_p (struct window *w,
13032 lines to that, but for now just give up this optimization. */ 12940 lines to that, but for now just give up this optimization. */
13033 if (!NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering)) 12941 if (!NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering))
13034 && NILP (BVAR (XBUFFER (w->contents), bidi_paragraph_direction))) 12942 && NILP (BVAR (XBUFFER (w->contents), bidi_paragraph_direction)))
13035 unchanged_p = 0; 12943 unchanged_p = false;
13036 } 12944 }
13037 12945
13038 return unchanged_p; 12946 return unchanged_p;
@@ -13064,8 +12972,8 @@ overlay_arrow_string_or_property (Lisp_Object var)
13064 return Voverlay_arrow_string; 12972 return Voverlay_arrow_string;
13065} 12973}
13066 12974
13067/* Return 1 if there are any overlay-arrows in current_buffer. */ 12975/* Return true if there are any overlay-arrows in current_buffer. */
13068static int 12976static bool
13069overlay_arrow_in_current_buffer_p (void) 12977overlay_arrow_in_current_buffer_p (void)
13070{ 12978{
13071 Lisp_Object vlist; 12979 Lisp_Object vlist;
@@ -13082,16 +12990,16 @@ overlay_arrow_in_current_buffer_p (void)
13082 val = find_symbol_value (var); 12990 val = find_symbol_value (var);
13083 if (MARKERP (val) 12991 if (MARKERP (val)
13084 && current_buffer == XMARKER (val)->buffer) 12992 && current_buffer == XMARKER (val)->buffer)
13085 return 1; 12993 return true;
13086 } 12994 }
13087 return 0; 12995 return false;
13088} 12996}
13089 12997
13090 12998
13091/* Return 1 if any overlay_arrows have moved or overlay-arrow-string 12999/* Return true if any overlay_arrows have moved or overlay-arrow-string
13092 has changed. */ 13000 has changed. */
13093 13001
13094static int 13002static bool
13095overlay_arrows_changed_p (void) 13003overlay_arrows_changed_p (void)
13096{ 13004{
13097 Lisp_Object vlist; 13005 Lisp_Object vlist;
@@ -13112,9 +13020,9 @@ overlay_arrows_changed_p (void)
13112 Fget (var, Qlast_arrow_position)) 13020 Fget (var, Qlast_arrow_position))
13113 || ! (pstr = overlay_arrow_string_or_property (var), 13021 || ! (pstr = overlay_arrow_string_or_property (var),
13114 EQ (pstr, Fget (var, Qlast_arrow_string)))) 13022 EQ (pstr, Fget (var, Qlast_arrow_string))))
13115 return 1; 13023 return true;
13116 } 13024 }
13117 return 0; 13025 return false;
13118} 13026}
13119 13027
13120/* Mark overlay arrows to be updated on next redisplay. */ 13028/* Mark overlay arrows to be updated on next redisplay. */
@@ -13184,8 +13092,8 @@ overlay_arrow_at_row (struct it *it, struct glyph_row *row)
13184#ifdef HAVE_WINDOW_SYSTEM 13092#ifdef HAVE_WINDOW_SYSTEM
13185 if (val = Fget (var, Qoverlay_arrow_bitmap), SYMBOLP (val)) 13093 if (val = Fget (var, Qoverlay_arrow_bitmap), SYMBOLP (val))
13186 { 13094 {
13187 int fringe_bitmap; 13095 int fringe_bitmap = lookup_fringe_bitmap (val);
13188 if ((fringe_bitmap = lookup_fringe_bitmap (val)) != 0) 13096 if (fringe_bitmap != 0)
13189 return make_number (fringe_bitmap); 13097 return make_number (fringe_bitmap);
13190 } 13098 }
13191#endif 13099#endif
@@ -13198,11 +13106,11 @@ overlay_arrow_at_row (struct it *it, struct glyph_row *row)
13198 return Qnil; 13106 return Qnil;
13199} 13107}
13200 13108
13201/* Return 1 if point moved out of or into a composition. Otherwise 13109/* Return true if point moved out of or into a composition. Otherwise
13202 return 0. PREV_BUF and PREV_PT are the last point buffer and 13110 return false. PREV_BUF and PREV_PT are the last point buffer and
13203 position. BUF and PT are the current point buffer and position. */ 13111 position. BUF and PT are the current point buffer and position. */
13204 13112
13205static int 13113static bool
13206check_point_in_composition (struct buffer *prev_buf, ptrdiff_t prev_pt, 13114check_point_in_composition (struct buffer *prev_buf, ptrdiff_t prev_pt,
13207 struct buffer *buf, ptrdiff_t pt) 13115 struct buffer *buf, ptrdiff_t pt)
13208{ 13116{
@@ -13217,13 +13125,13 @@ check_point_in_composition (struct buffer *prev_buf, ptrdiff_t prev_pt,
13217 { 13125 {
13218 if (prev_pt == pt) 13126 if (prev_pt == pt)
13219 /* Point didn't move. */ 13127 /* Point didn't move. */
13220 return 0; 13128 return false;
13221 13129
13222 if (prev_pt > BUF_BEGV (buf) && prev_pt < BUF_ZV (buf) 13130 if (prev_pt > BUF_BEGV (buf) && prev_pt < BUF_ZV (buf)
13223 && find_composition (prev_pt, -1, &start, &end, &prop, buffer) 13131 && find_composition (prev_pt, -1, &start, &end, &prop, buffer)
13224 && composition_valid_p (start, end, prop) 13132 && composition_valid_p (start, end, prop)
13225 && start < prev_pt && end > prev_pt) 13133 && start < prev_pt && end > prev_pt)
13226 /* The last point was within the composition. Return 1 iff 13134 /* The last point was within the composition. Return true iff
13227 point moved out of the composition. */ 13135 point moved out of the composition. */
13228 return (pt <= start || pt >= end); 13136 return (pt <= start || pt >= end);
13229 } 13137 }
@@ -13247,13 +13155,12 @@ reconsider_clip_changes (struct window *w)
13247 && w->current_matrix->buffer == b 13155 && w->current_matrix->buffer == b
13248 && w->current_matrix->zv == BUF_ZV (b) 13156 && w->current_matrix->zv == BUF_ZV (b)
13249 && w->current_matrix->begv == BUF_BEGV (b)) 13157 && w->current_matrix->begv == BUF_BEGV (b))
13250 b->clip_changed = 0; 13158 b->clip_changed = false;
13251 13159
13252 /* If display wasn't paused, and W is not a tool bar window, see if 13160 /* If display wasn't paused, and W is not a tool bar window, see if
13253 point has been moved into or out of a composition. In that case, 13161 point has been moved into or out of a composition. In that case,
13254 we set b->clip_changed to 1 to force updating the screen. If 13162 set b->clip_changed to force updating the screen. If
13255 b->clip_changed has already been set to 1, we can skip this 13163 b->clip_changed has already been set, skip this check. */
13256 check. */
13257 if (!b->clip_changed && w->window_end_valid) 13164 if (!b->clip_changed && w->window_end_valid)
13258 { 13165 {
13259 ptrdiff_t pt = (w == XWINDOW (selected_window) 13166 ptrdiff_t pt = (w == XWINDOW (selected_window)
@@ -13262,7 +13169,7 @@ reconsider_clip_changes (struct window *w)
13262 if ((w->current_matrix->buffer != b || pt != w->last_point) 13169 if ((w->current_matrix->buffer != b || pt != w->last_point)
13263 && check_point_in_composition (w->current_matrix->buffer, 13170 && check_point_in_composition (w->current_matrix->buffer,
13264 w->last_point, b, pt)) 13171 w->last_point, b, pt))
13265 b->clip_changed = 1; 13172 b->clip_changed = true;
13266 } 13173 }
13267} 13174}
13268 13175
@@ -13290,11 +13197,11 @@ propagate_buffer_redisplay (void)
13290 13197
13291#define STOP_POLLING \ 13198#define STOP_POLLING \
13292do { if (! polling_stopped_here) stop_polling (); \ 13199do { if (! polling_stopped_here) stop_polling (); \
13293 polling_stopped_here = 1; } while (0) 13200 polling_stopped_here = true; } while (false)
13294 13201
13295#define RESUME_POLLING \ 13202#define RESUME_POLLING \
13296do { if (polling_stopped_here) start_polling (); \ 13203do { if (polling_stopped_here) start_polling (); \
13297 polling_stopped_here = 0; } while (0) 13204 polling_stopped_here = false; } while (false)
13298 13205
13299 13206
13300/* Perhaps in the future avoid recentering windows if it 13207/* Perhaps in the future avoid recentering windows if it
@@ -13307,12 +13214,12 @@ redisplay_internal (void)
13307 struct window *sw; 13214 struct window *sw;
13308 struct frame *fr; 13215 struct frame *fr;
13309 bool pending; 13216 bool pending;
13310 bool must_finish = 0, match_p; 13217 bool must_finish = false, match_p;
13311 struct text_pos tlbufpos, tlendpos; 13218 struct text_pos tlbufpos, tlendpos;
13312 int number_of_visible_frames; 13219 int number_of_visible_frames;
13313 ptrdiff_t count; 13220 ptrdiff_t count;
13314 struct frame *sf; 13221 struct frame *sf;
13315 int polling_stopped_here = 0; 13222 bool polling_stopped_here = false;
13316 Lisp_Object tail, frame; 13223 Lisp_Object tail, frame;
13317 13224
13318 /* True means redisplay has to consider all windows on all 13225 /* True means redisplay has to consider all windows on all
@@ -13353,14 +13260,14 @@ redisplay_internal (void)
13353 when we leave this function. */ 13260 when we leave this function. */
13354 count = SPECPDL_INDEX (); 13261 count = SPECPDL_INDEX ();
13355 record_unwind_protect_void (unwind_redisplay); 13262 record_unwind_protect_void (unwind_redisplay);
13356 redisplaying_p = 1; 13263 redisplaying_p = true;
13357 specbind (Qinhibit_free_realized_faces, Qnil); 13264 specbind (Qinhibit_free_realized_faces, Qnil);
13358 13265
13359 /* Record this function, so it appears on the profiler's backtraces. */ 13266 /* Record this function, so it appears on the profiler's backtraces. */
13360 record_in_backtrace (Qredisplay_internal, 0, 0); 13267 record_in_backtrace (Qredisplay_internal, 0, 0);
13361 13268
13362 FOR_EACH_FRAME (tail, frame) 13269 FOR_EACH_FRAME (tail, frame)
13363 XFRAME (frame)->already_hscrolled_p = 0; 13270 XFRAME (frame)->already_hscrolled_p = false;
13364 13271
13365 retry: 13272 retry:
13366 /* Remember the currently selected window. */ 13273 /* Remember the currently selected window. */
@@ -13407,7 +13314,7 @@ redisplay_internal (void)
13407 if (f->fonts_changed) 13314 if (f->fonts_changed)
13408 { 13315 {
13409 adjust_frame_glyphs (f); 13316 adjust_frame_glyphs (f);
13410 f->fonts_changed = 0; 13317 f->fonts_changed = false;
13411 } 13318 }
13412 /* If cursor type has been changed on the frame 13319 /* If cursor type has been changed on the frame
13413 other than selected, consider all frames. */ 13320 other than selected, consider all frames. */
@@ -13440,10 +13347,10 @@ redisplay_internal (void)
13440 { 13347 {
13441 /* Detect case that we need to write or remove a star in the mode line. */ 13348 /* Detect case that we need to write or remove a star in the mode line. */
13442 if ((SAVE_MODIFF < MODIFF) != w->last_had_star) 13349 if ((SAVE_MODIFF < MODIFF) != w->last_had_star)
13443 w->update_mode_line = 1; 13350 w->update_mode_line = true;
13444 13351
13445 if (mode_line_update_needed (w)) 13352 if (mode_line_update_needed (w))
13446 w->update_mode_line = 1; 13353 w->update_mode_line = true;
13447 13354
13448 /* If reconsider_clip_changes above decided that the narrowing 13355 /* If reconsider_clip_changes above decided that the narrowing
13449 in the current buffer changed, make sure all other windows 13356 in the current buffer changed, make sure all other windows
@@ -13465,19 +13372,19 @@ redisplay_internal (void)
13465 echo-area doesn't show through. */ 13372 echo-area doesn't show through. */
13466 && !MINI_WINDOW_P (XWINDOW (selected_window)))) 13373 && !MINI_WINDOW_P (XWINDOW (selected_window))))
13467 { 13374 {
13468 int window_height_changed_p = echo_area_display (false); 13375 bool window_height_changed_p = echo_area_display (false);
13469 13376
13470 if (message_cleared_p) 13377 if (message_cleared_p)
13471 update_miniwindow_p = true; 13378 update_miniwindow_p = true;
13472 13379
13473 must_finish = 1; 13380 must_finish = true;
13474 13381
13475 /* If we don't display the current message, don't clear the 13382 /* If we don't display the current message, don't clear the
13476 message_cleared_p flag, because, if we did, we wouldn't clear 13383 message_cleared_p flag, because, if we did, we wouldn't clear
13477 the echo area in the next redisplay which doesn't preserve 13384 the echo area in the next redisplay which doesn't preserve
13478 the echo area. */ 13385 the echo area. */
13479 if (!display_last_displayed_message_p) 13386 if (!display_last_displayed_message_p)
13480 message_cleared_p = 0; 13387 message_cleared_p = false;
13481 13388
13482 if (window_height_changed_p) 13389 if (window_height_changed_p)
13483 { 13390 {
@@ -13491,11 +13398,11 @@ redisplay_internal (void)
13491 } 13398 }
13492 else if (EQ (selected_window, minibuf_window) 13399 else if (EQ (selected_window, minibuf_window)
13493 && (current_buffer->clip_changed || window_outdated (w)) 13400 && (current_buffer->clip_changed || window_outdated (w))
13494 && resize_mini_window (w, 0)) 13401 && resize_mini_window (w, false))
13495 { 13402 {
13496 /* Resized active mini-window to fit the size of what it is 13403 /* Resized active mini-window to fit the size of what it is
13497 showing if its contents might have changed. */ 13404 showing if its contents might have changed. */
13498 must_finish = 1; 13405 must_finish = true;
13499 13406
13500 /* If window configuration was changed, frames may have been 13407 /* If window configuration was changed, frames may have been
13501 marked garbaged. Clear them or we will experience 13408 marked garbaged. Clear them or we will experience
@@ -13590,7 +13497,7 @@ redisplay_internal (void)
13590 13497
13591 TRACE ((stderr, "trying display optimization 1\n")); 13498 TRACE ((stderr, "trying display optimization 1\n"));
13592 w->cursor.vpos = -1; 13499 w->cursor.vpos = -1;
13593 overlay_arrow_seen = 0; 13500 overlay_arrow_seen = false;
13594 it.vpos = this_line_vpos; 13501 it.vpos = this_line_vpos;
13595 it.current_y = this_line_y; 13502 it.current_y = this_line_y;
13596 it.glyph_row = MATRIX_ROW (w->desired_matrix, this_line_vpos); 13503 it.glyph_row = MATRIX_ROW (w->desired_matrix, this_line_vpos);
@@ -13645,17 +13552,17 @@ redisplay_internal (void)
13645 else if (w->window_end_vpos == this_line_vpos 13552 else if (w->window_end_vpos == this_line_vpos
13646 && this_line_vpos > 0) 13553 && this_line_vpos > 0)
13647 w->window_end_vpos = this_line_vpos - 1; 13554 w->window_end_vpos = this_line_vpos - 1;
13648 w->window_end_valid = 0; 13555 w->window_end_valid = false;
13649 13556
13650 /* Update hint: No need to try to scroll in update_window. */ 13557 /* Update hint: No need to try to scroll in update_window. */
13651 w->desired_matrix->no_scrolling_p = 1; 13558 w->desired_matrix->no_scrolling_p = true;
13652 13559
13653#ifdef GLYPH_DEBUG 13560#ifdef GLYPH_DEBUG
13654 *w->desired_matrix->method = 0; 13561 *w->desired_matrix->method = 0;
13655 debug_method_add (w, "optimization 1"); 13562 debug_method_add (w, "optimization 1");
13656#endif 13563#endif
13657#ifdef HAVE_WINDOW_SYSTEM 13564#ifdef HAVE_WINDOW_SYSTEM
13658 update_window_fringes (w, 0); 13565 update_window_fringes (w, false);
13659#endif 13566#endif
13660 goto update; 13567 goto update;
13661 } 13568 }
@@ -13736,13 +13643,13 @@ redisplay_internal (void)
13736#endif 13643#endif
13737 13644
13738 /* Build desired matrices, and update the display. If 13645 /* Build desired matrices, and update the display. If
13739 consider_all_windows_p is non-zero, do it for all windows on all 13646 consider_all_windows_p, do it for all windows on all frames.
13740 frames. Otherwise do it for selected_window, only. */ 13647 Otherwise do it for selected_window, only. */
13741 13648
13742 if (consider_all_windows_p) 13649 if (consider_all_windows_p)
13743 { 13650 {
13744 FOR_EACH_FRAME (tail, frame) 13651 FOR_EACH_FRAME (tail, frame)
13745 XFRAME (frame)->updated_p = 0; 13652 XFRAME (frame)->updated_p = false;
13746 13653
13747 propagate_buffer_redisplay (); 13654 propagate_buffer_redisplay ();
13748 13655
@@ -13840,7 +13747,7 @@ redisplay_internal (void)
13840 if (f->updated_p) 13747 if (f->updated_p)
13841 { 13748 {
13842 f->redisplay = false; 13749 f->redisplay = false;
13843 mark_window_display_accurate (f->root_window, 1); 13750 mark_window_display_accurate (f->root_window, true);
13844 if (FRAME_TERMINAL (f)->frame_up_to_date_hook) 13751 if (FRAME_TERMINAL (f)->frame_up_to_date_hook)
13845 FRAME_TERMINAL (f)->frame_up_to_date_hook (f); 13752 FRAME_TERMINAL (f)->frame_up_to_date_hook (f);
13846 } 13753 }
@@ -13934,7 +13841,7 @@ redisplay_internal (void)
13934 /* This can happen if b->text->redisplay was set during 13841 /* This can happen if b->text->redisplay was set during
13935 jit-lock. */ 13842 jit-lock. */
13936 propagate_buffer_redisplay (); 13843 propagate_buffer_redisplay ();
13937 mark_window_display_accurate_1 (w, 1); 13844 mark_window_display_accurate_1 (w, true);
13938 13845
13939 /* Say overlay arrows are up to date. */ 13846 /* Say overlay arrows are up to date. */
13940 update_overlay_arrows (1); 13847 update_overlay_arrows (1);
@@ -14052,17 +13959,17 @@ redisplay_preserve_echo_area (int from_where)
14052static void 13959static void
14053unwind_redisplay (void) 13960unwind_redisplay (void)
14054{ 13961{
14055 redisplaying_p = 0; 13962 redisplaying_p = false;
14056} 13963}
14057 13964
14058 13965
14059/* Mark the display of leaf window W as accurate or inaccurate. 13966/* Mark the display of leaf window W as accurate or inaccurate.
14060 If ACCURATE_P is non-zero mark display of W as accurate. If 13967 If ACCURATE_P, mark display of W as accurate.
14061 ACCURATE_P is zero, arrange for W to be redisplayed the next 13968 If !ACCURATE_P, arrange for W to be redisplayed the next
14062 time redisplay_internal is called. */ 13969 time redisplay_internal is called. */
14063 13970
14064static void 13971static void
14065mark_window_display_accurate_1 (struct window *w, int accurate_p) 13972mark_window_display_accurate_1 (struct window *w, bool accurate_p)
14066{ 13973{
14067 struct buffer *b = XBUFFER (w->contents); 13974 struct buffer *b = XBUFFER (w->contents);
14068 13975
@@ -14106,12 +14013,12 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p)
14106 14013
14107 14014
14108/* Mark the display of windows in the window tree rooted at WINDOW as 14015/* Mark the display of windows in the window tree rooted at WINDOW as
14109 accurate or inaccurate. If ACCURATE_P is non-zero mark display of 14016 accurate or inaccurate. If ACCURATE_P, mark display of
14110 windows as accurate. If ACCURATE_P is zero, arrange for windows to 14017 windows as accurate. If !ACCURATE_P, arrange for windows to
14111 be redisplayed the next time redisplay_internal is called. */ 14018 be redisplayed the next time redisplay_internal is called. */
14112 14019
14113void 14020void
14114mark_window_display_accurate (Lisp_Object window, int accurate_p) 14021mark_window_display_accurate (Lisp_Object window, bool accurate_p)
14115{ 14022{
14116 struct window *w; 14023 struct window *w;
14117 14024
@@ -14222,9 +14129,9 @@ redisplay_window_1 (Lisp_Object window)
14222 which positions recorded in ROW differ from current buffer 14129 which positions recorded in ROW differ from current buffer
14223 positions. 14130 positions.
14224 14131
14225 Return 0 if cursor is not on this row, 1 otherwise. */ 14132 Return true iff cursor is on this row. */
14226 14133
14227static int 14134static bool
14228set_cursor_from_row (struct window *w, struct glyph_row *row, 14135set_cursor_from_row (struct window *w, struct glyph_row *row,
14229 struct glyph_matrix *matrix, 14136 struct glyph_matrix *matrix,
14230 ptrdiff_t delta, ptrdiff_t delta_bytes, 14137 ptrdiff_t delta, ptrdiff_t delta_bytes,
@@ -14243,12 +14150,12 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14243 /* A glyph beyond the edge of TEXT_AREA which we should never 14150 /* A glyph beyond the edge of TEXT_AREA which we should never
14244 touch. */ 14151 touch. */
14245 struct glyph *glyphs_end = end; 14152 struct glyph *glyphs_end = end;
14246 /* Non-zero means we've found a match for cursor position, but that 14153 /* True means we've found a match for cursor position, but that
14247 glyph has the avoid_cursor_p flag set. */ 14154 glyph has the avoid_cursor_p flag set. */
14248 int match_with_avoid_cursor = 0; 14155 bool match_with_avoid_cursor = false;
14249 /* Non-zero means we've seen at least one glyph that came from a 14156 /* True means we've seen at least one glyph that came from a
14250 display string. */ 14157 display string. */
14251 int string_seen = 0; 14158 bool string_seen = false;
14252 /* Largest and smallest buffer positions seen so far during scan of 14159 /* Largest and smallest buffer positions seen so far during scan of
14253 glyph row. */ 14160 glyph row. */
14254 ptrdiff_t bpos_max = pos_before; 14161 ptrdiff_t bpos_max = pos_before;
@@ -14256,16 +14163,16 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14256 /* Last buffer position covered by an overlay string with an integer 14163 /* Last buffer position covered by an overlay string with an integer
14257 `cursor' property. */ 14164 `cursor' property. */
14258 ptrdiff_t bpos_covered = 0; 14165 ptrdiff_t bpos_covered = 0;
14259 /* Non-zero means the display string on which to display the cursor 14166 /* True means the display string on which to display the cursor
14260 comes from a text property, not from an overlay. */ 14167 comes from a text property, not from an overlay. */
14261 int string_from_text_prop = 0; 14168 bool string_from_text_prop = false;
14262 14169
14263 /* Don't even try doing anything if called for a mode-line or 14170 /* Don't even try doing anything if called for a mode-line or
14264 header-line row, since the rest of the code isn't prepared to 14171 header-line row, since the rest of the code isn't prepared to
14265 deal with such calamities. */ 14172 deal with such calamities. */
14266 eassert (!row->mode_line_p); 14173 eassert (!row->mode_line_p);
14267 if (row->mode_line_p) 14174 if (row->mode_line_p)
14268 return 0; 14175 return false;
14269 14176
14270 /* Skip over glyphs not having an object at the start and the end of 14177 /* Skip over glyphs not having an object at the start and the end of
14271 the row. These are special glyphs like truncation marks on 14178 the row. These are special glyphs like truncation marks on
@@ -14360,7 +14267,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14360 display the cursor. */ 14267 display the cursor. */
14361 if (dpos == 0) 14268 if (dpos == 0)
14362 { 14269 {
14363 match_with_avoid_cursor = 0; 14270 match_with_avoid_cursor = false;
14364 break; 14271 break;
14365 } 14272 }
14366 /* See if we've found a better approximation to 14273 /* See if we've found a better approximation to
@@ -14377,7 +14284,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14377 } 14284 }
14378 } 14285 }
14379 else if (dpos == 0) 14286 else if (dpos == 0)
14380 match_with_avoid_cursor = 1; 14287 match_with_avoid_cursor = true;
14381 } 14288 }
14382 else if (STRINGP (glyph->object)) 14289 else if (STRINGP (glyph->object))
14383 { 14290 {
@@ -14400,7 +14307,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14400 ever seen in the row. */ 14307 ever seen in the row. */
14401 ptrdiff_t prop_pos = 14308 ptrdiff_t prop_pos =
14402 string_buffer_position_lim (glyph->object, pos_before, 14309 string_buffer_position_lim (glyph->object, pos_before,
14403 pos_after, 0); 14310 pos_after, false);
14404 14311
14405 if (prop_pos >= pos_before) 14312 if (prop_pos >= pos_before)
14406 bpos_max = prop_pos; 14313 bpos_max = prop_pos;
@@ -14426,7 +14333,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14426 } 14333 }
14427 } 14334 }
14428 14335
14429 string_seen = 1; 14336 string_seen = true;
14430 } 14337 }
14431 x += glyph->pixel_width; 14338 x += glyph->pixel_width;
14432 ++glyph; 14339 ++glyph;
@@ -14446,7 +14353,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14446 { 14353 {
14447 if (dpos == 0) 14354 if (dpos == 0)
14448 { 14355 {
14449 match_with_avoid_cursor = 0; 14356 match_with_avoid_cursor = false;
14450 break; 14357 break;
14451 } 14358 }
14452 if (0 > dpos && dpos > pos_before - pt_old) 14359 if (0 > dpos && dpos > pos_before - pt_old)
@@ -14461,7 +14368,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14461 } 14368 }
14462 } 14369 }
14463 else if (dpos == 0) 14370 else if (dpos == 0)
14464 match_with_avoid_cursor = 1; 14371 match_with_avoid_cursor = true;
14465 } 14372 }
14466 else if (STRINGP (glyph->object)) 14373 else if (STRINGP (glyph->object))
14467 { 14374 {
@@ -14474,7 +14381,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14474 { 14381 {
14475 ptrdiff_t prop_pos = 14382 ptrdiff_t prop_pos =
14476 string_buffer_position_lim (glyph->object, pos_before, 14383 string_buffer_position_lim (glyph->object, pos_before,
14477 pos_after, 0); 14384 pos_after, false);
14478 14385
14479 if (prop_pos >= pos_before) 14386 if (prop_pos >= pos_before)
14480 bpos_max = prop_pos; 14387 bpos_max = prop_pos;
@@ -14491,7 +14398,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14491 break; 14398 break;
14492 } 14399 }
14493 } 14400 }
14494 string_seen = 1; 14401 string_seen = true;
14495 } 14402 }
14496 --glyph; 14403 --glyph;
14497 if (glyph == glyphs_end) /* don't dereference outside TEXT_AREA */ 14404 if (glyph == glyphs_end) /* don't dereference outside TEXT_AREA */
@@ -14514,14 +14421,14 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14514 Note that on a TTY, there are more glyphs after that, which 14421 Note that on a TTY, there are more glyphs after that, which
14515 were produced by extend_face_to_end_of_line, but their 14422 were produced by extend_face_to_end_of_line, but their
14516 CHARPOS is zero or negative. */ 14423 CHARPOS is zero or negative. */
14517 int empty_line_p = 14424 bool empty_line_p =
14518 (row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end) 14425 ((row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end)
14519 && NILP (glyph->object) && glyph->charpos > 0 14426 && NILP (glyph->object) && glyph->charpos > 0
14520 /* On a TTY, continued and truncated rows also have a glyph at 14427 /* On a TTY, continued and truncated rows also have a glyph at
14521 their end whose OBJECT is nil and whose CHARPOS is 14428 their end whose OBJECT is nil and whose CHARPOS is
14522 positive (the continuation and truncation glyphs), but such 14429 positive (the continuation and truncation glyphs), but such
14523 rows are obviously not "empty". */ 14430 rows are obviously not "empty". */
14524 && !(row->continued_p || row->truncated_on_right_p); 14431 && !(row->continued_p || row->truncated_on_right_p));
14525 14432
14526 if (row->ends_in_ellipsis_p && pos_after == last_pos) 14433 if (row->ends_in_ellipsis_p && pos_after == last_pos)
14527 { 14434 {
@@ -14614,9 +14521,9 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14614 ptrdiff_t lim = pos_after 14521 ptrdiff_t lim = pos_after
14615 + (pos_after == MATRIX_ROW_END_CHARPOS (row) + delta); 14522 + (pos_after == MATRIX_ROW_END_CHARPOS (row) + delta);
14616 14523
14617 string_from_text_prop = 0; 14524 string_from_text_prop = false;
14618 str = glyph->object; 14525 str = glyph->object;
14619 tem = string_buffer_position_lim (str, pos, lim, 0); 14526 tem = string_buffer_position_lim (str, pos, lim, false);
14620 if (tem == 0 /* from overlay */ 14527 if (tem == 0 /* from overlay */
14621 || pos <= tem) 14528 || pos <= tem)
14622 { 14529 {
@@ -14645,7 +14552,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14645 if (tem) 14552 if (tem)
14646 { 14553 {
14647 cursor = glyph; 14554 cursor = glyph;
14648 string_from_text_prop = 1; 14555 string_from_text_prop = true;
14649 } 14556 }
14650 for ( ; 14557 for ( ;
14651 (row->reversed_p ? glyph > stop : glyph < stop) 14558 (row->reversed_p ? glyph > stop : glyph < stop)
@@ -14694,7 +14601,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14694 && (row->reversed_p ? end > glyphs_end : end < glyphs_end) 14601 && (row->reversed_p ? end > glyphs_end : end < glyphs_end)
14695 && STRINGP (end->object) 14602 && STRINGP (end->object)
14696 && row->continued_p) 14603 && row->continued_p)
14697 return 0; 14604 return false;
14698 } 14605 }
14699 /* A truncated row may not include PT among its character positions. 14606 /* A truncated row may not include PT among its character positions.
14700 Setting the cursor inside the scroll margin will trigger 14607 Setting the cursor inside the scroll margin will trigger
@@ -14772,7 +14679,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14772 14679
14773 /* Don't consider glyphs that are outside TEXT_AREA. */ 14680 /* Don't consider glyphs that are outside TEXT_AREA. */
14774 if (!(row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end)) 14681 if (!(row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end))
14775 return 0; 14682 return false;
14776 /* Keep the candidate whose buffer position is the closest to 14683 /* Keep the candidate whose buffer position is the closest to
14777 point or has the `cursor' property. */ 14684 point or has the `cursor' property. */
14778 if (/* Previous candidate is a glyph in TEXT_AREA of that row. */ 14685 if (/* Previous candidate is a glyph in TEXT_AREA of that row. */
@@ -14797,7 +14704,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14797 position is not an exact match */ 14704 position is not an exact match */
14798 || (NILP (glyph->object) 14705 || (NILP (glyph->object)
14799 && glyph->charpos != pt_old))))) 14706 && glyph->charpos != pt_old)))))
14800 return 0; 14707 return false;
14801 /* If this candidate gives an exact match, use that. */ 14708 /* If this candidate gives an exact match, use that. */
14802 if (!((BUFFERP (glyph->object) && glyph->charpos == pt_old) 14709 if (!((BUFFERP (glyph->object) && glyph->charpos == pt_old)
14803 /* If this candidate is a glyph created for the 14710 /* If this candidate is a glyph created for the
@@ -14815,7 +14722,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14815 && MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)) 14722 && MATRIX_ROW_END_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos))
14816 - MATRIX_ROW_START_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos)) 14723 - MATRIX_ROW_START_CHARPOS (MATRIX_ROW (matrix, w->cursor.vpos))
14817 < MATRIX_ROW_END_CHARPOS (row) - MATRIX_ROW_START_CHARPOS (row)) 14724 < MATRIX_ROW_END_CHARPOS (row) - MATRIX_ROW_START_CHARPOS (row))
14818 return 0; 14725 return false;
14819 } 14726 }
14820 w->cursor.hpos = glyph - row->glyphs[TEXT_AREA]; 14727 w->cursor.hpos = glyph - row->glyphs[TEXT_AREA];
14821 w->cursor.x = x; 14728 w->cursor.x = x;
@@ -14849,7 +14756,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
14849 CHARPOS (this_line_start_pos) = 0; 14756 CHARPOS (this_line_start_pos) = 0;
14850 } 14757 }
14851 14758
14852 return 1; 14759 return true;
14853} 14760}
14854 14761
14855 14762
@@ -14880,41 +14787,42 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp)
14880 14787
14881 14788
14882/* Make sure the line containing the cursor is fully visible. 14789/* Make sure the line containing the cursor is fully visible.
14883 A value of 1 means there is nothing to be done. 14790 A value of true means there is nothing to be done.
14884 (Either the line is fully visible, or it cannot be made so, 14791 (Either the line is fully visible, or it cannot be made so,
14885 or we cannot tell.) 14792 or we cannot tell.)
14886 14793
14887 If FORCE_P is non-zero, return 0 even if partial visible cursor row 14794 If FORCE_P, return false even if partial visible cursor row
14888 is higher than window. 14795 is higher than window.
14889 14796
14890 If CURRENT_MATRIX_P is non-zero, use the information from the 14797 If CURRENT_MATRIX_P, use the information from the
14891 window's current glyph matrix; otherwise use the desired glyph 14798 window's current glyph matrix; otherwise use the desired glyph
14892 matrix. 14799 matrix.
14893 14800
14894 A value of 0 means the caller should do scrolling 14801 A value of false means the caller should do scrolling
14895 as if point had gone off the screen. */ 14802 as if point had gone off the screen. */
14896 14803
14897static int 14804static bool
14898cursor_row_fully_visible_p (struct window *w, int force_p, int current_matrix_p) 14805cursor_row_fully_visible_p (struct window *w, bool force_p,
14806 bool current_matrix_p)
14899{ 14807{
14900 struct glyph_matrix *matrix; 14808 struct glyph_matrix *matrix;
14901 struct glyph_row *row; 14809 struct glyph_row *row;
14902 int window_height; 14810 int window_height;
14903 14811
14904 if (!make_cursor_line_fully_visible_p) 14812 if (!make_cursor_line_fully_visible_p)
14905 return 1; 14813 return true;
14906 14814
14907 /* It's not always possible to find the cursor, e.g, when a window 14815 /* It's not always possible to find the cursor, e.g, when a window
14908 is full of overlay strings. Don't do anything in that case. */ 14816 is full of overlay strings. Don't do anything in that case. */
14909 if (w->cursor.vpos < 0) 14817 if (w->cursor.vpos < 0)
14910 return 1; 14818 return true;
14911 14819
14912 matrix = current_matrix_p ? w->current_matrix : w->desired_matrix; 14820 matrix = current_matrix_p ? w->current_matrix : w->desired_matrix;
14913 row = MATRIX_ROW (matrix, w->cursor.vpos); 14821 row = MATRIX_ROW (matrix, w->cursor.vpos);
14914 14822
14915 /* If the cursor row is not partially visible, there's nothing to do. */ 14823 /* If the cursor row is not partially visible, there's nothing to do. */
14916 if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)) 14824 if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row))
14917 return 1; 14825 return true;
14918 14826
14919 /* If the row the cursor is in is taller than the window's height, 14827 /* If the row the cursor is in is taller than the window's height,
14920 it's not clear what to do, so do nothing. */ 14828 it's not clear what to do, so do nothing. */
@@ -14923,19 +14831,19 @@ cursor_row_fully_visible_p (struct window *w, int force_p, int current_matrix_p)
14923 { 14831 {
14924 if (!force_p || MINI_WINDOW_P (w) 14832 if (!force_p || MINI_WINDOW_P (w)
14925 || w->vscroll || w->cursor.vpos == 0) 14833 || w->vscroll || w->cursor.vpos == 0)
14926 return 1; 14834 return true;
14927 } 14835 }
14928 return 0; 14836 return false;
14929} 14837}
14930 14838
14931 14839
14932/* Try scrolling PT into view in window WINDOW. JUST_THIS_ONE_P 14840/* Try scrolling PT into view in window WINDOW. JUST_THIS_ONE_P
14933 non-zero means only WINDOW is redisplayed in redisplay_internal. 14841 means only WINDOW is redisplayed in redisplay_internal.
14934 TEMP_SCROLL_STEP has the same meaning as emacs_scroll_step, and is used 14842 TEMP_SCROLL_STEP has the same meaning as emacs_scroll_step, and is used
14935 in redisplay_window to bring a partially visible line into view in 14843 in redisplay_window to bring a partially visible line into view in
14936 the case that only the cursor has moved. 14844 the case that only the cursor has moved.
14937 14845
14938 LAST_LINE_MISFIT should be nonzero if we're scrolling because the 14846 LAST_LINE_MISFIT should be true if we're scrolling because the
14939 last screen line's vertical height extends past the end of the screen. 14847 last screen line's vertical height extends past the end of the screen.
14940 14848
14941 Value is 14849 Value is
@@ -14961,17 +14869,18 @@ enum
14961#define SCROLL_LIMIT 100 14869#define SCROLL_LIMIT 100
14962 14870
14963static int 14871static int
14964try_scrolling (Lisp_Object window, int just_this_one_p, 14872try_scrolling (Lisp_Object window, bool just_this_one_p,
14965 ptrdiff_t arg_scroll_conservatively, ptrdiff_t scroll_step, 14873 ptrdiff_t arg_scroll_conservatively, ptrdiff_t scroll_step,
14966 int temp_scroll_step, int last_line_misfit) 14874 bool temp_scroll_step, bool last_line_misfit)
14967{ 14875{
14968 struct window *w = XWINDOW (window); 14876 struct window *w = XWINDOW (window);
14969 struct frame *f = XFRAME (w->frame); 14877 struct frame *f = XFRAME (w->frame);
14970 struct text_pos pos, startp; 14878 struct text_pos pos, startp;
14971 struct it it; 14879 struct it it;
14972 int this_scroll_margin, scroll_max, rc, height; 14880 int this_scroll_margin, scroll_max, rc, height;
14973 int dy = 0, amount_to_scroll = 0, scroll_down_p = 0; 14881 int dy = 0, amount_to_scroll = 0;
14974 int extra_scroll_margin_lines = last_line_misfit ? 1 : 0; 14882 bool scroll_down_p = false;
14883 int extra_scroll_margin_lines = last_line_misfit;
14975 Lisp_Object aggressive; 14884 Lisp_Object aggressive;
14976 /* We will never try scrolling more than this number of lines. */ 14885 /* We will never try scrolling more than this number of lines. */
14977 int scroll_limit = SCROLL_LIMIT; 14886 int scroll_limit = SCROLL_LIMIT;
@@ -15054,7 +14963,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
15054 return SCROLLING_FAILED; 14963 return SCROLLING_FAILED;
15055 14964
15056 if (dy > 0) 14965 if (dy > 0)
15057 scroll_down_p = 1; 14966 scroll_down_p = true;
15058 } 14967 }
15059 } 14968 }
15060 14969
@@ -15234,7 +15143,8 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
15234 15143
15235 /* If cursor ends up on a partially visible line, 15144 /* If cursor ends up on a partially visible line,
15236 treat that as being off the bottom of the screen. */ 15145 treat that as being off the bottom of the screen. */
15237 if (! cursor_row_fully_visible_p (w, extra_scroll_margin_lines <= 1, 0) 15146 if (! cursor_row_fully_visible_p (w, extra_scroll_margin_lines <= 1,
15147 false)
15238 /* It's possible that the cursor is on the first line of the 15148 /* It's possible that the cursor is on the first line of the
15239 buffer, which is partially obscured due to a vscroll 15149 buffer, which is partially obscured due to a vscroll
15240 (Bug#7537). In that case, avoid looping forever. */ 15150 (Bug#7537). In that case, avoid looping forever. */
@@ -15252,18 +15162,18 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
15252 15162
15253 15163
15254/* Compute a suitable window start for window W if display of W starts 15164/* Compute a suitable window start for window W if display of W starts
15255 on a continuation line. Value is non-zero if a new window start 15165 on a continuation line. Value is true if a new window start
15256 was computed. 15166 was computed.
15257 15167
15258 The new window start will be computed, based on W's width, starting 15168 The new window start will be computed, based on W's width, starting
15259 from the start of the continued line. It is the start of the 15169 from the start of the continued line. It is the start of the
15260 screen line with the minimum distance from the old start W->start. */ 15170 screen line with the minimum distance from the old start W->start. */
15261 15171
15262static int 15172static bool
15263compute_window_start_on_continuation_line (struct window *w) 15173compute_window_start_on_continuation_line (struct window *w)
15264{ 15174{
15265 struct text_pos pos, start_pos; 15175 struct text_pos pos, start_pos;
15266 int window_start_changed_p = 0; 15176 bool window_start_changed_p = false;
15267 15177
15268 SET_TEXT_POS_FROM_MARKER (start_pos, w->start); 15178 SET_TEXT_POS_FROM_MARKER (start_pos, w->start);
15269 15179
@@ -15284,7 +15194,7 @@ compute_window_start_on_continuation_line (struct window *w)
15284 15194
15285 /* Find the start of the continued line. This should be fast 15195 /* Find the start of the continued line. This should be fast
15286 because find_newline is fast (newline cache). */ 15196 because find_newline is fast (newline cache). */
15287 row = w->desired_matrix->rows + (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0); 15197 row = w->desired_matrix->rows + WINDOW_WANTS_HEADER_LINE_P (w);
15288 init_iterator (&it, w, CHARPOS (start_pos), BYTEPOS (start_pos), 15198 init_iterator (&it, w, CHARPOS (start_pos), BYTEPOS (start_pos),
15289 row, DEFAULT_FACE_ID); 15199 row, DEFAULT_FACE_ID);
15290 reseat_at_previous_visible_line_start (&it); 15200 reseat_at_previous_visible_line_start (&it);
@@ -15333,7 +15243,7 @@ compute_window_start_on_continuation_line (struct window *w)
15333 15243
15334 /* Set the window start there. */ 15244 /* Set the window start there. */
15335 SET_MARKER_FROM_TEXT_POS (w->start, pos); 15245 SET_MARKER_FROM_TEXT_POS (w->start, pos);
15336 window_start_changed_p = 1; 15246 window_start_changed_p = true;
15337 } 15247 }
15338 } 15248 }
15339 15249
@@ -15349,7 +15259,7 @@ compute_window_start_on_continuation_line (struct window *w)
15349 CURSOR_MOVEMENT_CANNOT_BE_USED if this method cannot be used 15259 CURSOR_MOVEMENT_CANNOT_BE_USED if this method cannot be used
15350 15260
15351 CURSOR_MOVEMENT_MUST_SCROLL if we know we have to scroll the 15261 CURSOR_MOVEMENT_MUST_SCROLL if we know we have to scroll the
15352 display. *SCROLL_STEP is set to 1, under certain circumstances, if 15262 display. *SCROLL_STEP is set to true, under certain circumstances, if
15353 we want to scroll as if scroll-step were set to 1. See the code. 15263 we want to scroll as if scroll-step were set to 1. See the code.
15354 15264
15355 CURSOR_MOVEMENT_NEED_LARGER_MATRICES if we need larger matrices, in 15265 CURSOR_MOVEMENT_NEED_LARGER_MATRICES if we need larger matrices, in
@@ -15365,7 +15275,8 @@ enum
15365}; 15275};
15366 15276
15367static int 15277static int
15368try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_step) 15278try_cursor_movement (Lisp_Object window, struct text_pos startp,
15279 bool *scroll_step)
15369{ 15280{
15370 struct window *w = XWINDOW (window); 15281 struct window *w = XWINDOW (window);
15371 struct frame *f = XFRAME (w->frame); 15282 struct frame *f = XFRAME (w->frame);
@@ -15450,7 +15361,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
15450 15361
15451 if (rc == CURSOR_MOVEMENT_CANNOT_BE_USED) 15362 if (rc == CURSOR_MOVEMENT_CANNOT_BE_USED)
15452 { 15363 {
15453 int scroll_p = 0, must_scroll = 0; 15364 bool scroll_p = false, must_scroll = false;
15454 int last_y = window_text_bottom_y (w) - this_scroll_margin; 15365 int last_y = window_text_bottom_y (w) - this_scroll_margin;
15455 15366
15456 if (PT > w->last_point) 15367 if (PT > w->last_point)
@@ -15485,7 +15396,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
15485 && PT == MATRIX_ROW_END_CHARPOS (row) 15396 && PT == MATRIX_ROW_END_CHARPOS (row)
15486 && !row->ends_at_zv_p 15397 && !row->ends_at_zv_p
15487 && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))) 15398 && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)))
15488 scroll_p = 1; 15399 scroll_p = true;
15489 } 15400 }
15490 else if (PT < w->last_point) 15401 else if (PT < w->last_point)
15491 { 15402 {
@@ -15528,7 +15439,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
15528 /* If within the scroll margin, scroll. */ 15439 /* If within the scroll margin, scroll. */
15529 if (row->y < top_scroll_margin 15440 if (row->y < top_scroll_margin
15530 && CHARPOS (startp) != BEGV) 15441 && CHARPOS (startp) != BEGV)
15531 scroll_p = 1; 15442 scroll_p = true;
15532 } 15443 }
15533 else 15444 else
15534 { 15445 {
@@ -15542,7 +15453,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
15542 { 15453 {
15543 /* if PT is not in the glyph row, give up. */ 15454 /* if PT is not in the glyph row, give up. */
15544 rc = CURSOR_MOVEMENT_MUST_SCROLL; 15455 rc = CURSOR_MOVEMENT_MUST_SCROLL;
15545 must_scroll = 1; 15456 must_scroll = true;
15546 } 15457 }
15547 else if (rc != CURSOR_MOVEMENT_SUCCESS 15458 else if (rc != CURSOR_MOVEMENT_SUCCESS
15548 && !NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering))) 15459 && !NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering)))
@@ -15579,7 +15490,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
15579 else if (rc != CURSOR_MOVEMENT_SUCCESS 15490 else if (rc != CURSOR_MOVEMENT_SUCCESS
15580 && MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row) 15491 && MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)
15581 /* Make sure this isn't a header line by any chance, since 15492 /* Make sure this isn't a header line by any chance, since
15582 then MATRIX_ROW_PARTIALLY_VISIBLE_P might yield non-zero. */ 15493 then MATRIX_ROW_PARTIALLY_VISIBLE_P might yield true. */
15583 && !row->mode_line_p 15494 && !row->mode_line_p
15584 && make_cursor_line_fully_visible_p) 15495 && make_cursor_line_fully_visible_p)
15585 { 15496 {
@@ -15593,13 +15504,13 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
15593 make it fully visible, except when it's taller 15504 make it fully visible, except when it's taller
15594 than the window, in which case we can't do much 15505 than the window, in which case we can't do much
15595 about it. */ 15506 about it. */
15596 *scroll_step = 1; 15507 *scroll_step = true;
15597 rc = CURSOR_MOVEMENT_MUST_SCROLL; 15508 rc = CURSOR_MOVEMENT_MUST_SCROLL;
15598 } 15509 }
15599 else 15510 else
15600 { 15511 {
15601 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); 15512 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
15602 if (!cursor_row_fully_visible_p (w, 0, 1)) 15513 if (!cursor_row_fully_visible_p (w, false, true))
15603 rc = CURSOR_MOVEMENT_MUST_SCROLL; 15514 rc = CURSOR_MOVEMENT_MUST_SCROLL;
15604 else 15515 else
15605 rc = CURSOR_MOVEMENT_SUCCESS; 15516 rc = CURSOR_MOVEMENT_SUCCESS;
@@ -15617,11 +15528,11 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
15617 /* FIXME: Revisit this when glyph ``spilling'' in 15528 /* FIXME: Revisit this when glyph ``spilling'' in
15618 continuation lines' rows is implemented for 15529 continuation lines' rows is implemented for
15619 bidi-reordered rows. */ 15530 bidi-reordered rows. */
15620 int rv = 0; 15531 bool rv = false;
15621 15532
15622 do 15533 do
15623 { 15534 {
15624 int at_zv_p = 0, exact_match_p = 0; 15535 bool at_zv_p = false, exact_match_p = false;
15625 15536
15626 if (MATRIX_ROW_START_CHARPOS (row) <= PT 15537 if (MATRIX_ROW_START_CHARPOS (row) <= PT
15627 && PT <= MATRIX_ROW_END_CHARPOS (row) 15538 && PT <= MATRIX_ROW_END_CHARPOS (row)
@@ -15803,7 +15714,7 @@ set_horizontal_scroll_bar (struct window *w)
15803} 15714}
15804 15715
15805 15716
15806/* Redisplay leaf window WINDOW. JUST_THIS_ONE_P non-zero means only 15717/* Redisplay leaf window WINDOW. JUST_THIS_ONE_P means only
15807 selected_window is redisplayed. 15718 selected_window is redisplayed.
15808 15719
15809 We can return without actually redisplaying the window if fonts has been 15720 We can return without actually redisplaying the window if fonts has been
@@ -15861,7 +15772,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
15861 struct buffer *buffer = XBUFFER (w->contents); 15772 struct buffer *buffer = XBUFFER (w->contents);
15862 struct buffer *old = current_buffer; 15773 struct buffer *old = current_buffer;
15863 struct text_pos lpoint, opoint, startp; 15774 struct text_pos lpoint, opoint, startp;
15864 int update_mode_line; 15775 bool update_mode_line;
15865 int tem; 15776 int tem;
15866 struct it it; 15777 struct it it;
15867 /* Record it now because it's overwritten. */ 15778 /* Record it now because it's overwritten. */
@@ -15870,11 +15781,11 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
15870 /* This is less strict than current_matrix_up_to_date_p. 15781 /* This is less strict than current_matrix_up_to_date_p.
15871 It indicates that the buffer contents and narrowing are unchanged. */ 15782 It indicates that the buffer contents and narrowing are unchanged. */
15872 bool buffer_unchanged_p = false; 15783 bool buffer_unchanged_p = false;
15873 int temp_scroll_step = 0; 15784 bool temp_scroll_step = false;
15874 ptrdiff_t count = SPECPDL_INDEX (); 15785 ptrdiff_t count = SPECPDL_INDEX ();
15875 int rc; 15786 int rc;
15876 int centering_position = -1; 15787 int centering_position = -1;
15877 int last_line_misfit = 0; 15788 bool last_line_misfit = false;
15878 ptrdiff_t beg_unchanged, end_unchanged; 15789 ptrdiff_t beg_unchanged, end_unchanged;
15879 int frame_line_height; 15790 int frame_line_height;
15880 15791
@@ -16008,7 +15919,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16008 emacs_abort (); 15919 emacs_abort ();
16009 15920
16010 if (mode_line_update_needed (w)) 15921 if (mode_line_update_needed (w))
16011 update_mode_line = 1; 15922 update_mode_line = true;
16012 15923
16013 /* Point refers normally to the selected window. For any other 15924 /* Point refers normally to the selected window. For any other
16014 window, set up appropriate value. */ 15925 window, set up appropriate value. */
@@ -16071,7 +15982,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16071 { 15982 {
16072 ptrdiff_t it_charpos; 15983 ptrdiff_t it_charpos;
16073 15984
16074 w->optional_new_start = 0; 15985 w->optional_new_start = false;
16075 start_display (&it, w, startp); 15986 start_display (&it, w, startp);
16076 move_it_to (&it, PT, 0, it.last_visible_y, -1, 15987 move_it_to (&it, PT, 0, it.last_visible_y, -1,
16077 MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y); 15988 MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y);
@@ -16086,10 +15997,10 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16086 && !w->force_start) 15997 && !w->force_start)
16087 { 15998 {
16088 if (it_charpos == PT) 15999 if (it_charpos == PT)
16089 w->force_start = 1; 16000 w->force_start = true;
16090 /* IT may overshoot PT if text at PT is invisible. */ 16001 /* IT may overshoot PT if text at PT is invisible. */
16091 else if (it_charpos > PT && CHARPOS (startp) <= PT) 16002 else if (it_charpos > PT && CHARPOS (startp) <= PT)
16092 w->force_start = 1; 16003 w->force_start = true;
16093#ifdef GLYPH_DEBUG 16004#ifdef GLYPH_DEBUG
16094 if (w->force_start) 16005 if (w->force_start)
16095 { 16006 {
@@ -16111,9 +16022,9 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16111 /* We set this later on if we have to adjust point. */ 16022 /* We set this later on if we have to adjust point. */
16112 int new_vpos = -1; 16023 int new_vpos = -1;
16113 16024
16114 w->force_start = 0; 16025 w->force_start = false;
16115 w->vscroll = 0; 16026 w->vscroll = 0;
16116 w->window_end_valid = 0; 16027 w->window_end_valid = false;
16117 16028
16118 /* Forget any recorded base line for line number display. */ 16029 /* Forget any recorded base line for line number display. */
16119 if (!buffer_unchanged_p) 16030 if (!buffer_unchanged_p)
@@ -16129,8 +16040,8 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16129 if (!update_mode_line 16040 if (!update_mode_line
16130 || ! NILP (Vwindow_scroll_functions)) 16041 || ! NILP (Vwindow_scroll_functions))
16131 { 16042 {
16132 update_mode_line = 1; 16043 update_mode_line = true;
16133 w->update_mode_line = 1; 16044 w->update_mode_line = true;
16134 startp = run_window_scroll_functions (window, startp); 16045 startp = run_window_scroll_functions (window, startp);
16135 } 16046 }
16136 16047
@@ -16146,7 +16057,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16146 the scroll margin (bug#148) -- cyd */ 16057 the scroll margin (bug#148) -- cyd */
16147 if (!try_window (window, startp, 0)) 16058 if (!try_window (window, startp, 0))
16148 { 16059 {
16149 w->force_start = 1; 16060 w->force_start = true;
16150 clear_glyph_matrix (w->desired_matrix); 16061 clear_glyph_matrix (w->desired_matrix);
16151 goto need_larger_matrices; 16062 goto need_larger_matrices;
16152 } 16063 }
@@ -16159,7 +16070,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16159 new_vpos = window_box_height (w) / 2; 16070 new_vpos = window_box_height (w) / 2;
16160 } 16071 }
16161 16072
16162 if (!cursor_row_fully_visible_p (w, 0, 0)) 16073 if (!cursor_row_fully_visible_p (w, false, false))
16163 { 16074 {
16164 /* Point does appear, but on a line partly visible at end of window. 16075 /* Point does appear, but on a line partly visible at end of window.
16165 Move it back to a fully-visible line. */ 16076 Move it back to a fully-visible line. */
@@ -16252,7 +16163,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16252 goto need_larger_matrices; 16163 goto need_larger_matrices;
16253 } 16164 }
16254 } 16165 }
16255 if (w->cursor.vpos < 0 || !cursor_row_fully_visible_p (w, 0, 0)) 16166 if (w->cursor.vpos < 0 || !cursor_row_fully_visible_p (w, false, false))
16256 { 16167 {
16257 clear_glyph_matrix (w->desired_matrix); 16168 clear_glyph_matrix (w->desired_matrix);
16258 goto try_to_scroll; 16169 goto try_to_scroll;
@@ -16266,7 +16177,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16266 16177
16267 /* Handle case where text has not changed, only point, and it has 16178 /* Handle case where text has not changed, only point, and it has
16268 not moved off the frame, and we are not retrying after hscroll. 16179 not moved off the frame, and we are not retrying after hscroll.
16269 (current_matrix_up_to_date_p is nonzero when retrying.) */ 16180 (current_matrix_up_to_date_p is true when retrying.) */
16270 if (current_matrix_up_to_date_p 16181 if (current_matrix_up_to_date_p
16271 && (rc = try_cursor_movement (window, startp, &temp_scroll_step), 16182 && (rc = try_cursor_movement (window, startp, &temp_scroll_step),
16272 rc != CURSOR_MOVEMENT_CANNOT_BE_USED)) 16183 rc != CURSOR_MOVEMENT_CANNOT_BE_USED))
@@ -16274,7 +16185,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16274 switch (rc) 16185 switch (rc)
16275 { 16186 {
16276 case CURSOR_MOVEMENT_SUCCESS: 16187 case CURSOR_MOVEMENT_SUCCESS:
16277 used_current_matrix_p = 1; 16188 used_current_matrix_p = true;
16278 goto done; 16189 goto done;
16279 16190
16280 case CURSOR_MOVEMENT_MUST_SCROLL: 16191 case CURSOR_MOVEMENT_MUST_SCROLL:
@@ -16356,7 +16267,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16356 in which case we accept that it is partially visible. */ 16267 in which case we accept that it is partially visible. */
16357 && (rtop != 0) == (rbot != 0)) 16268 && (rtop != 0) == (rbot != 0))
16358 { 16269 {
16359 w->force_start = 1; 16270 w->force_start = true;
16360 SET_TEXT_POS_FROM_MARKER (startp, w->start); 16271 SET_TEXT_POS_FROM_MARKER (startp, w->start);
16361#ifdef GLYPH_DEBUG 16272#ifdef GLYPH_DEBUG
16362 debug_method_add (w, "recomputed window start in continuation line"); 16273 debug_method_add (w, "recomputed window start in continuation line");
@@ -16398,10 +16309,10 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16398 /* Forget any recorded base line for line number display. */ 16309 /* Forget any recorded base line for line number display. */
16399 w->base_line_number = 0; 16310 w->base_line_number = 0;
16400 16311
16401 if (!cursor_row_fully_visible_p (w, 1, 0)) 16312 if (!cursor_row_fully_visible_p (w, true, false))
16402 { 16313 {
16403 clear_glyph_matrix (w->desired_matrix); 16314 clear_glyph_matrix (w->desired_matrix);
16404 last_line_misfit = 1; 16315 last_line_misfit = true;
16405 } 16316 }
16406 /* Drop through and scroll. */ 16317 /* Drop through and scroll. */
16407 else 16318 else
@@ -16416,8 +16327,8 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16416 /* Redisplay the mode line. Select the buffer properly for that. */ 16327 /* Redisplay the mode line. Select the buffer properly for that. */
16417 if (!update_mode_line) 16328 if (!update_mode_line)
16418 { 16329 {
16419 update_mode_line = 1; 16330 update_mode_line = true;
16420 w->update_mode_line = 1; 16331 w->update_mode_line = true;
16421 } 16332 }
16422 16333
16423 /* Try to scroll by specified few lines. */ 16334 /* Try to scroll by specified few lines. */
@@ -16477,7 +16388,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16477 : 0; 16388 : 0;
16478 ptrdiff_t margin_pos = CHARPOS (startp); 16389 ptrdiff_t margin_pos = CHARPOS (startp);
16479 Lisp_Object aggressive; 16390 Lisp_Object aggressive;
16480 int scrolling_up; 16391 bool scrolling_up;
16481 16392
16482 /* If there is a scroll margin at the top of the window, find 16393 /* If there is a scroll margin at the top of the window, find
16483 its character position. */ 16394 its character position. */
@@ -16531,8 +16442,8 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16531 if (pt_offset) 16442 if (pt_offset)
16532 centering_position -= pt_offset; 16443 centering_position -= pt_offset;
16533 centering_position -= 16444 centering_position -=
16534 frame_line_height * (1 + margin + (last_line_misfit != 0)) 16445 (frame_line_height * (1 + margin + last_line_misfit)
16535 + WINDOW_HEADER_LINE_HEIGHT (w); 16446 + WINDOW_HEADER_LINE_HEIGHT (w));
16536 /* Don't let point enter the scroll margin near top of 16447 /* Don't let point enter the scroll margin near top of
16537 the window. */ 16448 the window. */
16538 if (centering_position < margin * frame_line_height) 16449 if (centering_position < margin * frame_line_height)
@@ -16639,7 +16550,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16639 get_char_property_and_overlay (make_number (PT), Qinvisible, 16550 get_char_property_and_overlay (make_number (PT), Qinvisible,
16640 Qnil, NULL); 16551 Qnil, NULL);
16641 16552
16642 if (TEXT_PROP_MEANS_INVISIBLE (val)) 16553 if (TEXT_PROP_MEANS_INVISIBLE (val) != 0)
16643 { 16554 {
16644 ptrdiff_t alt_pos; 16555 ptrdiff_t alt_pos;
16645 Lisp_Object invis_end = 16556 Lisp_Object invis_end =
@@ -16666,7 +16577,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16666 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); 16577 set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
16667 } 16578 }
16668 16579
16669 if (!cursor_row_fully_visible_p (w, 0, 0)) 16580 if (!cursor_row_fully_visible_p (w, false, false))
16670 { 16581 {
16671 /* If vscroll is enabled, disable it and try again. */ 16582 /* If vscroll is enabled, disable it and try again. */
16672 if (w->vscroll) 16583 if (w->vscroll)
@@ -16688,7 +16599,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16688 scroll_margin > 0 16599 scroll_margin > 0
16689 ? min (scroll_margin, window_total_lines / 4) 16600 ? min (scroll_margin, window_total_lines / 4)
16690 : 0; 16601 : 0;
16691 int move_down = w->cursor.vpos >= window_total_lines / 2; 16602 bool move_down = w->cursor.vpos >= window_total_lines / 2;
16692 16603
16693 move_it_by_lines (&it, move_down ? margin + 1 : -(margin + 1)); 16604 move_it_by_lines (&it, move_down ? margin + 1 : -(margin + 1));
16694 clear_glyph_matrix (w->desired_matrix); 16605 clear_glyph_matrix (w->desired_matrix);
@@ -16740,7 +16651,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16740 if (WINDOW_WANTS_MODELINE_P (w) 16651 if (WINDOW_WANTS_MODELINE_P (w)
16741 && CURRENT_MODE_LINE_HEIGHT (w) != DESIRED_MODE_LINE_HEIGHT (w)) 16652 && CURRENT_MODE_LINE_HEIGHT (w) != DESIRED_MODE_LINE_HEIGHT (w))
16742 { 16653 {
16743 f->fonts_changed = 1; 16654 f->fonts_changed = true;
16744 w->mode_line_height = -1; 16655 w->mode_line_height = -1;
16745 MATRIX_MODE_LINE_ROW (w->current_matrix)->height 16656 MATRIX_MODE_LINE_ROW (w->current_matrix)->height
16746 = DESIRED_MODE_LINE_HEIGHT (w); 16657 = DESIRED_MODE_LINE_HEIGHT (w);
@@ -16751,7 +16662,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16751 if (WINDOW_WANTS_HEADER_LINE_P (w) 16662 if (WINDOW_WANTS_HEADER_LINE_P (w)
16752 && CURRENT_HEADER_LINE_HEIGHT (w) != DESIRED_HEADER_LINE_HEIGHT (w)) 16663 && CURRENT_HEADER_LINE_HEIGHT (w) != DESIRED_HEADER_LINE_HEIGHT (w))
16753 { 16664 {
16754 f->fonts_changed = 1; 16665 f->fonts_changed = true;
16755 w->header_line_height = -1; 16666 w->header_line_height = -1;
16756 MATRIX_HEADER_LINE_ROW (w->current_matrix)->height 16667 MATRIX_HEADER_LINE_ROW (w->current_matrix)->height
16757 = DESIRED_HEADER_LINE_HEIGHT (w); 16668 = DESIRED_HEADER_LINE_HEIGHT (w);
@@ -16773,7 +16684,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16773 if (update_mode_line 16684 if (update_mode_line
16774 && EQ (FRAME_SELECTED_WINDOW (f), window)) 16685 && EQ (FRAME_SELECTED_WINDOW (f), window))
16775 { 16686 {
16776 int redisplay_menu_p = 0; 16687 bool redisplay_menu_p;
16777 16688
16778 if (FRAME_WINDOW_P (f)) 16689 if (FRAME_WINDOW_P (f))
16779 { 16690 {
@@ -16801,7 +16712,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16801 && (FRAME_TOOL_BAR_LINES (f) > 0 16712 && (FRAME_TOOL_BAR_LINES (f) > 0
16802 || !NILP (Vauto_resize_tool_bars)) 16713 || !NILP (Vauto_resize_tool_bars))
16803 && redisplay_tool_bar (f)) 16714 && redisplay_tool_bar (f))
16804 ignore_mouse_drag_p = 1; 16715 ignore_mouse_drag_p = true;
16805#endif 16716#endif
16806 } 16717 }
16807#endif 16718#endif
@@ -16815,7 +16726,7 @@ redisplay_window (Lisp_Object window, bool just_this_one_p)
16815 { 16726 {
16816 update_begin (f); 16727 update_begin (f);
16817 block_input (); 16728 block_input ();
16818 if (draw_window_fringes (w, 1)) 16729 if (draw_window_fringes (w, true))
16819 { 16730 {
16820 if (WINDOW_RIGHT_DIVIDER_WIDTH (w)) 16731 if (WINDOW_RIGHT_DIVIDER_WIDTH (w))
16821 x_draw_right_divider (w); 16732 x_draw_right_divider (w);
@@ -16898,7 +16809,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
16898 16809
16899 /* Mark cursor position as unknown. No overlay arrow seen. */ 16810 /* Mark cursor position as unknown. No overlay arrow seen. */
16900 w->cursor.vpos = -1; 16811 w->cursor.vpos = -1;
16901 overlay_arrow_seen = 0; 16812 overlay_arrow_seen = false;
16902 16813
16903 /* Initialize iterator and info to start at POS. */ 16814 /* Initialize iterator and info to start at POS. */
16904 start_display (&it, w, pos); 16815 start_display (&it, w, pos);
@@ -16947,7 +16858,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
16947 16858
16948 /* If bottom moved off end of frame, change mode line percentage. */ 16859 /* If bottom moved off end of frame, change mode line percentage. */
16949 if (w->window_end_pos <= 0 && Z != IT_CHARPOS (it)) 16860 if (w->window_end_pos <= 0 && Z != IT_CHARPOS (it))
16950 w->update_mode_line = 1; 16861 w->update_mode_line = true;
16951 16862
16952 /* Set window_end_pos to the offset of the last character displayed 16863 /* Set window_end_pos to the offset of the last character displayed
16953 on the window from the end of current_buffer. Set 16864 on the window from the end of current_buffer. Set
@@ -16955,7 +16866,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
16955 if (last_text_row) 16866 if (last_text_row)
16956 { 16867 {
16957 eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row)); 16868 eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row));
16958 adjust_window_ends (w, last_text_row, 0); 16869 adjust_window_ends (w, last_text_row, false);
16959 eassert 16870 eassert
16960 (MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->desired_matrix, 16871 (MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->desired_matrix,
16961 w->window_end_vpos))); 16872 w->window_end_vpos)));
@@ -16968,7 +16879,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
16968 } 16879 }
16969 16880
16970 /* But that is not valid info until redisplay finishes. */ 16881 /* But that is not valid info until redisplay finishes. */
16971 w->window_end_valid = 0; 16882 w->window_end_valid = false;
16972 return 1; 16883 return 1;
16973} 16884}
16974 16885
@@ -16980,10 +16891,10 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
16980 16891
16981/* Try redisplay of window W showing an unchanged buffer with a 16892/* Try redisplay of window W showing an unchanged buffer with a
16982 different window start than the last time it was displayed by 16893 different window start than the last time it was displayed by
16983 reusing its current matrix. Value is non-zero if successful. 16894 reusing its current matrix. Value is true if successful.
16984 W->start is the new window start. */ 16895 W->start is the new window start. */
16985 16896
16986static int 16897static bool
16987try_window_reusing_current_matrix (struct window *w) 16898try_window_reusing_current_matrix (struct window *w)
16988{ 16899{
16989 struct frame *f = XFRAME (w->frame); 16900 struct frame *f = XFRAME (w->frame);
@@ -16999,7 +16910,7 @@ try_window_reusing_current_matrix (struct window *w)
16999 16910
17000#ifdef GLYPH_DEBUG 16911#ifdef GLYPH_DEBUG
17001 if (inhibit_try_window_reusing) 16912 if (inhibit_try_window_reusing)
17002 return 0; 16913 return false;
17003#endif 16914#endif
17004 16915
17005 if (/* This function doesn't handle terminal frames. */ 16916 if (/* This function doesn't handle terminal frames. */
@@ -17008,22 +16919,22 @@ try_window_reusing_current_matrix (struct window *w)
17008 or such. */ 16919 or such. */
17009 || windows_or_buffers_changed 16920 || windows_or_buffers_changed
17010 || f->cursor_type_changed) 16921 || f->cursor_type_changed)
17011 return 0; 16922 return false;
17012 16923
17013 /* Can't do this if showing trailing whitespace. */ 16924 /* Can't do this if showing trailing whitespace. */
17014 if (!NILP (Vshow_trailing_whitespace)) 16925 if (!NILP (Vshow_trailing_whitespace))
17015 return 0; 16926 return false;
17016 16927
17017 /* If top-line visibility has changed, give up. */ 16928 /* If top-line visibility has changed, give up. */
17018 if (WINDOW_WANTS_HEADER_LINE_P (w) 16929 if (WINDOW_WANTS_HEADER_LINE_P (w)
17019 != MATRIX_HEADER_LINE_ROW (w->current_matrix)->mode_line_p) 16930 != MATRIX_HEADER_LINE_ROW (w->current_matrix)->mode_line_p)
17020 return 0; 16931 return false;
17021 16932
17022 /* Give up if old or new display is scrolled vertically. We could 16933 /* Give up if old or new display is scrolled vertically. We could
17023 make this function handle this, but right now it doesn't. */ 16934 make this function handle this, but right now it doesn't. */
17024 start_row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 16935 start_row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
17025 if (w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (w, start_row)) 16936 if (w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (w, start_row))
17026 return 0; 16937 return false;
17027 16938
17028 /* The variable new_start now holds the new window start. The old 16939 /* The variable new_start now holds the new window start. The old
17029 start `start' can be determined from the current matrix. */ 16940 start `start' can be determined from the current matrix. */
@@ -17041,7 +16952,7 @@ try_window_reusing_current_matrix (struct window *w)
17041 below, and it's certainly not worth the effort since this is 16952 below, and it's certainly not worth the effort since this is
17042 not a frequent case. */ 16953 not a frequent case. */
17043 if (in_ellipses_for_invisible_text_p (&start_row->start, w)) 16954 if (in_ellipses_for_invisible_text_p (&start_row->start, w))
17044 return 0; 16955 return false;
17045 16956
17046 IF_DEBUG (debug_method_add (w, "twu1")); 16957 IF_DEBUG (debug_method_add (w, "twu1"));
17047 16958
@@ -17070,7 +16981,7 @@ try_window_reusing_current_matrix (struct window *w)
17070 || CHARPOS (start) == ZV) 16981 || CHARPOS (start) == ZV)
17071 { 16982 {
17072 clear_glyph_matrix (w->desired_matrix); 16983 clear_glyph_matrix (w->desired_matrix);
17073 return 0; 16984 return false;
17074 } 16985 }
17075 16986
17076 start_vpos = MATRIX_ROW_VPOS (start_row, w->current_matrix); 16987 start_vpos = MATRIX_ROW_VPOS (start_row, w->current_matrix);
@@ -17115,7 +17026,7 @@ try_window_reusing_current_matrix (struct window *w)
17115 else 17026 else
17116 { 17027 {
17117 clear_glyph_matrix (w->desired_matrix); 17028 clear_glyph_matrix (w->desired_matrix);
17118 return 0; 17029 return false;
17119 } 17030 }
17120 } 17031 }
17121 17032
@@ -17135,7 +17046,7 @@ try_window_reusing_current_matrix (struct window *w)
17135 FRAME_RIF (f)->update_window_begin_hook (w); 17046 FRAME_RIF (f)->update_window_begin_hook (w);
17136 FRAME_RIF (f)->clear_window_mouse_face (w); 17047 FRAME_RIF (f)->clear_window_mouse_face (w);
17137 FRAME_RIF (f)->scroll_run_hook (w, &run); 17048 FRAME_RIF (f)->scroll_run_hook (w, &run);
17138 FRAME_RIF (f)->update_window_end_hook (w, 0, 0); 17049 FRAME_RIF (f)->update_window_end_hook (w, false, false);
17139 update_end (f); 17050 update_end (f);
17140 } 17051 }
17141 17052
@@ -17165,7 +17076,7 @@ try_window_reusing_current_matrix (struct window *w)
17165 if (row->y + row->height > max_y) 17076 if (row->y + row->height > max_y)
17166 row->visible_height -= row->y + row->height - max_y; 17077 row->visible_height -= row->y + row->height - max_y;
17167 if (row->fringe_bitmap_periodic_p) 17078 if (row->fringe_bitmap_periodic_p)
17168 row->redraw_fringe_bitmaps_p = 1; 17079 row->redraw_fringe_bitmaps_p = true;
17169 17080
17170 it.current_y += row->height; 17081 it.current_y += row->height;
17171 17082
@@ -17178,7 +17089,7 @@ try_window_reusing_current_matrix (struct window *w)
17178 /* Disable lines in the current matrix which are now 17089 /* Disable lines in the current matrix which are now
17179 below the window. */ 17090 below the window. */
17180 for (++row; row < bottom_row; ++row) 17091 for (++row; row < bottom_row; ++row)
17181 row->enabled_p = row->mode_line_p = 0; 17092 row->enabled_p = row->mode_line_p = false;
17182 } 17093 }
17183 17094
17184 /* Update window_end_pos etc.; last_reused_text_row is the last 17095 /* Update window_end_pos etc.; last_reused_text_row is the last
@@ -17186,9 +17097,9 @@ try_window_reusing_current_matrix (struct window *w)
17186 The value of last_text_row is the last displayed line 17097 The value of last_text_row is the last displayed line
17187 containing text. */ 17098 containing text. */
17188 if (last_reused_text_row) 17099 if (last_reused_text_row)
17189 adjust_window_ends (w, last_reused_text_row, 1); 17100 adjust_window_ends (w, last_reused_text_row, true);
17190 else if (last_text_row) 17101 else if (last_text_row)
17191 adjust_window_ends (w, last_text_row, 0); 17102 adjust_window_ends (w, last_text_row, false);
17192 else 17103 else
17193 { 17104 {
17194 /* This window must be completely empty. */ 17105 /* This window must be completely empty. */
@@ -17196,15 +17107,15 @@ try_window_reusing_current_matrix (struct window *w)
17196 w->window_end_pos = Z - ZV; 17107 w->window_end_pos = Z - ZV;
17197 w->window_end_vpos = 0; 17108 w->window_end_vpos = 0;
17198 } 17109 }
17199 w->window_end_valid = 0; 17110 w->window_end_valid = false;
17200 17111
17201 /* Update hint: don't try scrolling again in update_window. */ 17112 /* Update hint: don't try scrolling again in update_window. */
17202 w->desired_matrix->no_scrolling_p = 1; 17113 w->desired_matrix->no_scrolling_p = true;
17203 17114
17204#ifdef GLYPH_DEBUG 17115#ifdef GLYPH_DEBUG
17205 debug_method_add (w, "try_window_reusing_current_matrix 1"); 17116 debug_method_add (w, "try_window_reusing_current_matrix 1");
17206#endif 17117#endif
17207 return 1; 17118 return true;
17208 } 17119 }
17209 else if (CHARPOS (new_start) > CHARPOS (start)) 17120 else if (CHARPOS (new_start) > CHARPOS (start))
17210 { 17121 {
@@ -17228,7 +17139,7 @@ try_window_reusing_current_matrix (struct window *w)
17228 || !first_reusable_row->enabled_p 17139 || !first_reusable_row->enabled_p
17229 || (MATRIX_ROW_START_CHARPOS (first_reusable_row) 17140 || (MATRIX_ROW_START_CHARPOS (first_reusable_row)
17230 != CHARPOS (new_start))) 17141 != CHARPOS (new_start)))
17231 return 0; 17142 return false;
17232 17143
17233 /* We can reuse fully visible rows beginning with 17144 /* We can reuse fully visible rows beginning with
17234 first_reusable_row to the end of the window. Set 17145 first_reusable_row to the end of the window. Set
@@ -17284,7 +17195,7 @@ try_window_reusing_current_matrix (struct window *w)
17284 if (w->cursor.vpos < 0) 17195 if (w->cursor.vpos < 0)
17285 { 17196 {
17286 clear_glyph_matrix (w->desired_matrix); 17197 clear_glyph_matrix (w->desired_matrix);
17287 return 0; 17198 return false;
17288 } 17199 }
17289 17200
17290 /* Scroll the display. */ 17201 /* Scroll the display. */
@@ -17299,7 +17210,7 @@ try_window_reusing_current_matrix (struct window *w)
17299 FRAME_RIF (f)->update_window_begin_hook (w); 17210 FRAME_RIF (f)->update_window_begin_hook (w);
17300 FRAME_RIF (f)->clear_window_mouse_face (w); 17211 FRAME_RIF (f)->clear_window_mouse_face (w);
17301 FRAME_RIF (f)->scroll_run_hook (w, &run); 17212 FRAME_RIF (f)->scroll_run_hook (w, &run);
17302 FRAME_RIF (f)->update_window_end_hook (w, 0, 0); 17213 FRAME_RIF (f)->update_window_end_hook (w, false, false);
17303 update_end (f); 17214 update_end (f);
17304 } 17215 }
17305 17216
@@ -17316,7 +17227,7 @@ try_window_reusing_current_matrix (struct window *w)
17316 if (row->y + row->height > max_y) 17227 if (row->y + row->height > max_y)
17317 row->visible_height -= row->y + row->height - max_y; 17228 row->visible_height -= row->y + row->height - max_y;
17318 if (row->fringe_bitmap_periodic_p) 17229 if (row->fringe_bitmap_periodic_p)
17319 row->redraw_fringe_bitmaps_p = 1; 17230 row->redraw_fringe_bitmaps_p = true;
17320 } 17231 }
17321 17232
17322 /* Scroll the current matrix. */ 17233 /* Scroll the current matrix. */
@@ -17355,7 +17266,7 @@ try_window_reusing_current_matrix (struct window *w)
17355 0, 0, 0, 0)) 17266 0, 0, 0, 0))
17356 { 17267 {
17357 clear_glyph_matrix (w->desired_matrix); 17268 clear_glyph_matrix (w->desired_matrix);
17358 return 0; 17269 return false;
17359 } 17270 }
17360 } 17271 }
17361 else 17272 else
@@ -17379,20 +17290,20 @@ try_window_reusing_current_matrix (struct window *w)
17379 the window end is in reused rows which in turn means that 17290 the window end is in reused rows which in turn means that
17380 only its vpos can have changed. */ 17291 only its vpos can have changed. */
17381 if (last_text_row) 17292 if (last_text_row)
17382 adjust_window_ends (w, last_text_row, 0); 17293 adjust_window_ends (w, last_text_row, false);
17383 else 17294 else
17384 w->window_end_vpos -= nrows_scrolled; 17295 w->window_end_vpos -= nrows_scrolled;
17385 17296
17386 w->window_end_valid = 0; 17297 w->window_end_valid = false;
17387 w->desired_matrix->no_scrolling_p = 1; 17298 w->desired_matrix->no_scrolling_p = true;
17388 17299
17389#ifdef GLYPH_DEBUG 17300#ifdef GLYPH_DEBUG
17390 debug_method_add (w, "try_window_reusing_current_matrix 2"); 17301 debug_method_add (w, "try_window_reusing_current_matrix 2");
17391#endif 17302#endif
17392 return 1; 17303 return true;
17393 } 17304 }
17394 17305
17395 return 0; 17306 return false;
17396} 17307}
17397 17308
17398 17309
@@ -17643,7 +17554,7 @@ row_containing_pos (struct window *w, ptrdiff_t charpos,
17643 17554
17644 last_y = window_text_bottom_y (w) - dy; 17555 last_y = window_text_bottom_y (w) - dy;
17645 17556
17646 while (1) 17557 while (true)
17647 { 17558 {
17648 /* Give up if we have gone too far. */ 17559 /* Give up if we have gone too far. */
17649 if (end && row >= end) 17560 if (end && row >= end)
@@ -17699,7 +17610,7 @@ row_containing_pos (struct window *w, ptrdiff_t charpos,
17699 17610
17700/* Try to redisplay window W by reusing its existing display. W's 17611/* Try to redisplay window W by reusing its existing display. W's
17701 current matrix must be up to date when this function is called, 17612 current matrix must be up to date when this function is called,
17702 i.e. window_end_valid must be nonzero. 17613 i.e., window_end_valid must be true.
17703 17614
17704 Value is 17615 Value is
17705 17616
@@ -17766,12 +17677,12 @@ try_window_id (struct window *w)
17766#endif 17677#endif
17767 17678
17768 /* This is handy for debugging. */ 17679 /* This is handy for debugging. */
17769#if 0 17680#if false
17770#define GIVE_UP(X) \ 17681#define GIVE_UP(X) \
17771 do { \ 17682 do { \
17772 fprintf (stderr, "try_window_id give up %d\n", (X)); \ 17683 fprintf (stderr, "try_window_id give up %d\n", (X)); \
17773 return 0; \ 17684 return 0; \
17774 } while (0) 17685 } while (false)
17775#else 17686#else
17776#define GIVE_UP(X) return 0 17687#define GIVE_UP(X) return 0
17777#endif 17688#endif
@@ -18012,7 +17923,7 @@ try_window_id (struct window *w)
18012 if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (last_unchanged_at_beg_row)) 17923 if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (last_unchanged_at_beg_row))
18013 GIVE_UP (17); 17924 GIVE_UP (17);
18014 17925
18015 if (init_to_row_end (&it, w, last_unchanged_at_beg_row) == 0) 17926 if (! init_to_row_end (&it, w, last_unchanged_at_beg_row))
18016 GIVE_UP (18); 17927 GIVE_UP (18);
18017 start_pos = it.current.pos; 17928 start_pos = it.current.pos;
18018 17929
@@ -18106,7 +18017,7 @@ try_window_id (struct window *w)
18106 line where the window_end_vpos is. */ 18017 line where the window_end_vpos is. */
18107 w->cursor.vpos = -1; 18018 w->cursor.vpos = -1;
18108 last_text_row = NULL; 18019 last_text_row = NULL;
18109 overlay_arrow_seen = 0; 18020 overlay_arrow_seen = false;
18110 if (it.current_y < it.last_visible_y 18021 if (it.current_y < it.last_visible_y
18111 && !f->fonts_changed 18022 && !f->fonts_changed
18112 && (first_unchanged_at_end_row == NULL 18023 && (first_unchanged_at_end_row == NULL
@@ -18242,7 +18153,7 @@ try_window_id (struct window *w)
18242 FRAME_RIF (f)->update_window_begin_hook (w); 18153 FRAME_RIF (f)->update_window_begin_hook (w);
18243 FRAME_RIF (f)->clear_window_mouse_face (w); 18154 FRAME_RIF (f)->clear_window_mouse_face (w);
18244 FRAME_RIF (f)->scroll_run_hook (w, &run); 18155 FRAME_RIF (f)->scroll_run_hook (w, &run);
18245 FRAME_RIF (f)->update_window_end_hook (w, 0, 0); 18156 FRAME_RIF (f)->update_window_end_hook (w, false, false);
18246 } 18157 }
18247 else 18158 else
18248 { 18159 {
@@ -18252,7 +18163,7 @@ try_window_id (struct window *w)
18252 = MATRIX_ROW_VPOS (first_unchanged_at_end_row, w->current_matrix); 18163 = MATRIX_ROW_VPOS (first_unchanged_at_end_row, w->current_matrix);
18253 int from = WINDOW_TOP_EDGE_LINE (w) + from_vpos; 18164 int from = WINDOW_TOP_EDGE_LINE (w) + from_vpos;
18254 int end = (WINDOW_TOP_EDGE_LINE (w) 18165 int end = (WINDOW_TOP_EDGE_LINE (w)
18255 + (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) 18166 + WINDOW_WANTS_HEADER_LINE_P (w)
18256 + window_internal_height (w)); 18167 + window_internal_height (w));
18257 18168
18258#if defined (HAVE_GPM) || defined (MSDOS) 18169#if defined (HAVE_GPM) || defined (MSDOS)
@@ -18388,7 +18299,7 @@ try_window_id (struct window *w)
18388 /* Is it always sure that the display agrees with lines in 18299 /* Is it always sure that the display agrees with lines in
18389 the current matrix? I don't think so, so we mark rows 18300 the current matrix? I don't think so, so we mark rows
18390 displayed invalid in the current matrix by setting their 18301 displayed invalid in the current matrix by setting their
18391 enabled_p flag to zero. */ 18302 enabled_p flag to false. */
18392 SET_MATRIX_ROW_ENABLED_P (w->current_matrix, it.vpos, false); 18303 SET_MATRIX_ROW_ENABLED_P (w->current_matrix, it.vpos, false);
18393 if (display_line (&it)) 18304 if (display_line (&it))
18394 last_text_row_at_end = it.glyph_row - 1; 18305 last_text_row_at_end = it.glyph_row - 1;
@@ -18406,13 +18317,13 @@ try_window_id (struct window *w)
18406 row = find_last_row_displaying_text (w->current_matrix, &it, 18317 row = find_last_row_displaying_text (w->current_matrix, &it,
18407 first_unchanged_at_end_row); 18318 first_unchanged_at_end_row);
18408 eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row)); 18319 eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row));
18409 adjust_window_ends (w, row, 1); 18320 adjust_window_ends (w, row, true);
18410 eassert (w->window_end_bytepos >= 0); 18321 eassert (w->window_end_bytepos >= 0);
18411 IF_DEBUG (debug_method_add (w, "A")); 18322 IF_DEBUG (debug_method_add (w, "A"));
18412 } 18323 }
18413 else if (last_text_row_at_end) 18324 else if (last_text_row_at_end)
18414 { 18325 {
18415 adjust_window_ends (w, last_text_row_at_end, 0); 18326 adjust_window_ends (w, last_text_row_at_end, false);
18416 eassert (w->window_end_bytepos >= 0); 18327 eassert (w->window_end_bytepos >= 0);
18417 IF_DEBUG (debug_method_add (w, "B")); 18328 IF_DEBUG (debug_method_add (w, "B"));
18418 } 18329 }
@@ -18421,7 +18332,7 @@ try_window_id (struct window *w)
18421 /* We have displayed either to the end of the window or at the 18332 /* We have displayed either to the end of the window or at the
18422 end of the window, i.e. the last row with text is to be found 18333 end of the window, i.e. the last row with text is to be found
18423 in the desired matrix. */ 18334 in the desired matrix. */
18424 adjust_window_ends (w, last_text_row, 0); 18335 adjust_window_ends (w, last_text_row, false);
18425 eassert (w->window_end_bytepos >= 0); 18336 eassert (w->window_end_bytepos >= 0);
18426 } 18337 }
18427 else if (first_unchanged_at_end_row == NULL 18338 else if (first_unchanged_at_end_row == NULL
@@ -18430,7 +18341,7 @@ try_window_id (struct window *w)
18430 { 18341 {
18431 /* Displayed to end of window, but no line containing text was 18342 /* Displayed to end of window, but no line containing text was
18432 displayed. Lines were deleted at the end of the window. */ 18343 displayed. Lines were deleted at the end of the window. */
18433 int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0; 18344 bool first_vpos = WINDOW_WANTS_HEADER_LINE_P (w);
18434 int vpos = w->window_end_vpos; 18345 int vpos = w->window_end_vpos;
18435 struct glyph_row *current_row = current_matrix->rows + vpos; 18346 struct glyph_row *current_row = current_matrix->rows + vpos;
18436 struct glyph_row *desired_row = desired_matrix->rows + vpos; 18347 struct glyph_row *desired_row = desired_matrix->rows + vpos;
@@ -18462,8 +18373,8 @@ try_window_id (struct window *w)
18462 debug_end_vpos = w->window_end_vpos)); 18373 debug_end_vpos = w->window_end_vpos));
18463 18374
18464 /* Record that display has not been completed. */ 18375 /* Record that display has not been completed. */
18465 w->window_end_valid = 0; 18376 w->window_end_valid = false;
18466 w->desired_matrix->no_scrolling_p = 1; 18377 w->desired_matrix->no_scrolling_p = true;
18467 return 3; 18378 return 3;
18468 18379
18469#undef GIVE_UP 18380#undef GIVE_UP
@@ -19156,7 +19067,7 @@ compute_line_metrics (struct it *it)
19156 19067
19157/* Append one space to the glyph row of iterator IT if doing a 19068/* Append one space to the glyph row of iterator IT if doing a
19158 window-based redisplay. The space has the same face as 19069 window-based redisplay. The space has the same face as
19159 IT->face_id. Value is non-zero if a space was added. 19070 IT->face_id. Value is true if a space was added.
19160 19071
19161 This function is called to make sure that there is always one glyph 19072 This function is called to make sure that there is always one glyph
19162 at the end of a glyph row that the cursor can be set on under 19073 at the end of a glyph row that the cursor can be set on under
@@ -19166,8 +19077,8 @@ compute_line_metrics (struct it *it)
19166 At the same time this space let's a nicely handle clearing to the 19077 At the same time this space let's a nicely handle clearing to the
19167 end of the line if the row ends in italic text. */ 19078 end of the line if the row ends in italic text. */
19168 19079
19169static int 19080static bool
19170append_space_for_newline (struct it *it, int default_face_p) 19081append_space_for_newline (struct it *it, bool default_face_p)
19171{ 19082{
19172 if (FRAME_WINDOW_P (it->f)) 19083 if (FRAME_WINDOW_P (it->f))
19173 { 19084 {
@@ -19185,7 +19096,7 @@ append_space_for_newline (struct it *it, int default_face_p)
19185 int saved_char_to_display = it->char_to_display; 19096 int saved_char_to_display = it->char_to_display;
19186 int saved_x = it->current_x; 19097 int saved_x = it->current_x;
19187 int saved_face_id = it->face_id; 19098 int saved_face_id = it->face_id;
19188 int saved_box_end = it->end_of_box_run_p; 19099 bool saved_box_end = it->end_of_box_run_p;
19189 struct text_pos saved_pos; 19100 struct text_pos saved_pos;
19190 Lisp_Object saved_object; 19101 Lisp_Object saved_object;
19191 struct face *face; 19102 struct face *face;
@@ -19216,12 +19127,12 @@ append_space_for_newline (struct it *it, int default_face_p)
19216 the end of the row, there will be no stretch glyph, 19127 the end of the row, there will be no stretch glyph,
19217 so leave the box flag set. */ 19128 so leave the box flag set. */
19218 && saved_x + FRAME_COLUMN_WIDTH (it->f) < it->last_visible_x) 19129 && saved_x + FRAME_COLUMN_WIDTH (it->f) < it->last_visible_x)
19219 it->end_of_box_run_p = 0; 19130 it->end_of_box_run_p = false;
19220 19131
19221 PRODUCE_GLYPHS (it); 19132 PRODUCE_GLYPHS (it);
19222 19133
19223 it->override_ascent = -1; 19134 it->override_ascent = -1;
19224 it->constrain_row_ascent_descent_p = 0; 19135 it->constrain_row_ascent_descent_p = false;
19225 it->current_x = saved_x; 19136 it->current_x = saved_x;
19226 it->object = saved_object; 19137 it->object = saved_object;
19227 it->position = saved_pos; 19138 it->position = saved_pos;
@@ -19231,11 +19142,11 @@ append_space_for_newline (struct it *it, int default_face_p)
19231 it->c = saved_c; 19142 it->c = saved_c;
19232 it->char_to_display = saved_char_to_display; 19143 it->char_to_display = saved_char_to_display;
19233 it->end_of_box_run_p = saved_box_end; 19144 it->end_of_box_run_p = saved_box_end;
19234 return 1; 19145 return true;
19235 } 19146 }
19236 } 19147 }
19237 19148
19238 return 0; 19149 return false;
19239} 19150}
19240 19151
19241 19152
@@ -19290,7 +19201,7 @@ extend_face_to_end_of_line (struct it *it)
19290 19201
19291 /* Set the glyph row flag indicating that the face of the last glyph 19202 /* Set the glyph row flag indicating that the face of the last glyph
19292 in the text area has to be drawn to the end of the text area. */ 19203 in the text area has to be drawn to the end of the text area. */
19293 it->glyph_row->fill_line_p = 1; 19204 it->glyph_row->fill_line_p = true;
19294 19205
19295 /* If current character of IT is not ASCII, make sure we have the 19206 /* If current character of IT is not ASCII, make sure we have the
19296 ASCII face. This will be automatically undone the next time 19207 ASCII face. This will be automatically undone the next time
@@ -19352,7 +19263,8 @@ extend_face_to_end_of_line (struct it *it)
19352 struct glyph *g; 19263 struct glyph *g;
19353 int row_width, stretch_ascent, stretch_width; 19264 int row_width, stretch_ascent, stretch_width;
19354 struct text_pos saved_pos; 19265 struct text_pos saved_pos;
19355 int saved_face_id, saved_avoid_cursor, saved_box_start; 19266 int saved_face_id;
19267 bool saved_avoid_cursor, saved_box_start;
19356 19268
19357 for (row_width = 0, g = row_start; g < row_end; g++) 19269 for (row_width = 0, g = row_start; g < row_end; g++)
19358 row_width += g->pixel_width; 19270 row_width += g->pixel_width;
@@ -19376,7 +19288,7 @@ extend_face_to_end_of_line (struct it *it)
19376 saved_pos = it->position; 19288 saved_pos = it->position;
19377 memset (&it->position, 0, sizeof it->position); 19289 memset (&it->position, 0, sizeof it->position);
19378 saved_avoid_cursor = it->avoid_cursor_p; 19290 saved_avoid_cursor = it->avoid_cursor_p;
19379 it->avoid_cursor_p = 1; 19291 it->avoid_cursor_p = true;
19380 saved_face_id = it->face_id; 19292 saved_face_id = it->face_id;
19381 saved_box_start = it->start_of_box_run_p; 19293 saved_box_start = it->start_of_box_run_p;
19382 /* The last row's stretch glyph should get the default 19294 /* The last row's stretch glyph should get the default
@@ -19386,7 +19298,7 @@ extend_face_to_end_of_line (struct it *it)
19386 it->face_id = default_face->id; 19298 it->face_id = default_face->id;
19387 else 19299 else
19388 it->face_id = face->id; 19300 it->face_id = face->id;
19389 it->start_of_box_run_p = 0; 19301 it->start_of_box_run_p = false;
19390 append_stretch_glyph (it, Qnil, stretch_width, 19302 append_stretch_glyph (it, Qnil, stretch_width,
19391 it->ascent + it->descent, stretch_ascent); 19303 it->ascent + it->descent, stretch_ascent);
19392 it->position = saved_pos; 19304 it->position = saved_pos;
@@ -19495,10 +19407,10 @@ extend_face_to_end_of_line (struct it *it)
19495} 19407}
19496 19408
19497 19409
19498/* Value is non-zero if text starting at CHARPOS in current_buffer is 19410/* Value is true if text starting at CHARPOS in current_buffer is
19499 trailing whitespace. */ 19411 trailing whitespace. */
19500 19412
19501static int 19413static bool
19502trailing_whitespace_p (ptrdiff_t charpos) 19414trailing_whitespace_p (ptrdiff_t charpos)
19503{ 19415{
19504 ptrdiff_t bytepos = CHAR_TO_BYTE (charpos); 19416 ptrdiff_t bytepos = CHAR_TO_BYTE (charpos);
@@ -19512,9 +19424,9 @@ trailing_whitespace_p (ptrdiff_t charpos)
19512 if (bytepos >= ZV_BYTE || c == '\n' || c == '\r') 19424 if (bytepos >= ZV_BYTE || c == '\n' || c == '\r')
19513 { 19425 {
19514 if (bytepos != PT_BYTE) 19426 if (bytepos != PT_BYTE)
19515 return 1; 19427 return true;
19516 } 19428 }
19517 return 0; 19429 return false;
19518} 19430}
19519 19431
19520 19432
@@ -19594,13 +19506,13 @@ highlight_trailing_whitespace (struct frame *f, struct glyph_row *row)
19594} 19506}
19595 19507
19596 19508
19597/* Value is non-zero if glyph row ROW should be 19509/* Value is true if glyph row ROW should be
19598 considered to hold the buffer position CHARPOS. */ 19510 considered to hold the buffer position CHARPOS. */
19599 19511
19600static int 19512static bool
19601row_for_charpos_p (struct glyph_row *row, ptrdiff_t charpos) 19513row_for_charpos_p (struct glyph_row *row, ptrdiff_t charpos)
19602{ 19514{
19603 int result = 1; 19515 bool result = true;
19604 19516
19605 if (charpos == CHARPOS (row->end.pos) 19517 if (charpos == CHARPOS (row->end.pos)
19606 || charpos == MATRIX_ROW_END_CHARPOS (row)) 19518 || charpos == MATRIX_ROW_END_CHARPOS (row))
@@ -19616,7 +19528,7 @@ row_for_charpos_p (struct glyph_row *row, ptrdiff_t charpos)
19616 if (CHARPOS (row->end.string_pos) >= 0) 19528 if (CHARPOS (row->end.string_pos) >= 0)
19617 { 19529 {
19618 if (row->continued_p) 19530 if (row->continued_p)
19619 result = 1; 19531 result = true;
19620 else 19532 else
19621 { 19533 {
19622 /* Check for `display' property. */ 19534 /* Check for `display' property. */
@@ -19624,7 +19536,7 @@ row_for_charpos_p (struct glyph_row *row, ptrdiff_t charpos)
19624 struct glyph *end = beg + row->used[TEXT_AREA] - 1; 19536 struct glyph *end = beg + row->used[TEXT_AREA] - 1;
19625 struct glyph *glyph; 19537 struct glyph *glyph;
19626 19538
19627 result = 0; 19539 result = false;
19628 for (glyph = end; glyph >= beg; --glyph) 19540 for (glyph = end; glyph >= beg; --glyph)
19629 if (STRINGP (glyph->object)) 19541 if (STRINGP (glyph->object))
19630 { 19542 {
@@ -19648,7 +19560,7 @@ row_for_charpos_p (struct glyph_row *row, ptrdiff_t charpos)
19648 if (!NILP (Fget_char_property (make_number (gpos), 19560 if (!NILP (Fget_char_property (make_number (gpos),
19649 Qcursor, s))) 19561 Qcursor, s)))
19650 { 19562 {
19651 result = 1; 19563 result = true;
19652 break; 19564 break;
19653 } 19565 }
19654 } 19566 }
@@ -19670,23 +19582,21 @@ row_for_charpos_p (struct glyph_row *row, ptrdiff_t charpos)
19670 CHARPOS (ROW->end.pos) will equal point after the 19582 CHARPOS (ROW->end.pos) will equal point after the
19671 invisible text. We want that position to be displayed 19583 invisible text. We want that position to be displayed
19672 after the ellipsis. */ 19584 after the ellipsis. */
19673 result = 0; 19585 result = false;
19674 } 19586 }
19675 /* If the row ends at ZV, display the cursor at the end of that 19587 /* If the row ends at ZV, display the cursor at the end of that
19676 row instead of at the start of the row below. */ 19588 row instead of at the start of the row below. */
19677 else if (row->ends_at_zv_p)
19678 result = 1;
19679 else 19589 else
19680 result = 0; 19590 result = row->ends_at_zv_p;
19681 } 19591 }
19682 19592
19683 return result; 19593 return result;
19684} 19594}
19685 19595
19686/* Value is non-zero if glyph row ROW should be 19596/* Value is true if glyph row ROW should be
19687 used to hold the cursor. */ 19597 used to hold the cursor. */
19688 19598
19689static int 19599static bool
19690cursor_row_p (struct glyph_row *row) 19600cursor_row_p (struct glyph_row *row)
19691{ 19601{
19692 return row_for_charpos_p (row, PT); 19602 return row_for_charpos_p (row, PT);
@@ -19695,11 +19605,11 @@ cursor_row_p (struct glyph_row *row)
19695 19605
19696 19606
19697/* Push the property PROP so that it will be rendered at the current 19607/* Push the property PROP so that it will be rendered at the current
19698 position in IT. Return 1 if PROP was successfully pushed, 0 19608 position in IT. Return true if PROP was successfully pushed, false
19699 otherwise. Called from handle_line_prefix to handle the 19609 otherwise. Called from handle_line_prefix to handle the
19700 `line-prefix' and `wrap-prefix' properties. */ 19610 `line-prefix' and `wrap-prefix' properties. */
19701 19611
19702static int 19612static bool
19703push_prefix_prop (struct it *it, Lisp_Object prop) 19613push_prefix_prop (struct it *it, Lisp_Object prop)
19704{ 19614{
19705 struct text_pos pos = 19615 struct text_pos pos =
@@ -19720,11 +19630,11 @@ push_prefix_prop (struct it *it, Lisp_Object prop)
19720 if (SCHARS (prop) == 0) 19630 if (SCHARS (prop) == 0)
19721 { 19631 {
19722 pop_it (it); 19632 pop_it (it);
19723 return 0; 19633 return false;
19724 } 19634 }
19725 19635
19726 it->string = prop; 19636 it->string = prop;
19727 it->string_from_prefix_prop_p = 1; 19637 it->string_from_prefix_prop_p = true;
19728 it->multibyte_p = STRING_MULTIBYTE (it->string); 19638 it->multibyte_p = STRING_MULTIBYTE (it->string);
19729 it->current.overlay_string_index = -1; 19639 it->current.overlay_string_index = -1;
19730 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; 19640 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0;
@@ -19770,10 +19680,10 @@ push_prefix_prop (struct it *it, Lisp_Object prop)
19770 else 19680 else
19771 { 19681 {
19772 pop_it (it); /* bogus display property, give up */ 19682 pop_it (it); /* bogus display property, give up */
19773 return 0; 19683 return false;
19774 } 19684 }
19775 19685
19776 return 1; 19686 return true;
19777} 19687}
19778 19688
19779/* Return the character-property PROP at the current position in IT. */ 19689/* Return the character-property PROP at the current position in IT. */
@@ -19821,7 +19731,7 @@ handle_line_prefix (struct it *it)
19821 it, it would acquire its own wrap prefix, and so on till the 19731 it, it would acquire its own wrap prefix, and so on till the
19822 iterator stack overflows. So, don't wrap the prefix. */ 19732 iterator stack overflows. So, don't wrap the prefix. */
19823 it->line_wrap = TRUNCATE; 19733 it->line_wrap = TRUNCATE;
19824 it->avoid_cursor_p = 1; 19734 it->avoid_cursor_p = true;
19825 } 19735 }
19826} 19736}
19827 19737
@@ -19894,7 +19804,7 @@ find_row_edges (struct it *it, struct glyph_row *row,
19894 row->maxpos = it->current.pos; 19804 row->maxpos = it->current.pos;
19895 else if (row->used[TEXT_AREA]) 19805 else if (row->used[TEXT_AREA])
19896 { 19806 {
19897 int seen_this_string = 0; 19807 bool seen_this_string = false;
19898 struct glyph_row *r1 = row - 1; 19808 struct glyph_row *r1 = row - 1;
19899 19809
19900 /* Did we see the same display string on the previous row? */ 19810 /* Did we see the same display string on the previous row? */
@@ -19924,7 +19834,7 @@ find_row_edges (struct it *it, struct glyph_row *row,
19924 if (end > start) 19834 if (end > start)
19925 { 19835 {
19926 if (EQ ((end - 1)->object, it->object)) 19836 if (EQ ((end - 1)->object, it->object))
19927 seen_this_string = 1; 19837 seen_this_string = true;
19928 } 19838 }
19929 else 19839 else
19930 /* If all the glyphs of the previous row were inserted 19840 /* If all the glyphs of the previous row were inserted
@@ -19932,7 +19842,7 @@ find_row_edges (struct it *it, struct glyph_row *row,
19932 produced from a single newline, which is only 19842 produced from a single newline, which is only
19933 possible if that newline came from the same string 19843 possible if that newline came from the same string
19934 as the one which produced this ROW. */ 19844 as the one which produced this ROW. */
19935 seen_this_string = 1; 19845 seen_this_string = true;
19936 } 19846 }
19937 else 19847 else
19938 { 19848 {
@@ -19945,10 +19855,10 @@ find_row_edges (struct it *it, struct glyph_row *row,
19945 if (end < start) 19855 if (end < start)
19946 { 19856 {
19947 if (EQ ((end + 1)->object, it->object)) 19857 if (EQ ((end + 1)->object, it->object))
19948 seen_this_string = 1; 19858 seen_this_string = true;
19949 } 19859 }
19950 else 19860 else
19951 seen_this_string = 1; 19861 seen_this_string = true;
19952 } 19862 }
19953 } 19863 }
19954 /* Take note of each display string that covers a newline only 19864 /* Take note of each display string that covers a newline only
@@ -20004,18 +19914,19 @@ find_row_edges (struct it *it, struct glyph_row *row,
20004 19914
20005/* Construct the glyph row IT->glyph_row in the desired matrix of 19915/* Construct the glyph row IT->glyph_row in the desired matrix of
20006 IT->w from text at the current position of IT. See dispextern.h 19916 IT->w from text at the current position of IT. See dispextern.h
20007 for an overview of struct it. Value is non-zero if 19917 for an overview of struct it. Value is true if
20008 IT->glyph_row displays text, as opposed to a line displaying ZV 19918 IT->glyph_row displays text, as opposed to a line displaying ZV
20009 only. */ 19919 only. */
20010 19920
20011static int 19921static bool
20012display_line (struct it *it) 19922display_line (struct it *it)
20013{ 19923{
20014 struct glyph_row *row = it->glyph_row; 19924 struct glyph_row *row = it->glyph_row;
20015 Lisp_Object overlay_arrow_string; 19925 Lisp_Object overlay_arrow_string;
20016 struct it wrap_it; 19926 struct it wrap_it;
20017 void *wrap_data = NULL; 19927 void *wrap_data = NULL;
20018 int may_wrap = 0, wrap_x IF_LINT (= 0); 19928 bool may_wrap = false;
19929 int wrap_x IF_LINT (= 0);
20019 int wrap_row_used = -1; 19930 int wrap_row_used = -1;
20020 int wrap_row_ascent IF_LINT (= 0), wrap_row_height IF_LINT (= 0); 19931 int wrap_row_ascent IF_LINT (= 0), wrap_row_height IF_LINT (= 0);
20021 int wrap_row_phys_ascent IF_LINT (= 0), wrap_row_phys_height IF_LINT (= 0); 19932 int wrap_row_phys_ascent IF_LINT (= 0), wrap_row_phys_height IF_LINT (= 0);
@@ -20034,8 +19945,8 @@ display_line (struct it *it)
20034 >= it->w->desired_matrix->nrows) 19945 >= it->w->desired_matrix->nrows)
20035 { 19946 {
20036 it->w->nrows_scale_factor++; 19947 it->w->nrows_scale_factor++;
20037 it->f->fonts_changed = 1; 19948 it->f->fonts_changed = true;
20038 return 0; 19949 return false;
20039 } 19950 }
20040 19951
20041 /* Clear the result glyph row and enable it. */ 19952 /* Clear the result glyph row and enable it. */
@@ -20044,9 +19955,9 @@ display_line (struct it *it)
20044 row->y = it->current_y; 19955 row->y = it->current_y;
20045 row->start = it->start; 19956 row->start = it->start;
20046 row->continuation_lines_width = it->continuation_lines_width; 19957 row->continuation_lines_width = it->continuation_lines_width;
20047 row->displays_text_p = 1; 19958 row->displays_text_p = true;
20048 row->starts_in_middle_of_char_p = it->starts_in_middle_of_char_p; 19959 row->starts_in_middle_of_char_p = it->starts_in_middle_of_char_p;
20049 it->starts_in_middle_of_char_p = 0; 19960 it->starts_in_middle_of_char_p = false;
20050 19961
20051 /* Arrange the overlays nicely for our purposes. Usually, we call 19962 /* Arrange the overlays nicely for our purposes. Usually, we call
20052 display_line on only one line at a time, in which case this 19963 display_line on only one line at a time, in which case this
@@ -20116,8 +20027,8 @@ display_line (struct it *it)
20116#define RECORD_MAX_MIN_POS(IT) \ 20027#define RECORD_MAX_MIN_POS(IT) \
20117 do \ 20028 do \
20118 { \ 20029 { \
20119 int composition_p = !STRINGP ((IT)->string) \ 20030 bool composition_p \
20120 && ((IT)->what == IT_COMPOSITION); \ 20031 = !STRINGP ((IT)->string) && ((IT)->what == IT_COMPOSITION); \
20121 ptrdiff_t current_pos = \ 20032 ptrdiff_t current_pos = \
20122 composition_p ? (IT)->cmp_it.charpos \ 20033 composition_p ? (IT)->cmp_it.charpos \
20123 : IT_CHARPOS (*(IT)); \ 20034 : IT_CHARPOS (*(IT)); \
@@ -20135,17 +20046,17 @@ display_line (struct it *it)
20135 max_bpos = IT_BYTEPOS (*it); \ 20046 max_bpos = IT_BYTEPOS (*it); \
20136 } \ 20047 } \
20137 } \ 20048 } \
20138 while (0) 20049 while (false)
20139 20050
20140 /* Loop generating characters. The loop is left with IT on the next 20051 /* Loop generating characters. The loop is left with IT on the next
20141 character to display. */ 20052 character to display. */
20142 while (1) 20053 while (true)
20143 { 20054 {
20144 int n_glyphs_before, hpos_before, x_before; 20055 int n_glyphs_before, hpos_before, x_before;
20145 int x, nglyphs; 20056 int x, nglyphs;
20146 int ascent = 0, descent = 0, phys_ascent = 0, phys_descent = 0; 20057 int ascent = 0, descent = 0, phys_ascent = 0, phys_descent = 0;
20147 20058
20148 /* Retrieve the next thing to display. Value is zero if end of 20059 /* Retrieve the next thing to display. Value is false if end of
20149 buffer reached. */ 20060 buffer reached. */
20150 if (!get_next_display_element (it)) 20061 if (!get_next_display_element (it))
20151 { 20062 {
@@ -20154,21 +20065,22 @@ display_line (struct it *it)
20154 first glyph of blank lines not corresponding to any text 20065 first glyph of blank lines not corresponding to any text
20155 to -1. */ 20066 to -1. */
20156 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) 20067 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
20157 row->exact_window_width_line_p = 1; 20068 row->exact_window_width_line_p = true;
20158 else if ((append_space_for_newline (it, 1) && row->used[TEXT_AREA] == 1) 20069 else if ((append_space_for_newline (it, true)
20070 && row->used[TEXT_AREA] == 1)
20159 || row->used[TEXT_AREA] == 0) 20071 || row->used[TEXT_AREA] == 0)
20160 { 20072 {
20161 row->glyphs[TEXT_AREA]->charpos = -1; 20073 row->glyphs[TEXT_AREA]->charpos = -1;
20162 row->displays_text_p = 0; 20074 row->displays_text_p = false;
20163 20075
20164 if (!NILP (BVAR (XBUFFER (it->w->contents), indicate_empty_lines)) 20076 if (!NILP (BVAR (XBUFFER (it->w->contents), indicate_empty_lines))
20165 && (!MINI_WINDOW_P (it->w) 20077 && (!MINI_WINDOW_P (it->w)
20166 || (minibuf_level && EQ (it->window, minibuf_window)))) 20078 || (minibuf_level && EQ (it->window, minibuf_window))))
20167 row->indicate_empty_line_p = 1; 20079 row->indicate_empty_line_p = true;
20168 } 20080 }
20169 20081
20170 it->continuation_lines_width = 0; 20082 it->continuation_lines_width = 0;
20171 row->ends_at_zv_p = 1; 20083 row->ends_at_zv_p = true;
20172 /* A row that displays right-to-left text must always have 20084 /* A row that displays right-to-left text must always have
20173 its last face extended all the way to the end of line, 20085 its last face extended all the way to the end of line,
20174 even if this row ends in ZV, because we still write to 20086 even if this row ends in ZV, because we still write to
@@ -20200,7 +20112,7 @@ display_line (struct it *it)
20200 if (it->line_wrap == WORD_WRAP && it->area == TEXT_AREA) 20112 if (it->line_wrap == WORD_WRAP && it->area == TEXT_AREA)
20201 { 20113 {
20202 if (IT_DISPLAYING_WHITESPACE (it)) 20114 if (IT_DISPLAYING_WHITESPACE (it))
20203 may_wrap = 1; 20115 may_wrap = true;
20204 else if (may_wrap) 20116 else if (may_wrap)
20205 { 20117 {
20206 SAVE_IT (wrap_it, *it, wrap_data); 20118 SAVE_IT (wrap_it, *it, wrap_data);
@@ -20215,7 +20127,7 @@ display_line (struct it *it)
20215 wrap_row_min_bpos = min_bpos; 20127 wrap_row_min_bpos = min_bpos;
20216 wrap_row_max_pos = max_pos; 20128 wrap_row_max_pos = max_pos;
20217 wrap_row_max_bpos = max_bpos; 20129 wrap_row_max_bpos = max_bpos;
20218 may_wrap = 0; 20130 may_wrap = false;
20219 } 20131 }
20220 } 20132 }
20221 } 20133 }
@@ -20233,7 +20145,7 @@ display_line (struct it *it)
20233 it->max_phys_ascent + it->max_phys_descent); 20145 it->max_phys_ascent + it->max_phys_descent);
20234 row->extra_line_spacing = max (row->extra_line_spacing, 20146 row->extra_line_spacing = max (row->extra_line_spacing,
20235 it->max_extra_line_spacing); 20147 it->max_extra_line_spacing);
20236 set_iterator_to_next (it, 1); 20148 set_iterator_to_next (it, true);
20237 /* If we didn't handle the line/wrap prefix above, and the 20149 /* If we didn't handle the line/wrap prefix above, and the
20238 call to set_iterator_to_next just switched to TEXT_AREA, 20150 call to set_iterator_to_next just switched to TEXT_AREA,
20239 process the prefix now. */ 20151 process the prefix now. */
@@ -20323,7 +20235,7 @@ display_line (struct it *it)
20323 fits exactly on the line. We must continue 20235 fits exactly on the line. We must continue
20324 the line because we can't draw the cursor 20236 the line because we can't draw the cursor
20325 after the glyph. */ 20237 after the glyph. */
20326 row->continued_p = 1; 20238 row->continued_p = true;
20327 it->current_x = new_x; 20239 it->current_x = new_x;
20328 it->continuation_lines_width += new_x; 20240 it->continuation_lines_width += new_x;
20329 ++it->hpos; 20241 ++it->hpos;
@@ -20347,20 +20259,20 @@ display_line (struct it *it)
20347 displayed by this row. */ 20259 displayed by this row. */
20348 if (it->bidi_p) 20260 if (it->bidi_p)
20349 RECORD_MAX_MIN_POS (it); 20261 RECORD_MAX_MIN_POS (it);
20350 set_iterator_to_next (it, 1); 20262 set_iterator_to_next (it, true);
20351 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) 20263 if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
20352 { 20264 {
20353 if (!get_next_display_element (it)) 20265 if (!get_next_display_element (it))
20354 { 20266 {
20355 row->exact_window_width_line_p = 1; 20267 row->exact_window_width_line_p = true;
20356 it->continuation_lines_width = 0; 20268 it->continuation_lines_width = 0;
20357 row->continued_p = 0; 20269 row->continued_p = false;
20358 row->ends_at_zv_p = 1; 20270 row->ends_at_zv_p = true;
20359 } 20271 }
20360 else if (ITERATOR_AT_END_OF_LINE_P (it)) 20272 else if (ITERATOR_AT_END_OF_LINE_P (it))
20361 { 20273 {
20362 row->continued_p = 0; 20274 row->continued_p = false;
20363 row->exact_window_width_line_p = 1; 20275 row->exact_window_width_line_p = true;
20364 } 20276 }
20365 /* If line-wrap is on, check if a 20277 /* If line-wrap is on, check if a
20366 previous wrap point was found. */ 20278 previous wrap point was found. */
@@ -20399,7 +20311,7 @@ display_line (struct it *it)
20399 < row->glyphs[1 + TEXT_AREA]) 20311 < row->glyphs[1 + TEXT_AREA])
20400 produce_special_glyphs (it, IT_CONTINUATION); 20312 produce_special_glyphs (it, IT_CONTINUATION);
20401 20313
20402 row->continued_p = 1; 20314 row->continued_p = true;
20403 it->current_x = x_before; 20315 it->current_x = x_before;
20404 it->continuation_lines_width += x_before; 20316 it->continuation_lines_width += x_before;
20405 20317
@@ -20431,9 +20343,9 @@ display_line (struct it *it)
20431 min_bpos = wrap_row_min_bpos; 20343 min_bpos = wrap_row_min_bpos;
20432 max_pos = wrap_row_max_pos; 20344 max_pos = wrap_row_max_pos;
20433 max_bpos = wrap_row_max_bpos; 20345 max_bpos = wrap_row_max_bpos;
20434 row->continued_p = 1; 20346 row->continued_p = true;
20435 row->ends_at_zv_p = 0; 20347 row->ends_at_zv_p = false;
20436 row->exact_window_width_line_p = 0; 20348 row->exact_window_width_line_p = false;
20437 it->continuation_lines_width += x; 20349 it->continuation_lines_width += x;
20438 20350
20439 /* Make sure that a non-default face is extended 20351 /* Make sure that a non-default face is extended
@@ -20452,10 +20364,10 @@ display_line (struct it *it)
20452 : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) == 0) 20364 : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) == 0)
20453 produce_special_glyphs (it, IT_CONTINUATION); 20365 produce_special_glyphs (it, IT_CONTINUATION);
20454 it->continuation_lines_width += it->last_visible_x; 20366 it->continuation_lines_width += it->last_visible_x;
20455 row->ends_in_middle_of_char_p = 1; 20367 row->ends_in_middle_of_char_p = true;
20456 row->continued_p = 1; 20368 row->continued_p = true;
20457 glyph->pixel_width = it->last_visible_x - x; 20369 glyph->pixel_width = it->last_visible_x - x;
20458 it->starts_in_middle_of_char_p = 1; 20370 it->starts_in_middle_of_char_p = true;
20459 if (WINDOW_LEFT_MARGIN_WIDTH (it->w) > 0 20371 if (WINDOW_LEFT_MARGIN_WIDTH (it->w) > 0
20460 || WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0) 20372 || WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0)
20461 extend_face_to_end_of_line (it); 20373 extend_face_to_end_of_line (it);
@@ -20478,14 +20390,14 @@ display_line (struct it *it)
20478 ? WINDOW_LEFT_FRINGE_WIDTH (it->w) 20390 ? WINDOW_LEFT_FRINGE_WIDTH (it->w)
20479 : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) == 0) 20391 : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) == 0)
20480 produce_special_glyphs (it, IT_CONTINUATION); 20392 produce_special_glyphs (it, IT_CONTINUATION);
20481 row->continued_p = 1; 20393 row->continued_p = true;
20482 20394
20483 extend_face_to_end_of_line (it); 20395 extend_face_to_end_of_line (it);
20484 20396
20485 if (nglyphs > 1 && i > 0) 20397 if (nglyphs > 1 && i > 0)
20486 { 20398 {
20487 row->ends_in_middle_of_char_p = 1; 20399 row->ends_in_middle_of_char_p = true;
20488 it->starts_in_middle_of_char_p = 1; 20400 it->starts_in_middle_of_char_p = true;
20489 } 20401 }
20490 20402
20491 /* Restore the height to what it was before the 20403 /* Restore the height to what it was before the
@@ -20573,7 +20485,7 @@ display_line (struct it *it)
20573 /* Add a space at the end of the line that is used to 20485 /* Add a space at the end of the line that is used to
20574 display the cursor there. */ 20486 display the cursor there. */
20575 if (!IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) 20487 if (!IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
20576 append_space_for_newline (it, 0); 20488 append_space_for_newline (it, false);
20577 20489
20578 /* Extend the face to the end of the line. */ 20490 /* Extend the face to the end of the line. */
20579 extend_face_to_end_of_line (it); 20491 extend_face_to_end_of_line (it);
@@ -20587,14 +20499,14 @@ display_line (struct it *it)
20587 it->eol_pos = it->current.pos; 20499 it->eol_pos = it->current.pos;
20588 20500
20589 /* Consume the line end. This skips over invisible lines. */ 20501 /* Consume the line end. This skips over invisible lines. */
20590 set_iterator_to_next (it, 1); 20502 set_iterator_to_next (it, true);
20591 it->continuation_lines_width = 0; 20503 it->continuation_lines_width = 0;
20592 break; 20504 break;
20593 } 20505 }
20594 20506
20595 /* Proceed with next display element. Note that this skips 20507 /* Proceed with next display element. Note that this skips
20596 over lines invisible because of selective display. */ 20508 over lines invisible because of selective display. */
20597 set_iterator_to_next (it, 1); 20509 set_iterator_to_next (it, true);
20598 20510
20599 /* If we truncate lines, we are done when the last displayed 20511 /* If we truncate lines, we are done when the last displayed
20600 glyphs reach past the right margin of the window. */ 20512 glyphs reach past the right margin of the window. */
@@ -20668,22 +20580,22 @@ display_line (struct it *it)
20668 if (!get_next_display_element (it)) 20580 if (!get_next_display_element (it))
20669 { 20581 {
20670 it->continuation_lines_width = 0; 20582 it->continuation_lines_width = 0;
20671 row->ends_at_zv_p = 1; 20583 row->ends_at_zv_p = true;
20672 row->exact_window_width_line_p = 1; 20584 row->exact_window_width_line_p = true;
20673 break; 20585 break;
20674 } 20586 }
20675 if (ITERATOR_AT_END_OF_LINE_P (it)) 20587 if (ITERATOR_AT_END_OF_LINE_P (it))
20676 { 20588 {
20677 row->exact_window_width_line_p = 1; 20589 row->exact_window_width_line_p = true;
20678 goto at_end_of_line; 20590 goto at_end_of_line;
20679 } 20591 }
20680 it->current_x = x_before; 20592 it->current_x = x_before;
20681 it->hpos = hpos_before; 20593 it->hpos = hpos_before;
20682 } 20594 }
20683 20595
20684 row->truncated_on_right_p = 1; 20596 row->truncated_on_right_p = true;
20685 it->continuation_lines_width = 0; 20597 it->continuation_lines_width = 0;
20686 reseat_at_next_visible_line_start (it, 0); 20598 reseat_at_next_visible_line_start (it, false);
20687 /* We insist below that IT's position be at ZV because in 20599 /* We insist below that IT's position be at ZV because in
20688 bidi-reordered lines the character at visible line start 20600 bidi-reordered lines the character at visible line start
20689 might not be the character that follows the newline in 20601 might not be the character that follows the newline in
@@ -20698,7 +20610,7 @@ display_line (struct it *it)
20698 } 20610 }
20699 20611
20700 if (wrap_data) 20612 if (wrap_data)
20701 bidi_unshelve_cache (wrap_data, 1); 20613 bidi_unshelve_cache (wrap_data, true);
20702 20614
20703 /* If line is not empty and hscrolled, maybe insert truncation glyphs 20615 /* If line is not empty and hscrolled, maybe insert truncation glyphs
20704 at the left window margin. */ 20616 at the left window margin. */
@@ -20713,7 +20625,7 @@ display_line (struct it *it)
20713 first glyph of the row if it is an image. */ 20625 first glyph of the row if it is an image. */
20714 && row->glyphs[TEXT_AREA]->type != IMAGE_GLYPH)) 20626 && row->glyphs[TEXT_AREA]->type != IMAGE_GLYPH))
20715 insert_left_trunc_glyphs (it); 20627 insert_left_trunc_glyphs (it);
20716 row->truncated_on_left_p = 1; 20628 row->truncated_on_left_p = true;
20717 } 20629 }
20718 20630
20719 /* Remember the position at which this line ends. 20631 /* Remember the position at which this line ends.
@@ -20775,7 +20687,7 @@ display_line (struct it *it)
20775 eassert (INTEGERP (overlay_arrow_string)); 20687 eassert (INTEGERP (overlay_arrow_string));
20776 row->overlay_arrow_bitmap = XINT (overlay_arrow_string); 20688 row->overlay_arrow_bitmap = XINT (overlay_arrow_string);
20777 } 20689 }
20778 overlay_arrow_seen = 1; 20690 overlay_arrow_seen = true;
20779 } 20691 }
20780 20692
20781 /* Highlight trailing whitespace. */ 20693 /* Highlight trailing whitespace. */
@@ -20915,14 +20827,14 @@ See also `bidi-paragraph-direction'. */)
20915 itb.string.s = NULL; 20827 itb.string.s = NULL;
20916 itb.string.lstring = Qnil; 20828 itb.string.lstring = Qnil;
20917 itb.string.bufpos = 0; 20829 itb.string.bufpos = 0;
20918 itb.string.from_disp_str = 0; 20830 itb.string.from_disp_str = false;
20919 itb.string.unibyte = 0; 20831 itb.string.unibyte = false;
20920 /* We have no window to use here for ignoring window-specific 20832 /* We have no window to use here for ignoring window-specific
20921 overlays. Using NULL for window pointer will cause 20833 overlays. Using NULL for window pointer will cause
20922 compute_display_string_pos to use the current buffer. */ 20834 compute_display_string_pos to use the current buffer. */
20923 itb.w = NULL; 20835 itb.w = NULL;
20924 bidi_paragraph_init (NEUTRAL_DIR, &itb, 1); 20836 bidi_paragraph_init (NEUTRAL_DIR, &itb, true);
20925 bidi_unshelve_cache (itb_data, 0); 20837 bidi_unshelve_cache (itb_data, false);
20926 set_buffer_temp (old); 20838 set_buffer_temp (old);
20927 switch (itb.paragraph_dir) 20839 switch (itb.paragraph_dir)
20928 { 20840 {
@@ -21010,8 +20922,8 @@ the `bidi-class' property of a character. */)
21010 itb.string.s = NULL; 20922 itb.string.s = NULL;
21011 itb.string.schars = SCHARS (object); 20923 itb.string.schars = SCHARS (object);
21012 itb.string.bufpos = 0; 20924 itb.string.bufpos = 0;
21013 itb.string.from_disp_str = 0; 20925 itb.string.from_disp_str = false;
21014 itb.string.unibyte = 0; 20926 itb.string.unibyte = false;
21015 itb.w = w; 20927 itb.w = w;
21016 bidi_init_it (0, 0, frame_window_p, &itb); 20928 bidi_init_it (0, 0, frame_window_p, &itb);
21017 } 20929 }
@@ -21054,8 +20966,8 @@ the `bidi-class' property of a character. */)
21054 itb.string.s = NULL; 20966 itb.string.s = NULL;
21055 itb.string.lstring = Qnil; 20967 itb.string.lstring = Qnil;
21056 itb.string.bufpos = 0; 20968 itb.string.bufpos = 0;
21057 itb.string.from_disp_str = 0; 20969 itb.string.from_disp_str = false;
21058 itb.string.unibyte = 0; 20970 itb.string.unibyte = false;
21059 itb.w = w; 20971 itb.w = w;
21060 bidi_init_it (itb.charpos, itb.bytepos, frame_window_p, &itb); 20972 bidi_init_it (itb.charpos, itb.bytepos, frame_window_p, &itb);
21061 } 20973 }
@@ -21064,12 +20976,12 @@ the `bidi-class' property of a character. */)
21064 do { 20976 do {
21065 /* For the purposes of this function, the actual base direction of 20977 /* For the purposes of this function, the actual base direction of
21066 the paragraph doesn't matter, so just set it to L2R. */ 20978 the paragraph doesn't matter, so just set it to L2R. */
21067 bidi_paragraph_init (L2R, &itb, 0); 20979 bidi_paragraph_init (L2R, &itb, false);
21068 while ((found = bidi_find_first_overridden (&itb)) < from_pos) 20980 while ((found = bidi_find_first_overridden (&itb)) < from_pos)
21069 ; 20981 ;
21070 } while (found == ZV && itb.ch == '\n' && itb.charpos < to_pos); 20982 } while (found == ZV && itb.ch == '\n' && itb.charpos < to_pos);
21071 20983
21072 bidi_unshelve_cache (itb_data, 0); 20984 bidi_unshelve_cache (itb_data, false);
21073 set_buffer_temp (old); 20985 set_buffer_temp (old);
21074 20986
21075 return (from_pos <= found && found < to_pos) ? make_number (found) : Qnil; 20987 return (from_pos <= found && found < to_pos) ? make_number (found) : Qnil;
@@ -21503,7 +21415,7 @@ Value is the new character position of point. */)
21503 21415
21504 while (!ITERATOR_AT_END_OF_LINE_P (&it)) 21416 while (!ITERATOR_AT_END_OF_LINE_P (&it))
21505 { 21417 {
21506 set_iterator_to_next (&it, 0); 21418 set_iterator_to_next (&it, false);
21507 if (it.method == GET_FROM_BUFFER) 21419 if (it.method == GET_FROM_BUFFER)
21508 new_pos = it.current.pos; 21420 new_pos = it.current.pos;
21509 if (!get_next_display_element (&it)) 21421 if (!get_next_display_element (&it))
@@ -21519,7 +21431,7 @@ Value is the new character position of point. */)
21519 { 21431 {
21520 while (IT_CHARPOS (it) == PT) 21432 while (IT_CHARPOS (it) == PT)
21521 { 21433 {
21522 set_iterator_to_next (&it, 0); 21434 set_iterator_to_next (&it, false);
21523 if (!get_next_display_element (&it)) 21435 if (!get_next_display_element (&it))
21524 break; 21436 break;
21525 } 21437 }
@@ -21719,7 +21631,7 @@ display_menu_bar (struct window *w)
21719 struct glyph_row *row = it.glyph_row + i; 21631 struct glyph_row *row = it.glyph_row + i;
21720 clear_glyph_row (row); 21632 clear_glyph_row (row);
21721 row->enabled_p = true; 21633 row->enabled_p = true;
21722 row->full_width_p = 1; 21634 row->full_width_p = true;
21723 row->reversed_p = false; 21635 row->reversed_p = false;
21724 } 21636 }
21725 21637
@@ -21794,18 +21706,17 @@ deep_copy_glyph_row (struct glyph_row *to, struct glyph_row *from)
21794 glyph number in the row, starting from left, where to start 21706 glyph number in the row, starting from left, where to start
21795 displaying the item. 21707 displaying the item.
21796 21708
21797 SUBMENU non-zero means this menu item drops down a submenu, which 21709 SUBMENU means this menu item drops down a submenu, which
21798 should be indicated by displaying a proper visual cue after the 21710 should be indicated by displaying a proper visual cue after the
21799 item text. */ 21711 item text. */
21800 21712
21801void 21713void
21802display_tty_menu_item (const char *item_text, int width, int face_id, 21714display_tty_menu_item (const char *item_text, int width, int face_id,
21803 int x, int y, int submenu) 21715 int x, int y, bool submenu)
21804{ 21716{
21805 struct it it; 21717 struct it it;
21806 struct frame *f = SELECTED_FRAME (); 21718 struct frame *f = SELECTED_FRAME ();
21807 struct window *w = XWINDOW (f->selected_window); 21719 struct window *w = XWINDOW (f->selected_window);
21808 int saved_used, saved_truncated, saved_width, saved_reversed;
21809 struct glyph_row *row; 21720 struct glyph_row *row;
21810 size_t item_len = strlen (item_text); 21721 size_t item_len = strlen (item_text);
21811 21722
@@ -21825,10 +21736,10 @@ display_tty_menu_item (const char *item_text, int width, int face_id,
21825 row = it.glyph_row; 21736 row = it.glyph_row;
21826 /* Start with the row contents from the current matrix. */ 21737 /* Start with the row contents from the current matrix. */
21827 deep_copy_glyph_row (row, f->current_matrix->rows + y); 21738 deep_copy_glyph_row (row, f->current_matrix->rows + y);
21828 saved_width = row->full_width_p; 21739 bool saved_width = row->full_width_p;
21829 row->full_width_p = 1; 21740 row->full_width_p = true;
21830 saved_reversed = row->reversed_p; 21741 bool saved_reversed = row->reversed_p;
21831 row->reversed_p = 0; 21742 row->reversed_p = false;
21832 row->enabled_p = true; 21743 row->enabled_p = true;
21833 21744
21834 /* Arrange for the menu item glyphs to start at (X,Y) and have the 21745 /* Arrange for the menu item glyphs to start at (X,Y) and have the
@@ -21836,8 +21747,8 @@ display_tty_menu_item (const char *item_text, int width, int face_id,
21836 eassert (x < f->desired_matrix->matrix_w); 21747 eassert (x < f->desired_matrix->matrix_w);
21837 it.current_x = it.hpos = x; 21748 it.current_x = it.hpos = x;
21838 it.current_y = it.vpos = y; 21749 it.current_y = it.vpos = y;
21839 saved_used = row->used[TEXT_AREA]; 21750 int saved_used = row->used[TEXT_AREA];
21840 saved_truncated = row->truncated_on_right_p; 21751 bool saved_truncated = row->truncated_on_right_p;
21841 row->used[TEXT_AREA] = x; 21752 row->used[TEXT_AREA] = x;
21842 it.face_id = face_id; 21753 it.face_id = face_id;
21843 it.line_wrap = TRUNCATE; 21754 it.line_wrap = TRUNCATE;
@@ -21877,8 +21788,8 @@ display_tty_menu_item (const char *item_text, int width, int face_id,
21877 Mode Line 21788 Mode Line
21878 ***********************************************************************/ 21789 ***********************************************************************/
21879 21790
21880/* Redisplay mode lines in the window tree whose root is WINDOW. If 21791/* Redisplay mode lines in the window tree whose root is WINDOW.
21881 FORCE is non-zero, redisplay mode lines unconditionally. 21792 If FORCE, redisplay mode lines unconditionally.
21882 Otherwise, redisplay only mode lines that are garbaged. Value is 21793 Otherwise, redisplay only mode lines that are garbaged. Value is
21883 the number of windows whose mode lines were redisplayed. */ 21794 the number of windows whose mode lines were redisplayed. */
21884 21795
@@ -21950,7 +21861,7 @@ display_mode_lines (struct window *w)
21950 XFRAME (new_frame)->selected_window = selected_window; 21861 XFRAME (new_frame)->selected_window = selected_window;
21951 21862
21952 /* These will be set while the mode line specs are processed. */ 21863 /* These will be set while the mode line specs are processed. */
21953 line_number_displayed = 0; 21864 line_number_displayed = false;
21954 w->column_number_displayed = -1; 21865 w->column_number_displayed = -1;
21955 21866
21956 if (WINDOW_WANTS_MODELINE_P (w)) 21867 if (WINDOW_WANTS_MODELINE_P (w))
@@ -21998,7 +21909,7 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
21998 it.glyph_row->enabled_p = false; 21909 it.glyph_row->enabled_p = false;
21999 prepare_desired_row (w, it.glyph_row, true); 21910 prepare_desired_row (w, it.glyph_row, true);
22000 21911
22001 it.glyph_row->mode_line_p = 1; 21912 it.glyph_row->mode_line_p = true;
22002 21913
22003 /* FIXME: This should be controlled by a user option. But 21914 /* FIXME: This should be controlled by a user option. But
22004 supporting such an option is not trivial, since the mode line is 21915 supporting such an option is not trivial, since the mode line is
@@ -22006,7 +21917,8 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
22006 it.paragraph_embedding = L2R; 21917 it.paragraph_embedding = L2R;
22007 21918
22008 record_unwind_protect (unwind_format_mode_line, 21919 record_unwind_protect (unwind_format_mode_line,
22009 format_mode_line_unwind_data (NULL, NULL, Qnil, 0)); 21920 format_mode_line_unwind_data (NULL, NULL,
21921 Qnil, false));
22010 21922
22011 mode_line_target = MODE_LINE_DISPLAY; 21923 mode_line_target = MODE_LINE_DISPLAY;
22012 21924
@@ -22015,7 +21927,7 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
22015 values. */ 21927 values. */
22016 push_kboard (FRAME_KBOARD (it.f)); 21928 push_kboard (FRAME_KBOARD (it.f));
22017 record_unwind_save_match_data (); 21929 record_unwind_save_match_data ();
22018 display_mode_element (&it, 0, 0, 0, format, Qnil, 0); 21930 display_mode_element (&it, 0, 0, 0, format, Qnil, false);
22019 pop_kboard (); 21931 pop_kboard ();
22020 21932
22021 unbind_to (count, Qnil); 21933 unbind_to (count, Qnil);
@@ -22024,10 +21936,10 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
22024 display_string (" ", Qnil, Qnil, 0, 0, &it, 10000, -1, -1, 0); 21936 display_string (" ", Qnil, Qnil, 0, 0, &it, 10000, -1, -1, 0);
22025 21937
22026 compute_line_metrics (&it); 21938 compute_line_metrics (&it);
22027 it.glyph_row->full_width_p = 1; 21939 it.glyph_row->full_width_p = true;
22028 it.glyph_row->continued_p = 0; 21940 it.glyph_row->continued_p = false;
22029 it.glyph_row->truncated_on_left_p = 0; 21941 it.glyph_row->truncated_on_left_p = false;
22030 it.glyph_row->truncated_on_right_p = 0; 21942 it.glyph_row->truncated_on_right_p = false;
22031 21943
22032 /* Make a 3D mode-line have a shadow at its right end. */ 21944 /* Make a 3D mode-line have a shadow at its right end. */
22033 face = FACE_FROM_ID (it.f, face_id); 21945 face = FACE_FROM_ID (it.f, face_id);
@@ -22036,7 +21948,7 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
22036 { 21948 {
22037 struct glyph *last = (it.glyph_row->glyphs[TEXT_AREA] 21949 struct glyph *last = (it.glyph_row->glyphs[TEXT_AREA]
22038 + it.glyph_row->used[TEXT_AREA] - 1); 21950 + it.glyph_row->used[TEXT_AREA] - 1);
22039 last->right_box_line_p = 1; 21951 last->right_box_line_p = true;
22040 } 21952 }
22041 21953
22042 return it.glyph_row->height; 21954 return it.glyph_row->height;
@@ -22096,7 +22008,7 @@ move_elt_to_front (Lisp_Object elt, Lisp_Object list)
22096 22008
22097 PROPS is a property list to add to any string we encounter. 22009 PROPS is a property list to add to any string we encounter.
22098 22010
22099 If RISKY is nonzero, remove (disregard) any properties in any string 22011 If RISKY, remove (disregard) any properties in any string
22100 we encounter, and ignore :eval and :propertize. 22012 we encounter, and ignore :eval and :propertize.
22101 22013
22102 The global variable `mode_line_target' determines whether the 22014 The global variable `mode_line_target' determines whether the
@@ -22105,10 +22017,10 @@ move_elt_to_front (Lisp_Object elt, Lisp_Object list)
22105 22017
22106static int 22018static int
22107display_mode_element (struct it *it, int depth, int field_width, int precision, 22019display_mode_element (struct it *it, int depth, int field_width, int precision,
22108 Lisp_Object elt, Lisp_Object props, int risky) 22020 Lisp_Object elt, Lisp_Object props, bool risky)
22109{ 22021{
22110 int n = 0, field, prec; 22022 int n = 0, field, prec;
22111 int literal = 0; 22023 bool literal = false;
22112 22024
22113 tail_recurse: 22025 tail_recurse:
22114 if (depth > 100) 22026 if (depth > 100)
@@ -22201,7 +22113,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
22201 n += store_mode_line_noprop (SSDATA (elt), -1, prec); 22113 n += store_mode_line_noprop (SSDATA (elt), -1, prec);
22202 break; 22114 break;
22203 case MODE_LINE_STRING: 22115 case MODE_LINE_STRING:
22204 n += store_mode_line_string (NULL, elt, 1, 0, prec, Qnil); 22116 n += store_mode_line_string (NULL, elt, true, 0, prec, Qnil);
22205 break; 22117 break;
22206 case MODE_LINE_DISPLAY: 22118 case MODE_LINE_DISPLAY:
22207 n += display_string (NULL, elt, Qnil, 0, 0, it, 22119 n += display_string (NULL, elt, Qnil, 0, 0, it,
@@ -22251,11 +22163,11 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
22251 ptrdiff_t endpos = (precision <= 0 22163 ptrdiff_t endpos = (precision <= 0
22252 ? string_byte_to_char (elt, offset) 22164 ? string_byte_to_char (elt, offset)
22253 : charpos + nchars); 22165 : charpos + nchars);
22254 22166 Lisp_Object mode_string
22255 n += store_mode_line_string (NULL, 22167 = Fsubstring (elt, make_number (charpos),
22256 Fsubstring (elt, make_number (charpos), 22168 make_number (endpos));
22257 make_number (endpos)), 22169 n += store_mode_line_string (NULL, mode_string, false,
22258 0, 0, 0, Qnil); 22170 0, 0, Qnil);
22259 } 22171 }
22260 break; 22172 break;
22261 case MODE_LINE_DISPLAY: 22173 case MODE_LINE_DISPLAY:
@@ -22318,7 +22230,8 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
22318 Lisp_Object tem = build_string (spec); 22230 Lisp_Object tem = build_string (spec);
22319 props = Ftext_properties_at (make_number (charpos), elt); 22231 props = Ftext_properties_at (make_number (charpos), elt);
22320 /* Should only keep face property in props */ 22232 /* Should only keep face property in props */
22321 n += store_mode_line_string (NULL, tem, 0, field, prec, props); 22233 n += store_mode_line_string (NULL, tem, false,
22234 field, prec, props);
22322 } 22235 }
22323 break; 22236 break;
22324 case MODE_LINE_DISPLAY: 22237 case MODE_LINE_DISPLAY:
@@ -22371,7 +22284,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
22371 /* If the variable is not marked as risky to set 22284 /* If the variable is not marked as risky to set
22372 then its contents are risky to use. */ 22285 then its contents are risky to use. */
22373 if (NILP (Fget (elt, Qrisky_local_variable))) 22286 if (NILP (Fget (elt, Qrisky_local_variable)))
22374 risky = 1; 22287 risky = true;
22375 22288
22376 tem = Fboundp (elt); 22289 tem = Fboundp (elt);
22377 if (!NILP (tem)) 22290 if (!NILP (tem))
@@ -22380,7 +22293,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
22380 /* If value is a string, output that string literally: 22293 /* If value is a string, output that string literally:
22381 don't check for % within it. */ 22294 don't check for % within it. */
22382 if (STRINGP (tem)) 22295 if (STRINGP (tem))
22383 literal = 1; 22296 literal = true;
22384 22297
22385 if (!EQ (tem, elt)) 22298 if (!EQ (tem, elt))
22386 { 22299 {
@@ -22534,7 +22447,8 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
22534 n += store_mode_line_noprop ("", field_width - n, 0); 22447 n += store_mode_line_noprop ("", field_width - n, 0);
22535 break; 22448 break;
22536 case MODE_LINE_STRING: 22449 case MODE_LINE_STRING:
22537 n += store_mode_line_string ("", Qnil, 0, field_width - n, 0, Qnil); 22450 n += store_mode_line_string ("", Qnil, false, field_width - n, 0,
22451 Qnil);
22538 break; 22452 break;
22539 case MODE_LINE_DISPLAY: 22453 case MODE_LINE_DISPLAY:
22540 n += display_string ("", Qnil, Qnil, 0, 0, it, field_width - n, 22454 n += display_string ("", Qnil, Qnil, 0, 0, it, field_width - n,
@@ -22558,7 +22472,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
22558 PRECISION is the maximum number of characters to output from 22472 PRECISION is the maximum number of characters to output from
22559 STRING. PRECISION <= 0 means don't truncate the string. 22473 STRING. PRECISION <= 0 means don't truncate the string.
22560 22474
22561 If COPY_STRING is non-zero, make a copy of LISP_STRING before adding 22475 If COPY_STRING, make a copy of LISP_STRING before adding
22562 properties to the string. 22476 properties to the string.
22563 22477
22564 PROPS are the properties to add to the string. 22478 PROPS are the properties to add to the string.
@@ -22566,7 +22480,8 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
22566 */ 22480 */
22567 22481
22568static int 22482static int
22569store_mode_line_string (const char *string, Lisp_Object lisp_string, int copy_string, 22483store_mode_line_string (const char *string, Lisp_Object lisp_string,
22484 bool copy_string,
22570 int field_width, int precision, Lisp_Object props) 22485 int field_width, int precision, Lisp_Object props)
22571{ 22486{
22572 ptrdiff_t len; 22487 ptrdiff_t len;
@@ -22669,7 +22584,7 @@ are the selected window and the WINDOW's buffer). */)
22669 struct window *w; 22584 struct window *w;
22670 struct buffer *old_buffer = NULL; 22585 struct buffer *old_buffer = NULL;
22671 int face_id; 22586 int face_id;
22672 int no_props = INTEGERP (face); 22587 bool no_props = INTEGERP (face);
22673 ptrdiff_t count = SPECPDL_INDEX (); 22588 ptrdiff_t count = SPECPDL_INDEX ();
22674 Lisp_Object str; 22589 Lisp_Object str;
22675 int string_start = 0; 22590 int string_start = 0;
@@ -22705,7 +22620,7 @@ are the selected window and the WINDOW's buffer). */)
22705 record_unwind_protect (unwind_format_mode_line, 22620 record_unwind_protect (unwind_format_mode_line,
22706 format_mode_line_unwind_data 22621 format_mode_line_unwind_data
22707 (XFRAME (WINDOW_FRAME (w)), 22622 (XFRAME (WINDOW_FRAME (w)),
22708 old_buffer, selected_window, 1)); 22623 old_buffer, selected_window, true));
22709 mode_line_proptrans_alist = Qnil; 22624 mode_line_proptrans_alist = Qnil;
22710 22625
22711 Fselect_window (window, Qt); 22626 Fselect_window (window, Qt);
@@ -22730,7 +22645,7 @@ are the selected window and the WINDOW's buffer). */)
22730 } 22645 }
22731 22646
22732 push_kboard (FRAME_KBOARD (it.f)); 22647 push_kboard (FRAME_KBOARD (it.f));
22733 display_mode_element (&it, 0, 0, 0, format, Qnil, 0); 22648 display_mode_element (&it, 0, 0, 0, format, Qnil, false);
22734 pop_kboard (); 22649 pop_kboard ();
22735 22650
22736 if (no_props) 22651 if (no_props)
@@ -22891,13 +22806,13 @@ pint2hrstr (char *buf, int width, ptrdiff_t d)
22891} 22806}
22892 22807
22893/* Set a mnemonic character for coding_system (Lisp symbol) in BUF. 22808/* Set a mnemonic character for coding_system (Lisp symbol) in BUF.
22894 If EOL_FLAG is 1, set also a mnemonic character for end-of-line 22809 If EOL_FLAG, set also a mnemonic character for end-of-line
22895 type of CODING_SYSTEM. Return updated pointer into BUF. */ 22810 type of CODING_SYSTEM. Return updated pointer into BUF. */
22896 22811
22897static unsigned char invalid_eol_type[] = "(*invalid*)"; 22812static unsigned char invalid_eol_type[] = "(*invalid*)";
22898 22813
22899static char * 22814static char *
22900decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_flag) 22815decode_mode_spec_coding (Lisp_Object coding_system, char *buf, bool eol_flag)
22901{ 22816{
22902 Lisp_Object val; 22817 Lisp_Object val;
22903 bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 22818 bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
@@ -22939,8 +22854,8 @@ decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_
22939 else /* eolvalue is Qunix, Qdos, or Qmac. */ 22854 else /* eolvalue is Qunix, Qdos, or Qmac. */
22940 eoltype = (EQ (eolvalue, Qunix) 22855 eoltype = (EQ (eolvalue, Qunix)
22941 ? eol_mnemonic_unix 22856 ? eol_mnemonic_unix
22942 : (EQ (eolvalue, Qdos) == 1 22857 : EQ (eolvalue, Qdos)
22943 ? eol_mnemonic_dos : eol_mnemonic_mac)); 22858 ? eol_mnemonic_dos : eol_mnemonic_mac);
22944 } 22859 }
22945 } 22860 }
22946 22861
@@ -23225,7 +23140,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
23225 PT_BYTE, PT, &junk); 23140 PT_BYTE, PT, &junk);
23226 23141
23227 /* Record that we did display the line number. */ 23142 /* Record that we did display the line number. */
23228 line_number_displayed = 1; 23143 line_number_displayed = true;
23229 23144
23230 /* Make the string to show. */ 23145 /* Make the string to show. */
23231 pint2str (decode_mode_spec_buf, width, topline + nlines); 23146 pint2str (decode_mode_spec_buf, width, topline + nlines);
@@ -23348,7 +23263,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
23348 case 'Z': 23263 case 'Z':
23349 /* coding-system (including end-of-line type) */ 23264 /* coding-system (including end-of-line type) */
23350 { 23265 {
23351 int eol_flag = (c == 'Z'); 23266 bool eol_flag = (c == 'Z');
23352 char *p = decode_mode_spec_buf; 23267 char *p = decode_mode_spec_buf;
23353 23268
23354 if (! FRAME_WINDOW_P (f)) 23269 if (! FRAME_WINDOW_P (f))
@@ -23357,15 +23272,15 @@ decode_mode_spec (struct window *w, register int c, int field_width,
23357 to do EOL conversion. */ 23272 to do EOL conversion. */
23358 p = decode_mode_spec_coding (CODING_ID_NAME 23273 p = decode_mode_spec_coding (CODING_ID_NAME
23359 (FRAME_KEYBOARD_CODING (f)->id), 23274 (FRAME_KEYBOARD_CODING (f)->id),
23360 p, 0); 23275 p, false);
23361 p = decode_mode_spec_coding (CODING_ID_NAME 23276 p = decode_mode_spec_coding (CODING_ID_NAME
23362 (FRAME_TERMINAL_CODING (f)->id), 23277 (FRAME_TERMINAL_CODING (f)->id),
23363 p, 0); 23278 p, false);
23364 } 23279 }
23365 p = decode_mode_spec_coding (BVAR (b, buffer_file_coding_system), 23280 p = decode_mode_spec_coding (BVAR (b, buffer_file_coding_system),
23366 p, eol_flag); 23281 p, eol_flag);
23367 23282
23368#if 0 /* This proves to be annoying; I think we can do without. -- rms. */ 23283#if false /* This proves to be annoying; I think we can do without. -- rms. */
23369#ifdef subprocesses 23284#ifdef subprocesses
23370 obj = Fget_buffer_process (Fcurrent_buffer ()); 23285 obj = Fget_buffer_process (Fcurrent_buffer ());
23371 if (PROCESSP (obj)) 23286 if (PROCESSP (obj))
@@ -23376,7 +23291,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
23376 (XPROCESS (obj)->encode_coding_system, p, eol_flag); 23291 (XPROCESS (obj)->encode_coding_system, p, eol_flag);
23377 } 23292 }
23378#endif /* subprocesses */ 23293#endif /* subprocesses */
23379#endif /* 0 */ 23294#endif /* false */
23380 *p = 0; 23295 *p = 0;
23381 return decode_mode_spec_buf; 23296 return decode_mode_spec_buf;
23382 } 23297 }
@@ -23416,8 +23331,9 @@ display_count_lines (ptrdiff_t start_byte,
23416 23331
23417 /* If we are not in selective display mode, 23332 /* If we are not in selective display mode,
23418 check only for newlines. */ 23333 check only for newlines. */
23419 int selective_display = (!NILP (BVAR (current_buffer, selective_display)) 23334 bool selective_display
23420 && !INTEGERP (BVAR (current_buffer, selective_display))); 23335 = (!NILP (BVAR (current_buffer, selective_display))
23336 && !INTEGERP (BVAR (current_buffer, selective_display)));
23421 23337
23422 if (count > 0) 23338 if (count > 0)
23423 { 23339 {
@@ -23467,7 +23383,7 @@ display_count_lines (ptrdiff_t start_byte,
23467 ceiling = max (limit_byte, ceiling); 23383 ceiling = max (limit_byte, ceiling);
23468 ceiling_addr = BYTE_POS_ADDR (ceiling); 23384 ceiling_addr = BYTE_POS_ADDR (ceiling);
23469 base = (cursor = BYTE_POS_ADDR (start_byte - 1) + 1); 23385 base = (cursor = BYTE_POS_ADDR (start_byte - 1) + 1);
23470 while (1) 23386 while (true)
23471 { 23387 {
23472 if (selective_display) 23388 if (selective_display)
23473 { 23389 {
@@ -23687,7 +23603,7 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st
23687 break; 23603 break;
23688 } 23604 }
23689 23605
23690 set_iterator_to_next (it, 1); 23606 set_iterator_to_next (it, true);
23691 if (STRINGP (it->string)) 23607 if (STRINGP (it->string))
23692 it_charpos = IT_STRING_CHARPOS (*it); 23608 it_charpos = IT_STRING_CHARPOS (*it);
23693 else 23609 else
@@ -23729,7 +23645,7 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st
23729 } 23645 }
23730 produce_special_glyphs (it, IT_TRUNCATION); 23646 produce_special_glyphs (it, IT_TRUNCATION);
23731 } 23647 }
23732 row->truncated_on_right_p = 1; 23648 row->truncated_on_right_p = true;
23733 } 23649 }
23734 break; 23650 break;
23735 } 23651 }
@@ -23744,7 +23660,7 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st
23744 ? WINDOW_RIGHT_FRINGE_WIDTH (it->w) 23660 ? WINDOW_RIGHT_FRINGE_WIDTH (it->w)
23745 : WINDOW_LEFT_FRINGE_WIDTH (it->w)) == 0) 23661 : WINDOW_LEFT_FRINGE_WIDTH (it->w)) == 0)
23746 insert_left_trunc_glyphs (it); 23662 insert_left_trunc_glyphs (it);
23747 row->truncated_on_left_p = 1; 23663 row->truncated_on_left_p = true;
23748 } 23664 }
23749 23665
23750 it->face_id = saved_face_id; 23666 it->face_id = saved_face_id;
@@ -23764,9 +23680,9 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st
23764 and 1 if it's invisible and without an ellipsis. */ 23680 and 1 if it's invisible and without an ellipsis. */
23765 23681
23766int 23682int
23767invisible_p (register Lisp_Object propval, Lisp_Object list) 23683invisible_prop (Lisp_Object propval, Lisp_Object list)
23768{ 23684{
23769 register Lisp_Object tail, proptail; 23685 Lisp_Object tail, proptail;
23770 23686
23771 for (tail = list; CONSP (tail); tail = XCDR (tail)) 23687 for (tail = list; CONSP (tail); tail = XCDR (tail))
23772 { 23688 {
@@ -23886,14 +23802,14 @@ else if the text is replaced by an ellipsis. */)
23886 23802
23887*/ 23803*/
23888 23804
23889static int 23805static bool
23890calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, 23806calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
23891 struct font *font, int width_p, int *align_to) 23807 struct font *font, bool width_p, int *align_to)
23892{ 23808{
23893 double pixels; 23809 double pixels;
23894 23810
23895#define OK_PIXELS(val) ((*res = (double)(val)), 1) 23811# define OK_PIXELS(val) (*res = (val), true)
23896#define OK_ALIGN_TO(val) ((*align_to = (int)(val)), 1) 23812# define OK_ALIGN_TO(val) (*align_to = (val), true)
23897 23813
23898 if (NILP (prop)) 23814 if (NILP (prop))
23899 return OK_PIXELS (0); 23815 return OK_PIXELS (0);
@@ -23921,7 +23837,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
23921 23837
23922 if (ppi > 0) 23838 if (ppi > 0)
23923 return OK_PIXELS (ppi / pixels); 23839 return OK_PIXELS (ppi / pixels);
23924 return 0; 23840 return false;
23925 } 23841 }
23926 } 23842 }
23927 23843
@@ -24016,7 +23932,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
24016#endif 23932#endif
24017 if (EQ (car, Qplus) || EQ (car, Qminus)) 23933 if (EQ (car, Qplus) || EQ (car, Qminus))
24018 { 23934 {
24019 int first = 1; 23935 bool first = true;
24020 double px; 23936 double px;
24021 23937
24022 pixels = 0; 23938 pixels = 0;
@@ -24024,9 +23940,9 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
24024 { 23940 {
24025 if (!calc_pixel_width_or_height (&px, it, XCAR (cdr), 23941 if (!calc_pixel_width_or_height (&px, it, XCAR (cdr),
24026 font, width_p, align_to)) 23942 font, width_p, align_to))
24027 return 0; 23943 return false;
24028 if (first) 23944 if (first)
24029 pixels = (EQ (car, Qplus) ? px : -px), first = 0; 23945 pixels = (EQ (car, Qplus) ? px : -px), first = false;
24030 else 23946 else
24031 pixels += px; 23947 pixels += px;
24032 cdr = XCDR (cdr); 23948 cdr = XCDR (cdr);
@@ -24050,13 +23966,13 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
24050 if (calc_pixel_width_or_height (&fact, it, cdr, 23966 if (calc_pixel_width_or_height (&fact, it, cdr,
24051 font, width_p, align_to)) 23967 font, width_p, align_to))
24052 return OK_PIXELS (pixels * fact); 23968 return OK_PIXELS (pixels * fact);
24053 return 0; 23969 return false;
24054 } 23970 }
24055 23971
24056 return 0; 23972 return false;
24057 } 23973 }
24058 23974
24059 return 0; 23975 return false;
24060} 23976}
24061 23977
24062 23978
@@ -24186,14 +24102,14 @@ append_glyph_string (struct glyph_string **head, struct glyph_string **tail,
24186 24102
24187 24103
24188/* Get face and two-byte form of character C in face FACE_ID on frame F. 24104/* Get face and two-byte form of character C in face FACE_ID on frame F.
24189 The encoding of C is returned in *CHAR2B. DISPLAY_P non-zero means 24105 The encoding of C is returned in *CHAR2B. DISPLAY_P means
24190 make sure that X resources for the face returned are allocated. 24106 make sure that X resources for the face returned are allocated.
24191 Value is a pointer to a realized face that is ready for display if 24107 Value is a pointer to a realized face that is ready for display if
24192 DISPLAY_P is non-zero. */ 24108 DISPLAY_P. */
24193 24109
24194static struct face * 24110static struct face *
24195get_char_face_and_encoding (struct frame *f, int c, int face_id, 24111get_char_face_and_encoding (struct frame *f, int c, int face_id,
24196 XChar2b *char2b, int display_p) 24112 XChar2b *char2b, bool display_p)
24197{ 24113{
24198 struct face *face = FACE_FROM_ID (f, face_id); 24114 struct face *face = FACE_FROM_ID (f, face_id);
24199 unsigned code = 0; 24115 unsigned code = 0;
@@ -24255,9 +24171,9 @@ get_glyph_face_and_encoding (struct frame *f, struct glyph *glyph,
24255 24171
24256 24172
24257/* Get glyph code of character C in FONT in the two-byte form CHAR2B. 24173/* Get glyph code of character C in FONT in the two-byte form CHAR2B.
24258 Return 1 if FONT has a glyph for C, otherwise return 0. */ 24174 Return true iff FONT has a glyph for C. */
24259 24175
24260static int 24176static bool
24261get_char_glyph_code (int c, struct font *font, XChar2b *char2b) 24177get_char_glyph_code (int c, struct font *font, XChar2b *char2b)
24262{ 24178{
24263 unsigned code; 24179 unsigned code;
@@ -24268,9 +24184,9 @@ get_char_glyph_code (int c, struct font *font, XChar2b *char2b)
24268 code = font->driver->encode_char (font, c); 24184 code = font->driver->encode_char (font, c);
24269 24185
24270 if (code == FONT_INVALID_CODE) 24186 if (code == FONT_INVALID_CODE)
24271 return 0; 24187 return false;
24272 STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF)); 24188 STORE_XCHAR2B (char2b, (code >> 8), (code & 0xFF));
24273 return 1; 24189 return true;
24274} 24190}
24275 24191
24276 24192
@@ -24311,7 +24227,7 @@ fill_composite_glyph_string (struct glyph_string *s, struct face *base_face,
24311 -1, Qnil); 24227 -1, Qnil);
24312 24228
24313 face = get_char_face_and_encoding (s->f, c, face_id, 24229 face = get_char_face_and_encoding (s->f, c, face_id,
24314 s->char2b + i, 1); 24230 s->char2b + i, true);
24315 if (face) 24231 if (face)
24316 { 24232 {
24317 if (! s->face) 24233 if (! s->face)
@@ -24343,7 +24259,7 @@ fill_composite_glyph_string (struct glyph_string *s, struct face *base_face,
24343 characters of the glyph string. */ 24259 characters of the glyph string. */
24344 if (s->font == NULL) 24260 if (s->font == NULL)
24345 { 24261 {
24346 s->font_not_found_p = 1; 24262 s->font_not_found_p = true;
24347 s->font = FRAME_FONT (s->f); 24263 s->font = FRAME_FONT (s->f);
24348 } 24264 }
24349 24265
@@ -24440,7 +24356,7 @@ fill_glyph_string (struct glyph_string *s, int face_id,
24440{ 24356{
24441 struct glyph *glyph, *last; 24357 struct glyph *glyph, *last;
24442 int voffset; 24358 int voffset;
24443 int glyph_not_available_p; 24359 bool glyph_not_available_p;
24444 24360
24445 eassert (s->f == XFRAME (s->w->frame)); 24361 eassert (s->f == XFRAME (s->w->frame));
24446 eassert (s->nchars == 0); 24362 eassert (s->nchars == 0);
@@ -24477,7 +24393,7 @@ fill_glyph_string (struct glyph_string *s, int face_id,
24477 characters of the glyph string. */ 24393 characters of the glyph string. */
24478 if (s->font == NULL || glyph_not_available_p) 24394 if (s->font == NULL || glyph_not_available_p)
24479 { 24395 {
24480 s->font_not_found_p = 1; 24396 s->font_not_found_p = true;
24481 s->font = FRAME_FONT (s->f); 24397 s->font = FRAME_FONT (s->f);
24482 } 24398 }
24483 24399
@@ -24740,7 +24656,7 @@ set_glyph_string_background_width (struct glyph_string *s, int start, int last_x
24740 || s->hl == DRAW_IMAGE_RAISED 24656 || s->hl == DRAW_IMAGE_RAISED
24741 || s->hl == DRAW_IMAGE_SUNKEN)) 24657 || s->hl == DRAW_IMAGE_SUNKEN))
24742 || s->hl == DRAW_MOUSE_FACE)) 24658 || s->hl == DRAW_MOUSE_FACE))
24743 s->extends_to_end_of_line_p = 1; 24659 s->extends_to_end_of_line_p = true;
24744 24660
24745 /* If S extends its face to the end of the line, set its 24661 /* If S extends its face to the end of the line, set its
24746 background_width to the distance to the right edge of the drawing 24662 background_width to the distance to the right edge of the drawing
@@ -24754,10 +24670,10 @@ set_glyph_string_background_width (struct glyph_string *s, int start, int last_x
24754 24670
24755/* Compute overhangs and x-positions for glyph string S and its 24671/* Compute overhangs and x-positions for glyph string S and its
24756 predecessors, or successors. X is the starting x-position for S. 24672 predecessors, or successors. X is the starting x-position for S.
24757 BACKWARD_P non-zero means process predecessors. */ 24673 BACKWARD_P means process predecessors. */
24758 24674
24759static void 24675static void
24760compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p) 24676compute_overhangs_and_x (struct glyph_string *s, int x, bool backward_p)
24761{ 24677{
24762 if (backward_p) 24678 if (backward_p)
24763 { 24679 {
@@ -24820,7 +24736,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
24820 append_glyph_string (&HEAD, &TAIL, s); \ 24736 append_glyph_string (&HEAD, &TAIL, s); \
24821 s->x = (X); \ 24737 s->x = (X); \
24822 } \ 24738 } \
24823 while (0) 24739 while (false)
24824 24740
24825 24741
24826/* Add a glyph string for an image glyph to the list of strings 24742/* Add a glyph string for an image glyph to the list of strings
@@ -24841,7 +24757,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
24841 ++START; \ 24757 ++START; \
24842 s->x = (X); \ 24758 s->x = (X); \
24843 } \ 24759 } \
24844 while (0) 24760 while (false)
24845 24761
24846 24762
24847/* Add a glyph string for a sequence of character glyphs to the list 24763/* Add a glyph string for a sequence of character glyphs to the list
@@ -24868,7 +24784,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
24868 s->x = (X); \ 24784 s->x = (X); \
24869 START = fill_glyph_string (s, face_id, START, END, overlaps); \ 24785 START = fill_glyph_string (s, face_id, START, END, overlaps); \
24870 } \ 24786 } \
24871 while (0) 24787 while (false)
24872 24788
24873 24789
24874/* Add a glyph string for a composite sequence to the list of strings 24790/* Add a glyph string for a composite sequence to the list of strings
@@ -24909,7 +24825,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
24909 \ 24825 \
24910 ++START; \ 24826 ++START; \
24911 s = first_s; \ 24827 s = first_s; \
24912 } while (0) 24828 } while (false)
24913 24829
24914 24830
24915/* Add a glyph string for a glyph-string sequence to the list of strings 24831/* Add a glyph string for a glyph-string sequence to the list of strings
@@ -24930,7 +24846,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
24930 append_glyph_string (&(HEAD), &(TAIL), s); \ 24846 append_glyph_string (&(HEAD), &(TAIL), s); \
24931 s->x = (X); \ 24847 s->x = (X); \
24932 START = fill_gstring_glyph_string (s, face_id, START, END, overlaps); \ 24848 START = fill_gstring_glyph_string (s, face_id, START, END, overlaps); \
24933 } while (0) 24849 } while (false)
24934 24850
24935 24851
24936/* Add a glyph string for a sequence of glyphless character's glyphs 24852/* Add a glyph string for a sequence of glyphless character's glyphs
@@ -24951,7 +24867,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
24951 START = fill_glyphless_glyph_string (s, face_id, START, END, \ 24867 START = fill_glyphless_glyph_string (s, face_id, START, END, \
24952 overlaps); \ 24868 overlaps); \
24953 } \ 24869 } \
24954 while (0) 24870 while (false)
24955 24871
24956 24872
24957/* Build a list of glyph strings between HEAD and TAIL for the glyphs 24873/* Build a list of glyph strings between HEAD and TAIL for the glyphs
@@ -25012,7 +24928,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
25012 (X) += s->width; \ 24928 (X) += s->width; \
25013 } \ 24929 } \
25014 } \ 24930 } \
25015 } while (0) 24931 } while (false)
25016 24932
25017 24933
25018/* Draw glyphs between START and END in AREA of ROW on window W, 24934/* Draw glyphs between START and END in AREA of ROW on window W,
@@ -25092,7 +25008,7 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
25092 struct glyph_string *h, *t; 25008 struct glyph_string *h, *t;
25093 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 25009 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
25094 int mouse_beg_col IF_LINT (= 0), mouse_end_col IF_LINT (= 0); 25010 int mouse_beg_col IF_LINT (= 0), mouse_end_col IF_LINT (= 0);
25095 int check_mouse_face = 0; 25011 bool check_mouse_face = false;
25096 int dummy_x = 0; 25012 int dummy_x = 0;
25097 25013
25098 /* If mouse highlighting is on, we may need to draw adjacent 25014 /* If mouse highlighting is on, we may need to draw adjacent
@@ -25106,7 +25022,7 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
25106 if (row_vpos >= hlinfo->mouse_face_beg_row 25022 if (row_vpos >= hlinfo->mouse_face_beg_row
25107 && row_vpos <= hlinfo->mouse_face_end_row) 25023 && row_vpos <= hlinfo->mouse_face_end_row)
25108 { 25024 {
25109 check_mouse_face = 1; 25025 check_mouse_face = true;
25110 mouse_beg_col = (row_vpos == hlinfo->mouse_face_beg_row) 25026 mouse_beg_col = (row_vpos == hlinfo->mouse_face_beg_row)
25111 ? hlinfo->mouse_face_beg_col : 0; 25027 ? hlinfo->mouse_face_beg_col : 0;
25112 mouse_end_col = (row_vpos == hlinfo->mouse_face_end_row) 25028 mouse_end_col = (row_vpos == hlinfo->mouse_face_end_row)
@@ -25149,7 +25065,7 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
25149 BUILD_GLYPH_STRINGS (j, start, h, t, 25065 BUILD_GLYPH_STRINGS (j, start, h, t,
25150 overlap_hl, dummy_x, last_x); 25066 overlap_hl, dummy_x, last_x);
25151 start = i; 25067 start = i;
25152 compute_overhangs_and_x (t, head->x, 1); 25068 compute_overhangs_and_x (t, head->x, true);
25153 prepend_glyph_string_lists (&head, &tail, h, t); 25069 prepend_glyph_string_lists (&head, &tail, h, t);
25154 if (clip_head == NULL) 25070 if (clip_head == NULL)
25155 clip_head = head; 25071 clip_head = head;
@@ -25178,8 +25094,8 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
25178 BUILD_GLYPH_STRINGS (i, start, h, t, 25094 BUILD_GLYPH_STRINGS (i, start, h, t,
25179 overlap_hl, dummy_x, last_x); 25095 overlap_hl, dummy_x, last_x);
25180 for (s = h; s; s = s->next) 25096 for (s = h; s; s = s->next)
25181 s->background_filled_p = 1; 25097 s->background_filled_p = true;
25182 compute_overhangs_and_x (t, head->x, 1); 25098 compute_overhangs_and_x (t, head->x, true);
25183 prepend_glyph_string_lists (&head, &tail, h, t); 25099 prepend_glyph_string_lists (&head, &tail, h, t);
25184 } 25100 }
25185 25101
@@ -25204,7 +25120,7 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
25204 overlap_hl, x, last_x); 25120 overlap_hl, x, last_x);
25205 /* Because BUILD_GLYPH_STRINGS updates the first argument, 25121 /* Because BUILD_GLYPH_STRINGS updates the first argument,
25206 we don't have `end = i;' here. */ 25122 we don't have `end = i;' here. */
25207 compute_overhangs_and_x (h, tail->x + tail->width, 0); 25123 compute_overhangs_and_x (h, tail->x + tail->width, false);
25208 append_glyph_string_lists (&head, &tail, h, t); 25124 append_glyph_string_lists (&head, &tail, h, t);
25209 if (clip_tail == NULL) 25125 if (clip_tail == NULL)
25210 clip_tail = tail; 25126 clip_tail = tail;
@@ -25231,8 +25147,8 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
25231 BUILD_GLYPH_STRINGS (end, i, h, t, 25147 BUILD_GLYPH_STRINGS (end, i, h, t,
25232 overlap_hl, x, last_x); 25148 overlap_hl, x, last_x);
25233 for (s = h; s; s = s->next) 25149 for (s = h; s; s = s->next)
25234 s->background_filled_p = 1; 25150 s->background_filled_p = true;
25235 compute_overhangs_and_x (h, tail->x + tail->width, 0); 25151 compute_overhangs_and_x (h, tail->x + tail->width, false);
25236 append_glyph_string_lists (&head, &tail, h, t); 25152 append_glyph_string_lists (&head, &tail, h, t);
25237 } 25153 }
25238 if (clip_head || clip_tail) 25154 if (clip_head || clip_tail)
@@ -25248,7 +25164,7 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
25248 FRAME_RIF (f)->draw_glyph_string (s); 25164 FRAME_RIF (f)->draw_glyph_string (s);
25249 25165
25250#ifndef HAVE_NS 25166#ifndef HAVE_NS
25251 /* When focus a sole frame and move horizontally, this sets on_p to 0 25167 /* When focus a sole frame and move horizontally, this clears on_p
25252 causing a failure to erase prev cursor position. */ 25168 causing a failure to erase prev cursor position. */
25253 if (area == TEXT_AREA 25169 if (area == TEXT_AREA
25254 && !row->full_width_p 25170 && !row->full_width_p
@@ -25291,7 +25207,7 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
25291 < it->glyph_row->glyphs[area + 1])) \ 25207 < it->glyph_row->glyphs[area + 1])) \
25292 { \ 25208 { \
25293 it->w->ncols_scale_factor++; \ 25209 it->w->ncols_scale_factor++; \
25294 it->f->fonts_changed = 1; \ 25210 it->f->fonts_changed = true; \
25295 } \ 25211 } \
25296 } 25212 }
25297 25213
@@ -25326,14 +25242,14 @@ append_glyph (struct it *it)
25326 if (it->pixel_width > 0) 25242 if (it->pixel_width > 0)
25327 { 25243 {
25328 glyph->pixel_width = it->pixel_width; 25244 glyph->pixel_width = it->pixel_width;
25329 glyph->padding_p = 0; 25245 glyph->padding_p = false;
25330 } 25246 }
25331 else 25247 else
25332 { 25248 {
25333 /* Assure at least 1-pixel width. Otherwise, cursor can't 25249 /* Assure at least 1-pixel width. Otherwise, cursor can't
25334 be displayed correctly. */ 25250 be displayed correctly. */
25335 glyph->pixel_width = 1; 25251 glyph->pixel_width = 1;
25336 glyph->padding_p = 1; 25252 glyph->padding_p = true;
25337 } 25253 }
25338 glyph->ascent = it->ascent; 25254 glyph->ascent = it->ascent;
25339 glyph->descent = it->descent; 25255 glyph->descent = it->descent;
@@ -25412,13 +25328,13 @@ append_composite_glyph (struct it *it)
25412 glyph->type = COMPOSITE_GLYPH; 25328 glyph->type = COMPOSITE_GLYPH;
25413 if (it->cmp_it.ch < 0) 25329 if (it->cmp_it.ch < 0)
25414 { 25330 {
25415 glyph->u.cmp.automatic = 0; 25331 glyph->u.cmp.automatic = false;
25416 glyph->u.cmp.id = it->cmp_it.id; 25332 glyph->u.cmp.id = it->cmp_it.id;
25417 glyph->slice.cmp.from = glyph->slice.cmp.to = 0; 25333 glyph->slice.cmp.from = glyph->slice.cmp.to = 0;
25418 } 25334 }
25419 else 25335 else
25420 { 25336 {
25421 glyph->u.cmp.automatic = 1; 25337 glyph->u.cmp.automatic = true;
25422 glyph->u.cmp.id = it->cmp_it.id; 25338 glyph->u.cmp.id = it->cmp_it.id;
25423 glyph->slice.cmp.from = it->cmp_it.from; 25339 glyph->slice.cmp.from = it->cmp_it.from;
25424 glyph->slice.cmp.to = it->cmp_it.to - 1; 25340 glyph->slice.cmp.to = it->cmp_it.to - 1;
@@ -25439,8 +25355,8 @@ append_composite_glyph (struct it *it)
25439 } 25355 }
25440 glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent 25356 glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent
25441 || it->phys_descent > it->descent); 25357 || it->phys_descent > it->descent);
25442 glyph->padding_p = 0; 25358 glyph->padding_p = false;
25443 glyph->glyph_not_available_p = 0; 25359 glyph->glyph_not_available_p = false;
25444 glyph->face_id = it->face_id; 25360 glyph->face_id = it->face_id;
25445 glyph->font_type = FONT_TYPE_UNKNOWN; 25361 glyph->font_type = FONT_TYPE_UNKNOWN;
25446 if (it->bidi_p) 25362 if (it->bidi_p)
@@ -25633,9 +25549,9 @@ produce_image_glyph (struct it *it)
25633 glyph->left_box_line_p = it->start_of_box_run_p; 25549 glyph->left_box_line_p = it->start_of_box_run_p;
25634 glyph->right_box_line_p = it->end_of_box_run_p; 25550 glyph->right_box_line_p = it->end_of_box_run_p;
25635 } 25551 }
25636 glyph->overlaps_vertically_p = 0; 25552 glyph->overlaps_vertically_p = false;
25637 glyph->padding_p = 0; 25553 glyph->padding_p = false;
25638 glyph->glyph_not_available_p = 0; 25554 glyph->glyph_not_available_p = false;
25639 glyph->face_id = it->face_id; 25555 glyph->face_id = it->face_id;
25640 glyph->u.img_id = img->id; 25556 glyph->u.img_id = img->id;
25641 glyph->slice.img = slice; 25557 glyph->slice.img = slice;
@@ -25720,9 +25636,9 @@ append_stretch_glyph (struct it *it, Lisp_Object object,
25720 glyph->left_box_line_p = it->start_of_box_run_p; 25636 glyph->left_box_line_p = it->start_of_box_run_p;
25721 glyph->right_box_line_p = it->end_of_box_run_p; 25637 glyph->right_box_line_p = it->end_of_box_run_p;
25722 } 25638 }
25723 glyph->overlaps_vertically_p = 0; 25639 glyph->overlaps_vertically_p = false;
25724 glyph->padding_p = 0; 25640 glyph->padding_p = false;
25725 glyph->glyph_not_available_p = 0; 25641 glyph->glyph_not_available_p = false;
25726 glyph->face_id = it->face_id; 25642 glyph->face_id = it->face_id;
25727 glyph->u.stretch.ascent = ascent; 25643 glyph->u.stretch.ascent = ascent;
25728 glyph->u.stretch.height = height; 25644 glyph->u.stretch.height = height;
@@ -25784,13 +25700,13 @@ produce_stretch_glyph (struct it *it)
25784 /* (space :width WIDTH :height HEIGHT ...) */ 25700 /* (space :width WIDTH :height HEIGHT ...) */
25785 Lisp_Object prop, plist; 25701 Lisp_Object prop, plist;
25786 int width = 0, height = 0, align_to = -1; 25702 int width = 0, height = 0, align_to = -1;
25787 int zero_width_ok_p = 0; 25703 bool zero_width_ok_p = false;
25788 double tem; 25704 double tem;
25789 struct font *font = NULL; 25705 struct font *font = NULL;
25790 25706
25791#ifdef HAVE_WINDOW_SYSTEM 25707#ifdef HAVE_WINDOW_SYSTEM
25792 int ascent = 0; 25708 int ascent = 0;
25793 int zero_height_ok_p = 0; 25709 bool zero_height_ok_p = false;
25794 25710
25795 if (FRAME_WINDOW_P (it->f)) 25711 if (FRAME_WINDOW_P (it->f))
25796 { 25712 {
@@ -25806,10 +25722,10 @@ produce_stretch_glyph (struct it *it)
25806 25722
25807 /* Compute the width of the stretch. */ 25723 /* Compute the width of the stretch. */
25808 if ((prop = Fplist_get (plist, QCwidth), !NILP (prop)) 25724 if ((prop = Fplist_get (plist, QCwidth), !NILP (prop))
25809 && calc_pixel_width_or_height (&tem, it, prop, font, 1, 0)) 25725 && calc_pixel_width_or_height (&tem, it, prop, font, true, 0))
25810 { 25726 {
25811 /* Absolute width `:width WIDTH' specified and valid. */ 25727 /* Absolute width `:width WIDTH' specified and valid. */
25812 zero_width_ok_p = 1; 25728 zero_width_ok_p = true;
25813 width = (int)tem; 25729 width = (int)tem;
25814 } 25730 }
25815#ifdef HAVE_WINDOW_SYSTEM 25731#ifdef HAVE_WINDOW_SYSTEM
@@ -25839,7 +25755,8 @@ produce_stretch_glyph (struct it *it)
25839 } 25755 }
25840#endif /* HAVE_WINDOW_SYSTEM */ 25756#endif /* HAVE_WINDOW_SYSTEM */
25841 else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop)) 25757 else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop))
25842 && calc_pixel_width_or_height (&tem, it, prop, font, 1, &align_to)) 25758 && calc_pixel_width_or_height (&tem, it, prop, font, true,
25759 &align_to))
25843 { 25760 {
25844 if (it->glyph_row == NULL || !it->glyph_row->mode_line_p) 25761 if (it->glyph_row == NULL || !it->glyph_row->mode_line_p)
25845 align_to = (align_to < 0 25762 align_to = (align_to < 0
@@ -25848,7 +25765,7 @@ produce_stretch_glyph (struct it *it)
25848 else if (align_to < 0) 25765 else if (align_to < 0)
25849 align_to = window_box_left_offset (it->w, TEXT_AREA); 25766 align_to = window_box_left_offset (it->w, TEXT_AREA);
25850 width = max (0, (int)tem + align_to - it->current_x); 25767 width = max (0, (int)tem + align_to - it->current_x);
25851 zero_width_ok_p = 1; 25768 zero_width_ok_p = true;
25852 } 25769 }
25853 else 25770 else
25854 /* Nothing specified -> width defaults to canonical char width. */ 25771 /* Nothing specified -> width defaults to canonical char width. */
@@ -25862,10 +25779,10 @@ produce_stretch_glyph (struct it *it)
25862 if (FRAME_WINDOW_P (it->f)) 25779 if (FRAME_WINDOW_P (it->f))
25863 { 25780 {
25864 if ((prop = Fplist_get (plist, QCheight), !NILP (prop)) 25781 if ((prop = Fplist_get (plist, QCheight), !NILP (prop))
25865 && calc_pixel_width_or_height (&tem, it, prop, font, 0, 0)) 25782 && calc_pixel_width_or_height (&tem, it, prop, font, false, 0))
25866 { 25783 {
25867 height = (int)tem; 25784 height = (int)tem;
25868 zero_height_ok_p = 1; 25785 zero_height_ok_p = true;
25869 } 25786 }
25870 else if (prop = Fplist_get (plist, QCrelative_height), 25787 else if (prop = Fplist_get (plist, QCrelative_height),
25871 NUMVAL (prop) > 0) 25788 NUMVAL (prop) > 0)
@@ -25883,7 +25800,7 @@ produce_stretch_glyph (struct it *it)
25883 NUMVAL (prop) > 0 && NUMVAL (prop) <= 100) 25800 NUMVAL (prop) > 0 && NUMVAL (prop) <= 100)
25884 ascent = height * NUMVAL (prop) / 100.0; 25801 ascent = height * NUMVAL (prop) / 100.0;
25885 else if (!NILP (prop) 25802 else if (!NILP (prop)
25886 && calc_pixel_width_or_height (&tem, it, prop, font, 0, 0)) 25803 && calc_pixel_width_or_height (&tem, it, prop, font, false, 0))
25887 ascent = min (max (0, (int)tem), height); 25804 ascent = min (max (0, (int)tem), height);
25888 else 25805 else
25889 ascent = (height * FONT_BASE (font)) / FONT_HEIGHT (font); 25806 ascent = (height * FONT_BASE (font)) / FONT_HEIGHT (font);
@@ -25932,7 +25849,7 @@ produce_stretch_glyph (struct it *it)
25932 { 25849 {
25933 it->ascent = it->phys_ascent = ascent; 25850 it->ascent = it->phys_ascent = ascent;
25934 it->descent = it->phys_descent = height - it->ascent; 25851 it->descent = it->phys_descent = height - it->ascent;
25935 it->nglyphs = width > 0 && height > 0 ? 1 : 0; 25852 it->nglyphs = width > 0 && height > 0;
25936 take_vertical_position_into_account (it); 25853 take_vertical_position_into_account (it);
25937 } 25854 }
25938 else 25855 else
@@ -26045,10 +25962,9 @@ produce_special_glyphs (struct it *it, enum display_element_type what)
26045 25962
26046 Returns height in pixels, or nil. */ 25963 Returns height in pixels, or nil. */
26047 25964
26048
26049static Lisp_Object 25965static Lisp_Object
26050calc_line_height_property (struct it *it, Lisp_Object val, struct font *font, 25966calc_line_height_property (struct it *it, Lisp_Object val, struct font *font,
26051 int boff, int override) 25967 int boff, bool override)
26052{ 25968{
26053 Lisp_Object face_name = Qnil; 25969 Lisp_Object face_name = Qnil;
26054 int ascent, descent, height; 25970 int ascent, descent, height;
@@ -26076,7 +25992,7 @@ calc_line_height_property (struct it *it, Lisp_Object val, struct font *font,
26076 } 25992 }
26077 else if (EQ (face_name, Qt)) 25993 else if (EQ (face_name, Qt))
26078 { 25994 {
26079 override = 0; 25995 override = false;
26080 } 25996 }
26081 else 25997 else
26082 { 25998 {
@@ -26119,7 +26035,7 @@ calc_line_height_property (struct it *it, Lisp_Object val, struct font *font,
26119 26035
26120 26036
26121/* Append a glyph for a glyphless character to IT->glyph_row. FACE_ID 26037/* Append a glyph for a glyphless character to IT->glyph_row. FACE_ID
26122 is a face ID to be used for the glyph. FOR_NO_FONT is nonzero if 26038 is a face ID to be used for the glyph. FOR_NO_FONT is true if
26123 and only if this is for a character for which no font was found. 26039 and only if this is for a character for which no font was found.
26124 26040
26125 If the display method (it->glyphless_method) is 26041 If the display method (it->glyphless_method) is
@@ -26131,7 +26047,7 @@ calc_line_height_property (struct it *it, Lisp_Object val, struct font *font,
26131 For the other display methods, LEN through LOWER_YOFF are zero. */ 26047 For the other display methods, LEN through LOWER_YOFF are zero. */
26132 26048
26133static void 26049static void
26134append_glyphless_glyph (struct it *it, int face_id, int for_no_font, int len, 26050append_glyphless_glyph (struct it *it, int face_id, bool for_no_font, int len,
26135 short upper_xoff, short upper_yoff, 26051 short upper_xoff, short upper_yoff,
26136 short lower_xoff, short lower_yoff) 26052 short lower_xoff, short lower_yoff)
26137{ 26053{
@@ -26183,8 +26099,8 @@ append_glyphless_glyph (struct it *it, int face_id, int for_no_font, int len,
26183 } 26099 }
26184 glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent 26100 glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent
26185 || it->phys_descent > it->descent); 26101 || it->phys_descent > it->descent);
26186 glyph->padding_p = 0; 26102 glyph->padding_p = false;
26187 glyph->glyph_not_available_p = 0; 26103 glyph->glyph_not_available_p = false;
26188 glyph->face_id = face_id; 26104 glyph->face_id = face_id;
26189 glyph->font_type = FONT_TYPE_UNKNOWN; 26105 glyph->font_type = FONT_TYPE_UNKNOWN;
26190 if (it->bidi_p) 26106 if (it->bidi_p)
@@ -26205,12 +26121,12 @@ append_glyphless_glyph (struct it *it, int face_id, int for_no_font, int len,
26205 the character. See the description of enum 26121 the character. See the description of enum
26206 glyphless_display_method in dispextern.h for the detail. 26122 glyphless_display_method in dispextern.h for the detail.
26207 26123
26208 FOR_NO_FONT is nonzero if and only if this is for a character for 26124 FOR_NO_FONT is true if and only if this is for a character for
26209 which no font was found. ACRONYM, if non-nil, is an acronym string 26125 which no font was found. ACRONYM, if non-nil, is an acronym string
26210 for the character. */ 26126 for the character. */
26211 26127
26212static void 26128static void
26213produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) 26129produce_glyphless_glyph (struct it *it, bool for_no_font, Lisp_Object acronym)
26214{ 26130{
26215 int face_id; 26131 int face_id;
26216 struct face *face; 26132 struct face *face;
@@ -26355,7 +26271,7 @@ x_produce_glyphs (struct it *it)
26355{ 26271{
26356 int extra_line_spacing = it->extra_line_spacing; 26272 int extra_line_spacing = it->extra_line_spacing;
26357 26273
26358 it->glyph_not_available_p = 0; 26274 it->glyph_not_available_p = false;
26359 26275
26360 if (it->what == IT_CHARACTER) 26276 if (it->what == IT_CHARACTER)
26361 { 26277 {
@@ -26373,7 +26289,8 @@ x_produce_glyphs (struct it *it)
26373 Lisp_Object acronym = lookup_glyphless_char_display (-1, it); 26289 Lisp_Object acronym = lookup_glyphless_char_display (-1, it);
26374 26290
26375 eassert (it->what == IT_GLYPHLESS); 26291 eassert (it->what == IT_GLYPHLESS);
26376 produce_glyphless_glyph (it, 1, STRINGP (acronym) ? acronym : Qnil); 26292 produce_glyphless_glyph (it, true,
26293 STRINGP (acronym) ? acronym : Qnil);
26377 goto done; 26294 goto done;
26378 } 26295 }
26379 26296
@@ -26383,8 +26300,6 @@ x_produce_glyphs (struct it *it)
26383 26300
26384 if (it->char_to_display != '\n' && it->char_to_display != '\t') 26301 if (it->char_to_display != '\n' && it->char_to_display != '\t')
26385 { 26302 {
26386 int stretched_p;
26387
26388 it->nglyphs = 1; 26303 it->nglyphs = 1;
26389 26304
26390 if (it->override_ascent >= 0) 26305 if (it->override_ascent >= 0)
@@ -26415,7 +26330,7 @@ x_produce_glyphs (struct it *it)
26415 } 26330 }
26416 else 26331 else
26417 { 26332 {
26418 it->glyph_not_available_p = 1; 26333 it->glyph_not_available_p = true;
26419 it->phys_ascent = it->ascent; 26334 it->phys_ascent = it->ascent;
26420 it->phys_descent = it->descent; 26335 it->phys_descent = it->descent;
26421 it->pixel_width = font->space_width; 26336 it->pixel_width = font->space_width;
@@ -26440,7 +26355,8 @@ x_produce_glyphs (struct it *it)
26440 26355
26441 /* If this is a space inside a region of text with 26356 /* If this is a space inside a region of text with
26442 `space-width' property, change its width. */ 26357 `space-width' property, change its width. */
26443 stretched_p = it->char_to_display == ' ' && !NILP (it->space_width); 26358 bool stretched_p
26359 = it->char_to_display == ' ' && !NILP (it->space_width);
26444 if (stretched_p) 26360 if (stretched_p)
26445 it->pixel_width *= XFLOATINT (it->space_width); 26361 it->pixel_width *= XFLOATINT (it->space_width);
26446 26362
@@ -26499,7 +26415,7 @@ x_produce_glyphs (struct it *it)
26499 in this line, record that fact in a flag of the 26415 in this line, record that fact in a flag of the
26500 glyph row. This is used to optimize X output code. */ 26416 glyph row. This is used to optimize X output code. */
26501 if (pcm && (pcm->lbearing < 0 || pcm->rbearing > pcm->width)) 26417 if (pcm && (pcm->lbearing < 0 || pcm->rbearing > pcm->width))
26502 it->glyph_row->contains_overlapping_glyphs_p = 1; 26418 it->glyph_row->contains_overlapping_glyphs_p = true;
26503 } 26419 }
26504 if (! stretched_p && it->pixel_width == 0) 26420 if (! stretched_p && it->pixel_width == 0)
26505 /* We assure that all visible glyphs have at least 1-pixel 26421 /* We assure that all visible glyphs have at least 1-pixel
@@ -26528,7 +26444,7 @@ x_produce_glyphs (struct it *it)
26528 total_height = XCAR (XCDR (height)); 26444 total_height = XCAR (XCDR (height));
26529 height = XCAR (height); 26445 height = XCAR (height);
26530 } 26446 }
26531 height = calc_line_height_property (it, height, font, boff, 1); 26447 height = calc_line_height_property (it, height, font, boff, true);
26532 26448
26533 if (it->override_ascent >= 0) 26449 if (it->override_ascent >= 0)
26534 { 26450 {
@@ -26556,7 +26472,7 @@ x_produce_glyphs (struct it *it)
26556 } 26472 }
26557 it->phys_ascent = min (it->phys_ascent, it->ascent); 26473 it->phys_ascent = min (it->phys_ascent, it->ascent);
26558 it->phys_descent = min (it->phys_descent, it->descent); 26474 it->phys_descent = min (it->phys_descent, it->descent);
26559 it->constrain_row_ascent_descent_p = 1; 26475 it->constrain_row_ascent_descent_p = true;
26560 extra_line_spacing = 0; 26476 extra_line_spacing = 0;
26561 } 26477 }
26562 else 26478 else
@@ -26578,11 +26494,13 @@ x_produce_glyphs (struct it *it)
26578 it->ascent = XINT (height) - it->descent; 26494 it->ascent = XINT (height) - it->descent;
26579 26495
26580 if (!NILP (total_height)) 26496 if (!NILP (total_height))
26581 spacing = calc_line_height_property (it, total_height, font, boff, 0); 26497 spacing = calc_line_height_property (it, total_height, font,
26498 boff, false);
26582 else 26499 else
26583 { 26500 {
26584 spacing = get_it_property (it, Qline_spacing); 26501 spacing = get_it_property (it, Qline_spacing);
26585 spacing = calc_line_height_property (it, spacing, font, boff, 0); 26502 spacing = calc_line_height_property (it, spacing, font,
26503 boff, false);
26586 } 26504 }
26587 if (INTEGERP (spacing)) 26505 if (INTEGERP (spacing))
26588 { 26506 {
@@ -26660,31 +26578,27 @@ x_produce_glyphs (struct it *it)
26660 int leftmost, rightmost, lowest, highest; 26578 int leftmost, rightmost, lowest, highest;
26661 int lbearing, rbearing; 26579 int lbearing, rbearing;
26662 int i, width, ascent, descent; 26580 int i, width, ascent, descent;
26663 int left_padded = 0, right_padded = 0;
26664 int c IF_LINT (= 0); /* cmp->glyph_len can't be zero; see Bug#8512 */ 26581 int c IF_LINT (= 0); /* cmp->glyph_len can't be zero; see Bug#8512 */
26665 XChar2b char2b; 26582 XChar2b char2b;
26666 struct font_metrics *pcm; 26583 struct font_metrics *pcm;
26667 int font_not_found_p;
26668 ptrdiff_t pos; 26584 ptrdiff_t pos;
26669 26585
26670 for (glyph_len = cmp->glyph_len; glyph_len > 0; glyph_len--) 26586 for (glyph_len = cmp->glyph_len; glyph_len > 0; glyph_len--)
26671 if ((c = COMPOSITION_GLYPH (cmp, glyph_len - 1)) != '\t') 26587 if ((c = COMPOSITION_GLYPH (cmp, glyph_len - 1)) != '\t')
26672 break; 26588 break;
26673 if (glyph_len < cmp->glyph_len) 26589 bool right_padded = glyph_len < cmp->glyph_len;
26674 right_padded = 1;
26675 for (i = 0; i < glyph_len; i++) 26590 for (i = 0; i < glyph_len; i++)
26676 { 26591 {
26677 if ((c = COMPOSITION_GLYPH (cmp, i)) != '\t') 26592 if ((c = COMPOSITION_GLYPH (cmp, i)) != '\t')
26678 break; 26593 break;
26679 cmp->offsets[i * 2] = cmp->offsets[i * 2 + 1] = 0; 26594 cmp->offsets[i * 2] = cmp->offsets[i * 2 + 1] = 0;
26680 } 26595 }
26681 if (i > 0) 26596 bool left_padded = i > 0;
26682 left_padded = 1;
26683 26597
26684 pos = (STRINGP (it->string) ? IT_STRING_CHARPOS (*it) 26598 pos = (STRINGP (it->string) ? IT_STRING_CHARPOS (*it)
26685 : IT_CHARPOS (*it)); 26599 : IT_CHARPOS (*it));
26686 /* If no suitable font is found, use the default font. */ 26600 /* If no suitable font is found, use the default font. */
26687 font_not_found_p = font == NULL; 26601 bool font_not_found_p = font == NULL;
26688 if (font_not_found_p) 26602 if (font_not_found_p)
26689 { 26603 {
26690 face = face->ascii_face; 26604 face = face->ascii_face;
@@ -26703,7 +26617,7 @@ x_produce_glyphs (struct it *it)
26703 if (! font_not_found_p) 26617 if (! font_not_found_p)
26704 { 26618 {
26705 get_char_face_and_encoding (it->f, c, it->face_id, 26619 get_char_face_and_encoding (it->f, c, it->face_id,
26706 &char2b, 0); 26620 &char2b, false);
26707 pcm = get_per_char_metric (font, &char2b); 26621 pcm = get_per_char_metric (font, &char2b);
26708 } 26622 }
26709 26623
@@ -26764,7 +26678,7 @@ x_produce_glyphs (struct it *it)
26764 else 26678 else
26765 { 26679 {
26766 get_char_face_and_encoding (it->f, ch, face_id, 26680 get_char_face_and_encoding (it->f, ch, face_id,
26767 &char2b, 0); 26681 &char2b, false);
26768 pcm = get_per_char_metric (font, &char2b); 26682 pcm = get_per_char_metric (font, &char2b);
26769 } 26683 }
26770 if (! pcm) 26684 if (! pcm)
@@ -26902,7 +26816,7 @@ x_produce_glyphs (struct it *it)
26902 if (it->glyph_row 26816 if (it->glyph_row
26903 && (cmp->lbearing < 0 26817 && (cmp->lbearing < 0
26904 || cmp->rbearing > cmp->pixel_width)) 26818 || cmp->rbearing > cmp->pixel_width))
26905 it->glyph_row->contains_overlapping_glyphs_p = 1; 26819 it->glyph_row->contains_overlapping_glyphs_p = true;
26906 26820
26907 it->pixel_width = cmp->pixel_width; 26821 it->pixel_width = cmp->pixel_width;
26908 it->ascent = it->phys_ascent = cmp->ascent; 26822 it->ascent = it->phys_ascent = cmp->ascent;
@@ -26954,7 +26868,7 @@ x_produce_glyphs (struct it *it)
26954 &metrics); 26868 &metrics);
26955 if (it->glyph_row 26869 if (it->glyph_row
26956 && (metrics.lbearing < 0 || metrics.rbearing > metrics.width)) 26870 && (metrics.lbearing < 0 || metrics.rbearing > metrics.width))
26957 it->glyph_row->contains_overlapping_glyphs_p = 1; 26871 it->glyph_row->contains_overlapping_glyphs_p = true;
26958 it->ascent = it->phys_ascent = metrics.ascent; 26872 it->ascent = it->phys_ascent = metrics.ascent;
26959 it->descent = it->phys_descent = metrics.descent; 26873 it->descent = it->phys_descent = metrics.descent;
26960 if (face->box != FACE_NO_BOX) 26874 if (face->box != FACE_NO_BOX)
@@ -26988,7 +26902,7 @@ x_produce_glyphs (struct it *it)
26988 append_composite_glyph (it); 26902 append_composite_glyph (it);
26989 } 26903 }
26990 else if (it->what == IT_GLYPHLESS) 26904 else if (it->what == IT_GLYPHLESS)
26991 produce_glyphless_glyph (it, 0, Qnil); 26905 produce_glyphless_glyph (it, false, Qnil);
26992 else if (it->what == IT_IMAGE) 26906 else if (it->what == IT_IMAGE)
26993 produce_image_glyph (it); 26907 produce_image_glyph (it);
26994 else if (it->what == IT_STRETCH) 26908 else if (it->what == IT_STRETCH)
@@ -27050,7 +26964,7 @@ x_write_glyphs (struct window *w, struct glyph_row *updated_row,
27050 && w->phys_cursor.vpos == w->output_cursor.vpos 26964 && w->phys_cursor.vpos == w->output_cursor.vpos
27051 && chpos >= hpos 26965 && chpos >= hpos
27052 && chpos < hpos + len) 26966 && chpos < hpos + len)
27053 w->phys_cursor_on_p = 0; 26967 w->phys_cursor_on_p = false;
27054 26968
27055 unblock_input (); 26969 unblock_input ();
27056 26970
@@ -27270,7 +27184,7 @@ set_frame_cursor_types (struct frame *f, Lisp_Object arg)
27270 FRAME_BLINK_OFF_CURSOR (f) = DEFAULT_CURSOR; 27184 FRAME_BLINK_OFF_CURSOR (f) = DEFAULT_CURSOR;
27271 27185
27272 /* Make sure the cursor gets redrawn. */ 27186 /* Make sure the cursor gets redrawn. */
27273 f->cursor_type_changed = 1; 27187 f->cursor_type_changed = true;
27274} 27188}
27275 27189
27276 27190
@@ -27278,7 +27192,7 @@ set_frame_cursor_types (struct frame *f, Lisp_Object arg)
27278 27192
27279/* Return the cursor we want to be displayed in window W. Return 27193/* Return the cursor we want to be displayed in window W. Return
27280 width of bar/hbar cursor through WIDTH arg. Return with 27194 width of bar/hbar cursor through WIDTH arg. Return with
27281 ACTIVE_CURSOR arg set to 1 if cursor in window W is `active' 27195 ACTIVE_CURSOR arg set to true if cursor in window W is `active'
27282 (i.e. if the `system caret' should track this cursor). 27196 (i.e. if the `system caret' should track this cursor).
27283 27197
27284 In a mini-buffer window, we want the cursor only to appear if we 27198 In a mini-buffer window, we want the cursor only to appear if we
@@ -27289,15 +27203,15 @@ set_frame_cursor_types (struct frame *f, Lisp_Object arg)
27289 27203
27290static enum text_cursor_kinds 27204static enum text_cursor_kinds
27291get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, 27205get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
27292 int *active_cursor) 27206 bool *active_cursor)
27293{ 27207{
27294 struct frame *f = XFRAME (w->frame); 27208 struct frame *f = XFRAME (w->frame);
27295 struct buffer *b = XBUFFER (w->contents); 27209 struct buffer *b = XBUFFER (w->contents);
27296 int cursor_type = DEFAULT_CURSOR; 27210 int cursor_type = DEFAULT_CURSOR;
27297 Lisp_Object alt_cursor; 27211 Lisp_Object alt_cursor;
27298 int non_selected = 0; 27212 bool non_selected = false;
27299 27213
27300 *active_cursor = 1; 27214 *active_cursor = true;
27301 27215
27302 /* Echo area */ 27216 /* Echo area */
27303 if (cursor_in_echo_area 27217 if (cursor_in_echo_area
@@ -27315,20 +27229,20 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
27315 return get_specified_cursor_type (BVAR (b, cursor_type), width); 27229 return get_specified_cursor_type (BVAR (b, cursor_type), width);
27316 } 27230 }
27317 27231
27318 *active_cursor = 0; 27232 *active_cursor = false;
27319 non_selected = 1; 27233 non_selected = true;
27320 } 27234 }
27321 27235
27322 /* Detect a nonselected window or nonselected frame. */ 27236 /* Detect a nonselected window or nonselected frame. */
27323 else if (w != XWINDOW (f->selected_window) 27237 else if (w != XWINDOW (f->selected_window)
27324 || f != FRAME_DISPLAY_INFO (f)->x_highlight_frame) 27238 || f != FRAME_DISPLAY_INFO (f)->x_highlight_frame)
27325 { 27239 {
27326 *active_cursor = 0; 27240 *active_cursor = false;
27327 27241
27328 if (MINI_WINDOW_P (w) && minibuf_level == 0) 27242 if (MINI_WINDOW_P (w) && minibuf_level == 0)
27329 return NO_CURSOR; 27243 return NO_CURSOR;
27330 27244
27331 non_selected = 1; 27245 non_selected = true;
27332 } 27246 }
27333 27247
27334 /* Never display a cursor in a window in which cursor-type is nil. */ 27248 /* Never display a cursor in a window in which cursor-type is nil. */
@@ -27405,7 +27319,7 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
27405 return FRAME_BLINK_OFF_CURSOR (f); 27319 return FRAME_BLINK_OFF_CURSOR (f);
27406 } 27320 }
27407 27321
27408#if 0 27322#if false
27409 /* Some people liked having a permanently visible blinking cursor, 27323 /* Some people liked having a permanently visible blinking cursor,
27410 while others had very strong opinions against it. So it was 27324 while others had very strong opinions against it. So it was
27411 decided to remove it. KFS 2003-09-03 */ 27325 decided to remove it. KFS 2003-09-03 */
@@ -27457,9 +27371,9 @@ notice_overwritten_cursor (struct window *w, enum glyph_row_area area,
27457 27371
27458 if (row->cursor_in_fringe_p) 27372 if (row->cursor_in_fringe_p)
27459 { 27373 {
27460 row->cursor_in_fringe_p = 0; 27374 row->cursor_in_fringe_p = false;
27461 draw_fringe_bitmap (w, row, row->reversed_p); 27375 draw_fringe_bitmap (w, row, row->reversed_p);
27462 w->phys_cursor_on_p = 0; 27376 w->phys_cursor_on_p = false;
27463 return; 27377 return;
27464 } 27378 }
27465 27379
@@ -27489,7 +27403,7 @@ notice_overwritten_cursor (struct window *w, enum glyph_row_area area,
27489 if ((y0 < cy0 || y0 >= cy1) && (y1 <= cy0 || y1 >= cy1)) 27403 if ((y0 < cy0 || y0 >= cy1) && (y1 <= cy0 || y1 >= cy1))
27490 return; 27404 return;
27491 27405
27492 w->phys_cursor_on_p = 0; 27406 w->phys_cursor_on_p = false;
27493} 27407}
27494 27408
27495#endif /* HAVE_WINDOW_SYSTEM */ 27409#endif /* HAVE_WINDOW_SYSTEM */
@@ -27558,7 +27472,7 @@ draw_phys_cursor_glyph (struct window *w, struct glyph_row *row,
27558 ? (w->phys_cursor.hpos >= 0) 27472 ? (w->phys_cursor.hpos >= 0)
27559 : (w->phys_cursor.hpos < row->used[TEXT_AREA]))) 27473 : (w->phys_cursor.hpos < row->used[TEXT_AREA])))
27560 { 27474 {
27561 int on_p = w->phys_cursor_on_p; 27475 bool on_p = w->phys_cursor_on_p;
27562 int x1; 27476 int x1;
27563 int hpos = w->phys_cursor.hpos; 27477 int hpos = w->phys_cursor.hpos;
27564 27478
@@ -27606,7 +27520,7 @@ erase_phys_cursor (struct window *w)
27606 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 27520 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
27607 int hpos = w->phys_cursor.hpos; 27521 int hpos = w->phys_cursor.hpos;
27608 int vpos = w->phys_cursor.vpos; 27522 int vpos = w->phys_cursor.vpos;
27609 int mouse_face_here_p = 0; 27523 bool mouse_face_here_p = false;
27610 struct glyph_matrix *active_glyphs = w->current_matrix; 27524 struct glyph_matrix *active_glyphs = w->current_matrix;
27611 struct glyph_row *cursor_row; 27525 struct glyph_row *cursor_row;
27612 struct glyph *cursor_glyph; 27526 struct glyph *cursor_glyph;
@@ -27642,7 +27556,7 @@ erase_phys_cursor (struct window *w)
27642 /* If cursor is in the fringe, erase by drawing actual bitmap there. */ 27556 /* If cursor is in the fringe, erase by drawing actual bitmap there. */
27643 if (cursor_row->cursor_in_fringe_p) 27557 if (cursor_row->cursor_in_fringe_p)
27644 { 27558 {
27645 cursor_row->cursor_in_fringe_p = 0; 27559 cursor_row->cursor_in_fringe_p = false;
27646 draw_fringe_bitmap (w, cursor_row, cursor_row->reversed_p); 27560 draw_fringe_bitmap (w, cursor_row, cursor_row->reversed_p);
27647 goto mark_cursor_off; 27561 goto mark_cursor_off;
27648 } 27562 }
@@ -27673,7 +27587,7 @@ erase_phys_cursor (struct window *w)
27673 end of a line (on a newline). The cursor appears there, but 27587 end of a line (on a newline). The cursor appears there, but
27674 mouse highlighting does not. */ 27588 mouse highlighting does not. */
27675 && cursor_row->used[TEXT_AREA] > hpos && hpos >= 0) 27589 && cursor_row->used[TEXT_AREA] > hpos && hpos >= 0)
27676 mouse_face_here_p = 1; 27590 mouse_face_here_p = true;
27677 27591
27678 /* Maybe clear the display under the cursor. */ 27592 /* Maybe clear the display under the cursor. */
27679 if (w->phys_cursor_type == HOLLOW_BOX_CURSOR) 27593 if (w->phys_cursor_type == HOLLOW_BOX_CURSOR)
@@ -27709,15 +27623,14 @@ erase_phys_cursor (struct window *w)
27709 draw_phys_cursor_glyph (w, cursor_row, hl); 27623 draw_phys_cursor_glyph (w, cursor_row, hl);
27710 27624
27711 mark_cursor_off: 27625 mark_cursor_off:
27712 w->phys_cursor_on_p = 0; 27626 w->phys_cursor_on_p = false;
27713 w->phys_cursor_type = NO_CURSOR; 27627 w->phys_cursor_type = NO_CURSOR;
27714} 27628}
27715 27629
27716 27630
27717/* EXPORT: 27631/* Display or clear cursor of window W. If !ON, clear the cursor.
27718 Display or clear cursor of window W. If ON is zero, clear the 27632 If ON, display the cursor; where to put the cursor is specified by
27719 cursor. If it is non-zero, display the cursor. If ON is nonzero, 27633 HPOS, VPOS, X and Y. */
27720 where to put the cursor is specified by HPOS, VPOS, X and Y. */
27721 27634
27722void 27635void
27723display_and_set_cursor (struct window *w, bool on, 27636display_and_set_cursor (struct window *w, bool on,
@@ -27726,7 +27639,7 @@ display_and_set_cursor (struct window *w, bool on,
27726 struct frame *f = XFRAME (w->frame); 27639 struct frame *f = XFRAME (w->frame);
27727 int new_cursor_type; 27640 int new_cursor_type;
27728 int new_cursor_width; 27641 int new_cursor_width;
27729 int active_cursor; 27642 bool active_cursor;
27730 struct glyph_row *glyph_row; 27643 struct glyph_row *glyph_row;
27731 struct glyph *glyph; 27644 struct glyph *glyph;
27732 27645
@@ -27749,7 +27662,7 @@ display_and_set_cursor (struct window *w, bool on,
27749 display the cursor. */ 27662 display the cursor. */
27750 if (!glyph_row->enabled_p) 27663 if (!glyph_row->enabled_p)
27751 { 27664 {
27752 w->phys_cursor_on_p = 0; 27665 w->phys_cursor_on_p = false;
27753 return; 27666 return;
27754 } 27667 }
27755 27668
@@ -27781,9 +27694,9 @@ display_and_set_cursor (struct window *w, bool on,
27781 erase_phys_cursor (w); 27694 erase_phys_cursor (w);
27782 27695
27783 /* Don't check phys_cursor_on_p here because that flag is only set 27696 /* Don't check phys_cursor_on_p here because that flag is only set
27784 to zero in some cases where we know that the cursor has been 27697 to false in some cases where we know that the cursor has been
27785 completely erased, to avoid the extra work of erasing the cursor 27698 completely erased, to avoid the extra work of erasing the cursor
27786 twice. In other words, phys_cursor_on_p can be 1 and the cursor 27699 twice. In other words, phys_cursor_on_p can be true and the cursor
27787 still not be visible, or it has only been partly erased. */ 27700 still not be visible, or it has only been partly erased. */
27788 if (on) 27701 if (on)
27789 { 27702 {
@@ -27878,7 +27791,7 @@ void
27878x_clear_cursor (struct window *w) 27791x_clear_cursor (struct window *w)
27879{ 27792{
27880 if (FRAME_VISIBLE_P (XFRAME (w->frame)) && w->phys_cursor_on_p) 27793 if (FRAME_VISIBLE_P (XFRAME (w->frame)) && w->phys_cursor_on_p)
27881 update_window_cursor (w, 0); 27794 update_window_cursor (w, false);
27882} 27795}
27883 27796
27884#endif /* HAVE_WINDOW_SYSTEM */ 27797#endif /* HAVE_WINDOW_SYSTEM */
@@ -27919,7 +27832,7 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw)
27919 anymore. This can happen when a window is split. */ 27832 anymore. This can happen when a window is split. */
27920 && hlinfo->mouse_face_end_row < w->current_matrix->nrows) 27833 && hlinfo->mouse_face_end_row < w->current_matrix->nrows)
27921 { 27834 {
27922 int phys_cursor_on_p = w->phys_cursor_on_p; 27835 bool phys_cursor_on_p = w->phys_cursor_on_p;
27923 struct glyph_row *row, *first, *last; 27836 struct glyph_row *row, *first, *last;
27924 27837
27925 first = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_beg_row); 27838 first = MATRIX_ROW (w->current_matrix, hlinfo->mouse_face_beg_row);
@@ -27973,7 +27886,7 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw)
27973 { 27886 {
27974 end_hpos = row->used[TEXT_AREA]; 27887 end_hpos = row->used[TEXT_AREA];
27975 if (draw == DRAW_NORMAL_TEXT) 27888 if (draw == DRAW_NORMAL_TEXT)
27976 row->fill_line_p = 1; /* Clear to end of line */ 27889 row->fill_line_p = true; /* Clear to end of line. */
27977 } 27890 }
27978 } 27891 }
27979 else if (row->reversed_p && row == first) 27892 else if (row->reversed_p && row == first)
@@ -27982,7 +27895,7 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw)
27982 { 27895 {
27983 end_hpos = row->used[TEXT_AREA]; 27896 end_hpos = row->used[TEXT_AREA];
27984 if (draw == DRAW_NORMAL_TEXT) 27897 if (draw == DRAW_NORMAL_TEXT)
27985 row->fill_line_p = 1; /* Clear to end of line */ 27898 row->fill_line_p = true; /* Clear to end of line. */
27986 } 27899 }
27987 27900
27988 if (end_hpos > start_hpos) 27901 if (end_hpos > start_hpos)
@@ -28012,7 +27925,7 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw)
28012 hpos = row->used[TEXT_AREA] - 1; 27925 hpos = row->used[TEXT_AREA] - 1;
28013 27926
28014 block_input (); 27927 block_input ();
28015 display_and_set_cursor (w, 1, hpos, w->phys_cursor.vpos, 27928 display_and_set_cursor (w, true, hpos, w->phys_cursor.vpos,
28016 w->phys_cursor.x, w->phys_cursor.y); 27929 w->phys_cursor.x, w->phys_cursor.y);
28017 unblock_input (); 27930 unblock_input ();
28018 } 27931 }
@@ -28039,20 +27952,16 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw)
28039 27952
28040/* EXPORT: 27953/* EXPORT:
28041 Clear out the mouse-highlighted active region. 27954 Clear out the mouse-highlighted active region.
28042 Redraw it un-highlighted first. Value is non-zero if mouse 27955 Redraw it un-highlighted first. Value is true if mouse
28043 face was actually drawn unhighlighted. */ 27956 face was actually drawn unhighlighted. */
28044 27957
28045int 27958bool
28046clear_mouse_face (Mouse_HLInfo *hlinfo) 27959clear_mouse_face (Mouse_HLInfo *hlinfo)
28047{ 27960{
28048 int cleared = 0; 27961 bool cleared
28049 27962 = !hlinfo->mouse_face_hidden && !NILP (hlinfo->mouse_face_window);
28050 if (!hlinfo->mouse_face_hidden && !NILP (hlinfo->mouse_face_window)) 27963 if (cleared)
28051 { 27964 show_mouse_face (hlinfo, DRAW_NORMAL_TEXT);
28052 show_mouse_face (hlinfo, DRAW_NORMAL_TEXT);
28053 cleared = 1;
28054 }
28055
28056 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; 27965 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
28057 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; 27966 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
28058 hlinfo->mouse_face_window = Qnil; 27967 hlinfo->mouse_face_window = Qnil;
@@ -28340,7 +28249,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
28340 if (r2 == NULL) 28249 if (r2 == NULL)
28341 { 28250 {
28342 r2 = MATRIX_ROW (w->current_matrix, w->window_end_vpos); 28251 r2 = MATRIX_ROW (w->current_matrix, w->window_end_vpos);
28343 hlinfo->mouse_face_past_end = 1; 28252 hlinfo->mouse_face_past_end = true;
28344 } 28253 }
28345 else if (!NILP (after_string)) 28254 else if (!NILP (after_string))
28346 { 28255 {
@@ -28620,26 +28529,26 @@ mouse_face_from_buffer_pos (Lisp_Object window,
28620 mouse_face_from_string_pos), but I leave it here for the time 28529 mouse_face_from_string_pos), but I leave it here for the time
28621 being, in case someone would. */ 28530 being, in case someone would. */
28622 28531
28623#if 0 /* not used */ 28532#if false /* not used */
28624 28533
28625/* Find the position of the glyph for position POS in OBJECT in 28534/* Find the position of the glyph for position POS in OBJECT in
28626 window W's current matrix, and return in *X, *Y the pixel 28535 window W's current matrix, and return in *X, *Y the pixel
28627 coordinates, and return in *HPOS, *VPOS the column/row of the glyph. 28536 coordinates, and return in *HPOS, *VPOS the column/row of the glyph.
28628 28537
28629 RIGHT_P non-zero means return the position of the right edge of the 28538 RIGHT_P means return the position of the right edge of the glyph.
28630 glyph, RIGHT_P zero means return the left edge position. 28539 !RIGHT_P means return the left edge position.
28631 28540
28632 If no glyph for POS exists in the matrix, return the position of 28541 If no glyph for POS exists in the matrix, return the position of
28633 the glyph with the next smaller position that is in the matrix, if 28542 the glyph with the next smaller position that is in the matrix, if
28634 RIGHT_P is zero. If RIGHT_P is non-zero, and no glyph for POS 28543 RIGHT_P is false. If RIGHT_P, and no glyph for POS
28635 exists in the matrix, return the position of the glyph with the 28544 exists in the matrix, return the position of the glyph with the
28636 next larger position in OBJECT. 28545 next larger position in OBJECT.
28637 28546
28638 Value is non-zero if a glyph was found. */ 28547 Value is true if a glyph was found. */
28639 28548
28640static int 28549static bool
28641fast_find_string_pos (struct window *w, ptrdiff_t pos, Lisp_Object object, 28550fast_find_string_pos (struct window *w, ptrdiff_t pos, Lisp_Object object,
28642 int *hpos, int *vpos, int *x, int *y, int right_p) 28551 int *hpos, int *vpos, int *x, int *y, bool right_p)
28643{ 28552{
28644 int yb = window_text_bottom_y (w); 28553 int yb = window_text_bottom_y (w);
28645 struct glyph_row *r; 28554 struct glyph_row *r;
@@ -28714,7 +28623,7 @@ mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo,
28714 struct glyph_row *r; 28623 struct glyph_row *r;
28715 struct glyph *g, *e; 28624 struct glyph *g, *e;
28716 int gx; 28625 int gx;
28717 int found = 0; 28626 bool found = false;
28718 28627
28719 /* Find the glyph row with at least one position in the range 28628 /* Find the glyph row with at least one position in the range
28720 [STARTPOS..ENDPOS), and the first glyph in that row whose 28629 [STARTPOS..ENDPOS), and the first glyph in that row whose
@@ -28735,7 +28644,7 @@ mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo,
28735 = MATRIX_ROW_VPOS (r, w->current_matrix); 28644 = MATRIX_ROW_VPOS (r, w->current_matrix);
28736 hlinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA]; 28645 hlinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA];
28737 hlinfo->mouse_face_beg_x = gx; 28646 hlinfo->mouse_face_beg_x = gx;
28738 found = 1; 28647 found = true;
28739 break; 28648 break;
28740 } 28649 }
28741 } 28650 }
@@ -28755,7 +28664,7 @@ mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo,
28755 for (gx = r->x, g1 = r->glyphs[TEXT_AREA]; g1 < g; ++g1) 28664 for (gx = r->x, g1 = r->glyphs[TEXT_AREA]; g1 < g; ++g1)
28756 gx += g1->pixel_width; 28665 gx += g1->pixel_width;
28757 hlinfo->mouse_face_beg_x = gx; 28666 hlinfo->mouse_face_beg_x = gx;
28758 found = 1; 28667 found = true;
28759 break; 28668 break;
28760 } 28669 }
28761 } 28670 }
@@ -28772,12 +28681,12 @@ mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo,
28772 { 28681 {
28773 g = r->glyphs[TEXT_AREA]; 28682 g = r->glyphs[TEXT_AREA];
28774 e = g + r->used[TEXT_AREA]; 28683 e = g + r->used[TEXT_AREA];
28775 found = 0; 28684 found = false;
28776 for ( ; g < e; ++g) 28685 for ( ; g < e; ++g)
28777 if (EQ (g->object, object) 28686 if (EQ (g->object, object)
28778 && startpos <= g->charpos && g->charpos < endpos) 28687 && startpos <= g->charpos && g->charpos < endpos)
28779 { 28688 {
28780 found = 1; 28689 found = true;
28781 break; 28690 break;
28782 } 28691 }
28783 if (!found) 28692 if (!found)
@@ -28826,11 +28735,11 @@ mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo,
28826 28735
28827/* See if position X, Y is within a hot-spot of an image. */ 28736/* See if position X, Y is within a hot-spot of an image. */
28828 28737
28829static int 28738static bool
28830on_hot_spot_p (Lisp_Object hot_spot, int x, int y) 28739on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
28831{ 28740{
28832 if (!CONSP (hot_spot)) 28741 if (!CONSP (hot_spot))
28833 return 0; 28742 return false;
28834 28743
28835 if (EQ (XCAR (hot_spot), Qrect)) 28744 if (EQ (XCAR (hot_spot), Qrect))
28836 { 28745 {
@@ -28838,20 +28747,20 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
28838 Lisp_Object rect = XCDR (hot_spot); 28747 Lisp_Object rect = XCDR (hot_spot);
28839 Lisp_Object tem; 28748 Lisp_Object tem;
28840 if (!CONSP (rect)) 28749 if (!CONSP (rect))
28841 return 0; 28750 return false;
28842 if (!CONSP (XCAR (rect))) 28751 if (!CONSP (XCAR (rect)))
28843 return 0; 28752 return false;
28844 if (!CONSP (XCDR (rect))) 28753 if (!CONSP (XCDR (rect)))
28845 return 0; 28754 return false;
28846 if (!(tem = XCAR (XCAR (rect)), INTEGERP (tem) && x >= XINT (tem))) 28755 if (!(tem = XCAR (XCAR (rect)), INTEGERP (tem) && x >= XINT (tem)))
28847 return 0; 28756 return false;
28848 if (!(tem = XCDR (XCAR (rect)), INTEGERP (tem) && y >= XINT (tem))) 28757 if (!(tem = XCDR (XCAR (rect)), INTEGERP (tem) && y >= XINT (tem)))
28849 return 0; 28758 return false;
28850 if (!(tem = XCAR (XCDR (rect)), INTEGERP (tem) && x <= XINT (tem))) 28759 if (!(tem = XCAR (XCDR (rect)), INTEGERP (tem) && x <= XINT (tem)))
28851 return 0; 28760 return false;
28852 if (!(tem = XCDR (XCDR (rect)), INTEGERP (tem) && y <= XINT (tem))) 28761 if (!(tem = XCDR (XCDR (rect)), INTEGERP (tem) && y <= XINT (tem)))
28853 return 0; 28762 return false;
28854 return 1; 28763 return true;
28855 } 28764 }
28856 else if (EQ (XCAR (hot_spot), Qcircle)) 28765 else if (EQ (XCAR (hot_spot), Qcircle))
28857 { 28766 {
@@ -28879,13 +28788,13 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
28879 Lisp_Object *poly = v->contents; 28788 Lisp_Object *poly = v->contents;
28880 ptrdiff_t n = v->header.size; 28789 ptrdiff_t n = v->header.size;
28881 ptrdiff_t i; 28790 ptrdiff_t i;
28882 int inside = 0; 28791 bool inside = false;
28883 Lisp_Object lx, ly; 28792 Lisp_Object lx, ly;
28884 int x0, y0; 28793 int x0, y0;
28885 28794
28886 /* Need an even number of coordinates, and at least 3 edges. */ 28795 /* Need an even number of coordinates, and at least 3 edges. */
28887 if (n < 6 || n & 1) 28796 if (n < 6 || n & 1)
28888 return 0; 28797 return false;
28889 28798
28890 /* Count edge segments intersecting line from (X,Y) to (X,infinity). 28799 /* Count edge segments intersecting line from (X,Y) to (X,infinity).
28891 If count is odd, we are inside polygon. Pixels on edges 28800 If count is odd, we are inside polygon. Pixels on edges
@@ -28893,14 +28802,14 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
28893 polygon. */ 28802 polygon. */
28894 if ((lx = poly[n-2], !INTEGERP (lx)) 28803 if ((lx = poly[n-2], !INTEGERP (lx))
28895 || (ly = poly[n-1], !INTEGERP (lx))) 28804 || (ly = poly[n-1], !INTEGERP (lx)))
28896 return 0; 28805 return false;
28897 x0 = XINT (lx), y0 = XINT (ly); 28806 x0 = XINT (lx), y0 = XINT (ly);
28898 for (i = 0; i < n; i += 2) 28807 for (i = 0; i < n; i += 2)
28899 { 28808 {
28900 int x1 = x0, y1 = y0; 28809 int x1 = x0, y1 = y0;
28901 if ((lx = poly[i], !INTEGERP (lx)) 28810 if ((lx = poly[i], !INTEGERP (lx))
28902 || (ly = poly[i+1], !INTEGERP (ly))) 28811 || (ly = poly[i+1], !INTEGERP (ly)))
28903 return 0; 28812 return false;
28904 x0 = XINT (lx), y0 = XINT (ly); 28813 x0 = XINT (lx), y0 = XINT (ly);
28905 28814
28906 /* Does this segment cross the X line? */ 28815 /* Does this segment cross the X line? */
@@ -28919,7 +28828,7 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
28919 return inside; 28828 return inside;
28920 } 28829 }
28921 } 28830 }
28922 return 0; 28831 return false;
28923} 28832}
28924 28833
28925Lisp_Object 28834Lisp_Object
@@ -29292,7 +29201,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
29292 29201
29293 hlinfo->mouse_face_beg_row = vpos; 29202 hlinfo->mouse_face_beg_row = vpos;
29294 hlinfo->mouse_face_end_row = hlinfo->mouse_face_beg_row; 29203 hlinfo->mouse_face_end_row = hlinfo->mouse_face_beg_row;
29295 hlinfo->mouse_face_past_end = 0; 29204 hlinfo->mouse_face_past_end = false;
29296 hlinfo->mouse_face_window = window; 29205 hlinfo->mouse_face_window = window;
29297 29206
29298 hlinfo->mouse_face_face_id = face_at_string_position (w, string, 29207 hlinfo->mouse_face_face_id = face_at_string_position (w, string,
@@ -29352,7 +29261,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
29352 return; 29261 return;
29353 29262
29354 /* Which window is that in? */ 29263 /* Which window is that in? */
29355 window = window_from_coordinates (f, x, y, &part, 1); 29264 window = window_from_coordinates (f, x, y, &part, true);
29356 29265
29357 /* If displaying active text in another window, clear that. */ 29266 /* If displaying active text in another window, clear that. */
29358 if (! EQ (window, hlinfo->mouse_face_window) 29267 if (! EQ (window, hlinfo->mouse_face_window)
@@ -29446,7 +29355,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
29446 ptrdiff_t i, noverlays; 29355 ptrdiff_t i, noverlays;
29447 struct buffer *obuf; 29356 struct buffer *obuf;
29448 ptrdiff_t obegv, ozv; 29357 ptrdiff_t obegv, ozv;
29449 int same_region; 29358 bool same_region;
29450 29359
29451 /* Find the glyph under X/Y. */ 29360 /* Find the glyph under X/Y. */
29452 glyph = x_y_to_hpos_vpos (w, x, y, &hpos, &vpos, &dx, &dy, &area); 29361 glyph = x_y_to_hpos_vpos (w, x, y, &hpos, &vpos, &dx, &dy, &area);
@@ -29554,7 +29463,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
29554 if (BUFFERP (object)) 29463 if (BUFFERP (object))
29555 { 29464 {
29556 /* Put all the overlays we want in a vector in overlay_vec. */ 29465 /* Put all the overlays we want in a vector in overlay_vec. */
29557 GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0); 29466 GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, false);
29558 /* Sort overlays into increasing priority order. */ 29467 /* Sort overlays into increasing priority order. */
29559 noverlays = sort_overlays (overlay_vec, noverlays, w); 29468 noverlays = sort_overlays (overlay_vec, noverlays, w);
29560 } 29469 }
@@ -29623,7 +29532,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
29623 e = make_number (SCHARS (object)); 29532 e = make_number (SCHARS (object));
29624 mouse_face_from_string_pos (w, hlinfo, object, 29533 mouse_face_from_string_pos (w, hlinfo, object,
29625 XINT (s), XINT (e)); 29534 XINT (s), XINT (e));
29626 hlinfo->mouse_face_past_end = 0; 29535 hlinfo->mouse_face_past_end = false;
29627 hlinfo->mouse_face_window = window; 29536 hlinfo->mouse_face_window = window;
29628 hlinfo->mouse_face_face_id 29537 hlinfo->mouse_face_face_id
29629 = face_at_string_position (w, object, pos, 0, &ignore, 29538 = face_at_string_position (w, object, pos, 0, &ignore,
@@ -29946,9 +29855,9 @@ expose_area (struct window *w, struct glyph_row *row, XRectangle *r,
29946 29855
29947/* Redraw the parts of the glyph row ROW on window W intersecting 29856/* Redraw the parts of the glyph row ROW on window W intersecting
29948 rectangle R. R is in window-relative coordinates. Value is 29857 rectangle R. R is in window-relative coordinates. Value is
29949 non-zero if mouse-face was overwritten. */ 29858 true if mouse-face was overwritten. */
29950 29859
29951static int 29860static bool
29952expose_line (struct window *w, struct glyph_row *row, XRectangle *r) 29861expose_line (struct window *w, struct glyph_row *row, XRectangle *r)
29953{ 29862{
29954 eassert (row->enabled_p); 29863 eassert (row->enabled_p);
@@ -30007,9 +29916,9 @@ expose_overlaps (struct window *w,
30007} 29916}
30008 29917
30009 29918
30010/* Return non-zero if W's cursor intersects rectangle R. */ 29919/* Return true if W's cursor intersects rectangle R. */
30011 29920
30012static int 29921static bool
30013phys_cursor_in_rect_p (struct window *w, XRectangle *r) 29922phys_cursor_in_rect_p (struct window *w, XRectangle *r)
30014{ 29923{
30015 XRectangle cr, result; 29924 XRectangle cr, result;
@@ -30047,7 +29956,7 @@ phys_cursor_in_rect_p (struct window *w, XRectangle *r)
30047 return x_intersect_rectangles (&cr, r, &result); 29956 return x_intersect_rectangles (&cr, r, &result);
30048 } 29957 }
30049 /* If we don't understand the format, pretend we're not in the hot-spot. */ 29958 /* If we don't understand the format, pretend we're not in the hot-spot. */
30050 return 0; 29959 return false;
30051} 29960}
30052 29961
30053 29962
@@ -30145,22 +30054,22 @@ x_draw_bottom_divider (struct window *w)
30145 30054
30146/* Redraw the part of window W intersection rectangle FR. Pixel 30055/* Redraw the part of window W intersection rectangle FR. Pixel
30147 coordinates in FR are frame-relative. Call this function with 30056 coordinates in FR are frame-relative. Call this function with
30148 input blocked. Value is non-zero if the exposure overwrites 30057 input blocked. Value is true if the exposure overwrites
30149 mouse-face. */ 30058 mouse-face. */
30150 30059
30151static int 30060static bool
30152expose_window (struct window *w, XRectangle *fr) 30061expose_window (struct window *w, XRectangle *fr)
30153{ 30062{
30154 struct frame *f = XFRAME (w->frame); 30063 struct frame *f = XFRAME (w->frame);
30155 XRectangle wr, r; 30064 XRectangle wr, r;
30156 int mouse_face_overwritten_p = 0; 30065 bool mouse_face_overwritten_p = false;
30157 30066
30158 /* If window is not yet fully initialized, do nothing. This can 30067 /* If window is not yet fully initialized, do nothing. This can
30159 happen when toolkit scroll bars are used and a window is split. 30068 happen when toolkit scroll bars are used and a window is split.
30160 Reconfiguring the scroll bar will generate an expose for a newly 30069 Reconfiguring the scroll bar will generate an expose for a newly
30161 created window. */ 30070 created window. */
30162 if (w->current_matrix == NULL) 30071 if (w->current_matrix == NULL)
30163 return 0; 30072 return false;
30164 30073
30165 /* When we're currently updating the window, display and current 30074 /* When we're currently updating the window, display and current
30166 matrix usually don't agree. Arrange for a thorough display 30075 matrix usually don't agree. Arrange for a thorough display
@@ -30168,7 +30077,7 @@ expose_window (struct window *w, XRectangle *fr)
30168 if (w->must_be_updated_p) 30077 if (w->must_be_updated_p)
30169 { 30078 {
30170 SET_FRAME_GARBAGED (f); 30079 SET_FRAME_GARBAGED (f);
30171 return 0; 30080 return false;
30172 } 30081 }
30173 30082
30174 /* Frame-relative pixel rectangle of W. */ 30083 /* Frame-relative pixel rectangle of W. */
@@ -30181,7 +30090,6 @@ expose_window (struct window *w, XRectangle *fr)
30181 { 30090 {
30182 int yb = window_text_bottom_y (w); 30091 int yb = window_text_bottom_y (w);
30183 struct glyph_row *row; 30092 struct glyph_row *row;
30184 int cursor_cleared_p, phys_cursor_on_p;
30185 struct glyph_row *first_overlapping_row, *last_overlapping_row; 30093 struct glyph_row *first_overlapping_row, *last_overlapping_row;
30186 30094
30187 TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n", 30095 TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n",
@@ -30192,21 +30100,17 @@ expose_window (struct window *w, XRectangle *fr)
30192 r.y -= WINDOW_TOP_EDGE_Y (w); 30100 r.y -= WINDOW_TOP_EDGE_Y (w);
30193 30101
30194 /* Turn off the cursor. */ 30102 /* Turn off the cursor. */
30195 if (!w->pseudo_window_p 30103 bool cursor_cleared_p = (!w->pseudo_window_p
30196 && phys_cursor_in_rect_p (w, &r)) 30104 && phys_cursor_in_rect_p (w, &r));
30197 { 30105 if (cursor_cleared_p)
30198 x_clear_cursor (w); 30106 x_clear_cursor (w);
30199 cursor_cleared_p = 1;
30200 }
30201 else
30202 cursor_cleared_p = 0;
30203 30107
30204 /* If the row containing the cursor extends face to end of line, 30108 /* If the row containing the cursor extends face to end of line,
30205 then expose_area might overwrite the cursor outside the 30109 then expose_area might overwrite the cursor outside the
30206 rectangle and thus notice_overwritten_cursor might clear 30110 rectangle and thus notice_overwritten_cursor might clear
30207 w->phys_cursor_on_p. We remember the original value and 30111 w->phys_cursor_on_p. We remember the original value and
30208 check later if it is changed. */ 30112 check later if it is changed. */
30209 phys_cursor_on_p = w->phys_cursor_on_p; 30113 bool phys_cursor_on_p = w->phys_cursor_on_p;
30210 30114
30211 /* Update lines intersecting rectangle R. */ 30115 /* Update lines intersecting rectangle R. */
30212 first_overlapping_row = last_overlapping_row = NULL; 30116 first_overlapping_row = last_overlapping_row = NULL;
@@ -30233,7 +30137,7 @@ expose_window (struct window *w, XRectangle *fr)
30233 30137
30234 row->clip = fr; 30138 row->clip = fr;
30235 if (expose_line (w, row, &r)) 30139 if (expose_line (w, row, &r))
30236 mouse_face_overwritten_p = 1; 30140 mouse_face_overwritten_p = true;
30237 row->clip = NULL; 30141 row->clip = NULL;
30238 } 30142 }
30239 else if (row->overlapping_p) 30143 else if (row->overlapping_p)
@@ -30260,7 +30164,7 @@ expose_window (struct window *w, XRectangle *fr)
30260 && row->y < r.y + r.height) 30164 && row->y < r.y + r.height)
30261 { 30165 {
30262 if (expose_line (w, row, &r)) 30166 if (expose_line (w, row, &r))
30263 mouse_face_overwritten_p = 1; 30167 mouse_face_overwritten_p = true;
30264 } 30168 }
30265 30169
30266 if (!w->pseudo_window_p) 30170 if (!w->pseudo_window_p)
@@ -30282,7 +30186,7 @@ expose_window (struct window *w, XRectangle *fr)
30282 /* Turn the cursor on again. */ 30186 /* Turn the cursor on again. */
30283 if (cursor_cleared_p 30187 if (cursor_cleared_p
30284 || (phys_cursor_on_p && !w->phys_cursor_on_p)) 30188 || (phys_cursor_on_p && !w->phys_cursor_on_p))
30285 update_window_cursor (w, 1); 30189 update_window_cursor (w, true);
30286 } 30190 }
30287 } 30191 }
30288 30192
@@ -30293,21 +30197,20 @@ expose_window (struct window *w, XRectangle *fr)
30293 30197
30294/* Redraw (parts) of all windows in the window tree rooted at W that 30198/* Redraw (parts) of all windows in the window tree rooted at W that
30295 intersect R. R contains frame pixel coordinates. Value is 30199 intersect R. R contains frame pixel coordinates. Value is
30296 non-zero if the exposure overwrites mouse-face. */ 30200 true if the exposure overwrites mouse-face. */
30297 30201
30298static int 30202static bool
30299expose_window_tree (struct window *w, XRectangle *r) 30203expose_window_tree (struct window *w, XRectangle *r)
30300{ 30204{
30301 struct frame *f = XFRAME (w->frame); 30205 struct frame *f = XFRAME (w->frame);
30302 int mouse_face_overwritten_p = 0; 30206 bool mouse_face_overwritten_p = false;
30303 30207
30304 while (w && !FRAME_GARBAGED_P (f)) 30208 while (w && !FRAME_GARBAGED_P (f))
30305 { 30209 {
30306 if (WINDOWP (w->contents)) 30210 mouse_face_overwritten_p
30307 mouse_face_overwritten_p 30211 |= (WINDOWP (w->contents)
30308 |= expose_window_tree (XWINDOW (w->contents), r); 30212 ? expose_window_tree (XWINDOW (w->contents), r)
30309 else 30213 : expose_window (w, r));
30310 mouse_face_overwritten_p |= expose_window (w, r);
30311 30214
30312 w = NILP (w->next) ? NULL : XWINDOW (w->next); 30215 w = NILP (w->next) ? NULL : XWINDOW (w->next);
30313 } 30216 }
@@ -30326,7 +30229,7 @@ void
30326expose_frame (struct frame *f, int x, int y, int w, int h) 30229expose_frame (struct frame *f, int x, int y, int w, int h)
30327{ 30230{
30328 XRectangle r; 30231 XRectangle r;
30329 int mouse_face_overwritten_p = 0; 30232 bool mouse_face_overwritten_p = false;
30330 30233
30331 TRACE ((stderr, "expose_frame ")); 30234 TRACE ((stderr, "expose_frame "));
30332 30235
@@ -30409,15 +30312,15 @@ expose_frame (struct frame *f, int x, int y, int w, int h)
30409 30312
30410/* EXPORT: 30313/* EXPORT:
30411 Determine the intersection of two rectangles R1 and R2. Return 30314 Determine the intersection of two rectangles R1 and R2. Return
30412 the intersection in *RESULT. Value is non-zero if RESULT is not 30315 the intersection in *RESULT. Value is true if RESULT is not
30413 empty. */ 30316 empty. */
30414 30317
30415int 30318bool
30416x_intersect_rectangles (XRectangle *r1, XRectangle *r2, XRectangle *result) 30319x_intersect_rectangles (XRectangle *r1, XRectangle *r2, XRectangle *result)
30417{ 30320{
30418 XRectangle *left, *right; 30321 XRectangle *left, *right;
30419 XRectangle *upper, *lower; 30322 XRectangle *upper, *lower;
30420 int intersection_p = 0; 30323 bool intersection_p = false;
30421 30324
30422 /* Rearrange so that R1 is the left-most rectangle. */ 30325 /* Rearrange so that R1 is the left-most rectangle. */
30423 if (r1->x < r2->x) 30326 if (r1->x < r2->x)
@@ -30453,7 +30356,7 @@ x_intersect_rectangles (XRectangle *r1, XRectangle *r2, XRectangle *result)
30453 result->height = (min (lower->y + lower->height, 30356 result->height = (min (lower->y + lower->height,
30454 upper->y + upper->height) 30357 upper->y + upper->height)
30455 - result->y); 30358 - result->y);
30456 intersection_p = 1; 30359 intersection_p = true;
30457 } 30360 }
30458 } 30361 }
30459 30362
@@ -30770,7 +30673,7 @@ line number may be omitted from the mode line. */);
30770 30673
30771 DEFVAR_BOOL ("highlight-nonselected-windows", highlight_nonselected_windows, 30674 DEFVAR_BOOL ("highlight-nonselected-windows", highlight_nonselected_windows,
30772 doc: /* Non-nil means highlight region even in nonselected windows. */); 30675 doc: /* Non-nil means highlight region even in nonselected windows. */);
30773 highlight_nonselected_windows = 0; 30676 highlight_nonselected_windows = false;
30774 30677
30775 DEFVAR_BOOL ("multiple-frames", multiple_frames, 30678 DEFVAR_BOOL ("multiple-frames", multiple_frames,
30776 doc: /* Non-nil if more than one frame is visible on this display. 30679 doc: /* Non-nil if more than one frame is visible on this display.
@@ -30873,11 +30776,11 @@ automatically; to decrease the tool-bar height, use \\[recenter]. */);
30873 30776
30874 DEFVAR_BOOL ("auto-raise-tool-bar-buttons", auto_raise_tool_bar_buttons_p, 30777 DEFVAR_BOOL ("auto-raise-tool-bar-buttons", auto_raise_tool_bar_buttons_p,
30875 doc: /* Non-nil means raise tool-bar buttons when the mouse moves over them. */); 30778 doc: /* Non-nil means raise tool-bar buttons when the mouse moves over them. */);
30876 auto_raise_tool_bar_buttons_p = 1; 30779 auto_raise_tool_bar_buttons_p = true;
30877 30780
30878 DEFVAR_BOOL ("make-cursor-line-fully-visible", make_cursor_line_fully_visible_p, 30781 DEFVAR_BOOL ("make-cursor-line-fully-visible", make_cursor_line_fully_visible_p,
30879 doc: /* Non-nil means to scroll (recenter) cursor line if it is not fully visible. */); 30782 doc: /* Non-nil means to scroll (recenter) cursor line if it is not fully visible. */);
30880 make_cursor_line_fully_visible_p = 1; 30783 make_cursor_line_fully_visible_p = true;
30881 30784
30882 DEFVAR_LISP ("tool-bar-border", Vtool_bar_border, 30785 DEFVAR_LISP ("tool-bar-border", Vtool_bar_border,
30883 doc: /* Border below tool-bar in pixels. 30786 doc: /* Border below tool-bar in pixels.
@@ -30936,7 +30839,7 @@ displayed according to the current fontset.
30936 30839
30937Note that this variable affects only how these bytes are displayed, 30840Note that this variable affects only how these bytes are displayed,
30938but does not change the fact they are interpreted as raw bytes. */); 30841but does not change the fact they are interpreted as raw bytes. */);
30939 unibyte_display_via_language_environment = 0; 30842 unibyte_display_via_language_environment = false;
30940 30843
30941 DEFVAR_LISP ("max-mini-window-height", Vmax_mini_window_height, 30844 DEFVAR_LISP ("max-mini-window-height", Vmax_mini_window_height,
30942 doc: /* Maximum height for resizing mini-windows (the minibuffer and the echo area). 30845 doc: /* Maximum height for resizing mini-windows (the minibuffer and the echo area).
@@ -30969,7 +30872,7 @@ the frame's other specifications determine how to blink the cursor off. */);
30969 doc: /* Allow or disallow automatic horizontal scrolling of windows. 30872 doc: /* Allow or disallow automatic horizontal scrolling of windows.
30970If non-nil, windows are automatically scrolled horizontally to make 30873If non-nil, windows are automatically scrolled horizontally to make
30971point visible. */); 30874point visible. */);
30972 automatic_hscrolling_p = 1; 30875 automatic_hscrolling_p = true;
30973 DEFSYM (Qauto_hscroll_mode, "auto-hscroll-mode"); 30876 DEFSYM (Qauto_hscroll_mode, "auto-hscroll-mode");
30974 30877
30975 DEFVAR_INT ("hscroll-margin", hscroll_margin, 30878 DEFVAR_INT ("hscroll-margin", hscroll_margin,
@@ -30998,7 +30901,7 @@ and `scroll-right' overrides this variable's effect. */);
30998 DEFVAR_BOOL ("message-truncate-lines", message_truncate_lines, 30901 DEFVAR_BOOL ("message-truncate-lines", message_truncate_lines,
30999 doc: /* If non-nil, messages are truncated instead of resizing the echo area. 30902 doc: /* If non-nil, messages are truncated instead of resizing the echo area.
31000Bind this around calls to `message' to let it take effect. */); 30903Bind this around calls to `message' to let it take effect. */);
31001 message_truncate_lines = 0; 30904 message_truncate_lines = false;
31002 30905
31003 DEFVAR_LISP ("menu-bar-update-hook", Vmenu_bar_update_hook, 30906 DEFVAR_LISP ("menu-bar-update-hook", Vmenu_bar_update_hook,
31004 doc: /* Normal hook run to update the menu bar definitions. 30907 doc: /* Normal hook run to update the menu bar definitions.
@@ -31014,7 +30917,7 @@ The enable predicate for a menu binding should check this variable. */);
31014 30917
31015 DEFVAR_BOOL ("inhibit-menubar-update", inhibit_menubar_update, 30918 DEFVAR_BOOL ("inhibit-menubar-update", inhibit_menubar_update,
31016 doc: /* Non-nil means don't update menu bars. Internal use only. */); 30919 doc: /* Non-nil means don't update menu bars. Internal use only. */);
31017 inhibit_menubar_update = 0; 30920 inhibit_menubar_update = false;
31018 30921
31019 DEFVAR_LISP ("wrap-prefix", Vwrap_prefix, 30922 DEFVAR_LISP ("wrap-prefix", Vwrap_prefix,
31020 doc: /* Prefix prepended to all continuation lines at display time. 30923 doc: /* Prefix prepended to all continuation lines at display time.
@@ -31044,30 +30947,30 @@ To add a prefix to continuation lines, use `wrap-prefix'. */);
31044 30947
31045 DEFVAR_BOOL ("inhibit-eval-during-redisplay", inhibit_eval_during_redisplay, 30948 DEFVAR_BOOL ("inhibit-eval-during-redisplay", inhibit_eval_during_redisplay,
31046 doc: /* Non-nil means don't eval Lisp during redisplay. */); 30949 doc: /* Non-nil means don't eval Lisp during redisplay. */);
31047 inhibit_eval_during_redisplay = 0; 30950 inhibit_eval_during_redisplay = false;
31048 30951
31049 DEFVAR_BOOL ("inhibit-free-realized-faces", inhibit_free_realized_faces, 30952 DEFVAR_BOOL ("inhibit-free-realized-faces", inhibit_free_realized_faces,
31050 doc: /* Non-nil means don't free realized faces. Internal use only. */); 30953 doc: /* Non-nil means don't free realized faces. Internal use only. */);
31051 inhibit_free_realized_faces = 0; 30954 inhibit_free_realized_faces = false;
31052 30955
31053 DEFVAR_BOOL ("inhibit-bidi-mirroring", inhibit_bidi_mirroring, 30956 DEFVAR_BOOL ("inhibit-bidi-mirroring", inhibit_bidi_mirroring,
31054 doc: /* Non-nil means don't mirror characters even when bidi context requires that. 30957 doc: /* Non-nil means don't mirror characters even when bidi context requires that.
31055Intended for use during debugging and for testing bidi display; 30958Intended for use during debugging and for testing bidi display;
31056see biditest.el in the test suite. */); 30959see biditest.el in the test suite. */);
31057 inhibit_bidi_mirroring = 0; 30960 inhibit_bidi_mirroring = false;
31058 30961
31059#ifdef GLYPH_DEBUG 30962#ifdef GLYPH_DEBUG
31060 DEFVAR_BOOL ("inhibit-try-window-id", inhibit_try_window_id, 30963 DEFVAR_BOOL ("inhibit-try-window-id", inhibit_try_window_id,
31061 doc: /* Inhibit try_window_id display optimization. */); 30964 doc: /* Inhibit try_window_id display optimization. */);
31062 inhibit_try_window_id = 0; 30965 inhibit_try_window_id = false;
31063 30966
31064 DEFVAR_BOOL ("inhibit-try-window-reusing", inhibit_try_window_reusing, 30967 DEFVAR_BOOL ("inhibit-try-window-reusing", inhibit_try_window_reusing,
31065 doc: /* Inhibit try_window_reusing display optimization. */); 30968 doc: /* Inhibit try_window_reusing display optimization. */);
31066 inhibit_try_window_reusing = 0; 30969 inhibit_try_window_reusing = false;
31067 30970
31068 DEFVAR_BOOL ("inhibit-try-cursor-movement", inhibit_try_cursor_movement, 30971 DEFVAR_BOOL ("inhibit-try-cursor-movement", inhibit_try_cursor_movement,
31069 doc: /* Inhibit try_cursor_movement display optimization. */); 30972 doc: /* Inhibit try_cursor_movement display optimization. */);
31070 inhibit_try_cursor_movement = 0; 30973 inhibit_try_cursor_movement = false;
31071#endif /* GLYPH_DEBUG */ 30974#endif /* GLYPH_DEBUG */
31072 30975
31073 DEFVAR_INT ("overline-margin", overline_margin, 30976 DEFVAR_INT ("overline-margin", overline_margin,
@@ -31089,7 +30992,7 @@ baseline. The default value is 1. */);
31089 doc: /* Non-nil means show an hourglass pointer, when Emacs is busy. 30992 doc: /* Non-nil means show an hourglass pointer, when Emacs is busy.
31090This feature only works when on a window system that can change 30993This feature only works when on a window system that can change
31091cursor shapes. */); 30994cursor shapes. */);
31092 display_hourglass_p = 1; 30995 display_hourglass_p = true;
31093 30996
31094 DEFVAR_LISP ("hourglass-delay", Vhourglass_delay, 30997 DEFVAR_LISP ("hourglass-delay", Vhourglass_delay,
31095 doc: /* Seconds to wait before displaying an hourglass pointer when Emacs is busy. */); 30998 doc: /* Seconds to wait before displaying an hourglass pointer when Emacs is busy. */);
@@ -31097,7 +31000,7 @@ cursor shapes. */);
31097 31000
31098#ifdef HAVE_WINDOW_SYSTEM 31001#ifdef HAVE_WINDOW_SYSTEM
31099 hourglass_atimer = NULL; 31002 hourglass_atimer = NULL;
31100 hourglass_shown_p = 0; 31003 hourglass_shown_p = false;
31101#endif /* HAVE_WINDOW_SYSTEM */ 31004#endif /* HAVE_WINDOW_SYSTEM */
31102 31005
31103 /* Name of the face used to display glyphless characters. */ 31006 /* Name of the face used to display glyphless characters. */
@@ -31211,7 +31114,7 @@ init_xdisp (void)
31211 mode_line_target = MODE_LINE_DISPLAY; 31114 mode_line_target = MODE_LINE_DISPLAY;
31212 } 31115 }
31213 31116
31214 help_echo_showing_p = 0; 31117 help_echo_showing_p = false;
31215} 31118}
31216 31119
31217#ifdef HAVE_WINDOW_SYSTEM 31120#ifdef HAVE_WINDOW_SYSTEM
@@ -31243,7 +31146,7 @@ show_hourglass (struct atimer *timer)
31243 FRAME_RIF (f)->show_hourglass (f); 31146 FRAME_RIF (f)->show_hourglass (f);
31244 } 31147 }
31245 31148
31246 hourglass_shown_p = 1; 31149 hourglass_shown_p = true;
31247 unblock_input (); 31150 unblock_input ();
31248 } 31151 }
31249} 31152}
@@ -31304,7 +31207,7 @@ cancel_hourglass (void)
31304#endif 31207#endif
31305 } 31208 }
31306 31209
31307 hourglass_shown_p = 0; 31210 hourglass_shown_p = false;
31308 unblock_input (); 31211 unblock_input ();
31309 } 31212 }
31310} 31213}