]> code.delx.au - gnu-emacs/blobdiff - src/xdisp.c
* search.c (find_newline): Return byte position in bytepos.
[gnu-emacs] / src / xdisp.c
index d2d4b3bbb792c45d5b455ed9da5a51e2c82385e9..6b86fd076a5e9e977c357729776b4b741d325d95 100644 (file)
@@ -910,8 +910,8 @@ static int forward_to_next_line_start (struct it *, int *, struct bidi_it *);
 static struct text_pos string_pos_nchars_ahead (struct text_pos,
                                                 Lisp_Object, ptrdiff_t);
 static struct text_pos string_pos (ptrdiff_t, Lisp_Object);
-static struct text_pos c_string_pos (ptrdiff_t, const char *, int);
-static ptrdiff_t number_of_chars (const char *, int);
+static struct text_pos c_string_pos (ptrdiff_t, const char *, bool);
+static ptrdiff_t number_of_chars (const char *, bool);
 static void compute_stop_pos (struct it *);
 static void compute_string_pos (struct text_pos *, struct text_pos,
                                 Lisp_Object);
@@ -1650,7 +1650,7 @@ string_pos (ptrdiff_t charpos, Lisp_Object string)
    means recognize multibyte characters.  */
 
 static struct text_pos
-c_string_pos (ptrdiff_t charpos, const char *s, int multibyte_p)
+c_string_pos (ptrdiff_t charpos, const char *s, bool multibyte_p)
 {
   struct text_pos pos;
 
@@ -1681,7 +1681,7 @@ c_string_pos (ptrdiff_t charpos, const char *s, int multibyte_p)
    non-zero means recognize multibyte characters.  */
 
 static ptrdiff_t
-number_of_chars (const char *s, int multibyte_p)
+number_of_chars (const char *s, bool multibyte_p)
 {
   ptrdiff_t nchars;
 
@@ -5905,8 +5905,9 @@ pop_it (struct it *it)
 static void
 back_to_previous_line_start (struct it *it)
 {
-  IT_CHARPOS (*it) = find_next_newline_no_quit (IT_CHARPOS (*it) - 1, -1);
-  IT_BYTEPOS (*it) = CHAR_TO_BYTE (IT_CHARPOS (*it));
+  IT_CHARPOS (*it)
+    = find_next_newline_no_quit (IT_CHARPOS (*it) - 1,
+                                -1, &IT_BYTEPOS (*it));
 }
 
 
@@ -5977,8 +5978,8 @@ forward_to_next_line_start (struct it *it, int *skipped_p,
      short-cut.  */
   if (!newline_found_p)
     {
-      ptrdiff_t start = IT_CHARPOS (*it);
-      ptrdiff_t limit = find_next_newline_no_quit (start, 1);
+      ptrdiff_t bytepos, start = IT_CHARPOS (*it);
+      ptrdiff_t limit = find_next_newline_no_quit (start, 1, &bytepos);
       Lisp_Object pos;
 
       eassert (!STRINGP (it->string));
@@ -5996,7 +5997,7 @@ forward_to_next_line_start (struct it *it, int *skipped_p,
          if (!it->bidi_p)
            {
              IT_CHARPOS (*it) = limit;
-             IT_BYTEPOS (*it) = CHAR_TO_BYTE (limit);
+             IT_BYTEPOS (*it) = bytepos;
            }
          else
            {
@@ -7432,11 +7433,9 @@ get_visually_first_element (struct it *it)
       if (string_p)
        it->bidi_it.charpos = it->bidi_it.bytepos = 0;
       else
-       {
-         it->bidi_it.charpos = find_next_newline_no_quit (IT_CHARPOS (*it),
-                                                          -1);
-         it->bidi_it.bytepos = CHAR_TO_BYTE (it->bidi_it.charpos);
-       }
+       it->bidi_it.charpos
+         = find_next_newline_no_quit (IT_CHARPOS (*it), -1,
+                                      &it->bidi_it.bytepos);
       bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, 1);
       do
        {
@@ -9071,7 +9070,7 @@ move_it_vertically_backward (struct it *it, int dy)
          && FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n')
        {
          ptrdiff_t nl_pos =
-           find_next_newline_no_quit (IT_CHARPOS (*it) - 1, -1);
+           find_next_newline_no_quit (IT_CHARPOS (*it) - 1, -1, NULL);
 
          move_it_to (it, nl_pos, -1, -1, -1, MOVE_TO_POS);
        }
@@ -9357,8 +9356,8 @@ message_log_maybe_newline (void)
 
 
 /* Add a string M of length NBYTES to the message log, optionally
-   terminated with a newline when NLFLAG is non-zero.  MULTIBYTE, if
-   nonzero, means interpret the contents of M as multibyte.  This
+   terminated with a newline when NLFLAG is true.  MULTIBYTE, if
+   true, means interpret the contents of M as multibyte.  This
    function calls low-level routines in order to bypass text property
    hooks, etc. which might not be safe to run.
 
@@ -9366,7 +9365,7 @@ message_log_maybe_newline (void)
    so the buffer M must NOT point to a Lisp string.  */
 
 void
-message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte)
+message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte)
 {
   const unsigned char *msg = (const unsigned char *) m;
 
@@ -9591,7 +9590,7 @@ message3 (Lisp_Object m)
   if (STRINGP (m))
     {
       ptrdiff_t nbytes = SBYTES (m);
-      int multibyte = STRING_MULTIBYTE (m);
+      bool multibyte = STRING_MULTIBYTE (m);
       USE_SAFE_ALLOCA;
       char *buffer = SAFE_ALLOCA (nbytes);
       memcpy (buffer, SDATA (m), nbytes);
@@ -18064,7 +18063,7 @@ get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string)
   const unsigned char *arrow_end = arrow_string + arrow_len;
   const unsigned char *p;
   struct it it;
-  int multibyte_p;
+  bool multibyte_p;
   int n_glyphs_before;
 
   set_buffer_temp (buffer);
@@ -20495,7 +20494,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
                                             risky);
                else if (c != 0)
                  {
-                   int multibyte;
+                   bool multibyte;
                    ptrdiff_t bytepos, charpos;
                    const char *spec;
                    Lisp_Object string;
@@ -21100,7 +21099,7 @@ static char *
 decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_flag)
 {
   Lisp_Object val;
-  int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
+  bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
   const unsigned char *eol_str;
   int eol_str_len;
   /* The EOL conversion we are using.  */
@@ -28244,6 +28243,9 @@ x_draw_vertical_border (struct window *w)
   if (FRAME_HAS_VERTICAL_SCROLL_BARS (XFRAME (w->frame)))
     return;
 
+  /* Note: It is necessary to redraw both the left and the right
+     borders, for when only this single window W is being
+     redisplayed.  */
   if (!WINDOW_RIGHTMOST_P (w)
       && !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
     {
@@ -28257,8 +28259,8 @@ x_draw_vertical_border (struct window *w)
 
       FRAME_RIF (f)->draw_vertical_window_border (w, x1, y0, y1);
     }
-  else if (!WINDOW_LEFTMOST_P (w)
-          && !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
+  if (!WINDOW_LEFTMOST_P (w)
+      && !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
     {
       int x0, x1, y0, y1;