# HG changeset patch # User Richard M. Stallman # Date 933939948 0 # Node ID 290fceb2b1c079607dbb4f4164fa474939ba193c # Parent 16937a774275ff3e3a05e743d02956951e27c940 (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. diff -r 16937a774275 -r 290fceb2b1c0 src/buffer.c --- 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)