changeset 25184:290fceb2b1c0

(switch_to_buffer_1): New subroutine, taken out from Fswitch_to_buffer. (no_switch_buffer): New function. (Fswitch_to_buffer): Call them. Don't get confused by "same-window" buffers in a dedicated frame.
author Richard M. Stallman <rms@gnu.org>
date Fri, 06 Aug 1999 11:45:48 +0000
parents 16937a774275
children d3614d7b7583
files src/buffer.c
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/buffer.c	Fri Aug 06 00:51:50 1999 +0000
+++ b/src/buffer.c	Fri Aug 06 11:45:48 1999 +0000
@@ -2007,7 +2007,8 @@
    Store in *NEXT_PTR the next position after POS where an overlay starts,
      or ZV if there are no more overlays.
    Store in *PREV_PTR the previous position before POS where an overlay ends,
-     or BEGV if there are no previous overlays.
+     or where an overlay starts which ends at or after POS;
+     or BEGV if there are no such overlays.
    NEXT_PTR and/or PREV_PTR may be 0, meaning don't store that info.
 
    *VEC_PTR and *LEN_PTR should contain a valid vector and size
@@ -2052,9 +2053,13 @@
 	    prev = endpos;
 	  break;
 	}
+      startpos = OVERLAY_POSITION (start);
+      /* This one ends at or after POS
+	 so its start counts for NEXT_PTR if it's before POS.  */
+      if (prev < startpos && startpos < pos)
+	prev = startpos;
       if (endpos == pos)
 	continue;
-      startpos = OVERLAY_POSITION (start);
       if (startpos <= pos)
 	{
 	  if (idx == len)
@@ -2121,9 +2126,14 @@
 	  if (!inhibit_storing)
 	    vec[idx] = overlay;
 	  idx++;
+
+	  if (startpos < pos && startpos > prev)
+	    prev = startpos;
 	}
       else if (endpos < pos && endpos > prev)
 	prev = endpos;
+      else if (endpos == pos && startpos > prev)
+	prev = startpos;
     }
 
   if (next_ptr)