aboutsummaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 5bd83ceb53f..8a373979eeb 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2007,7 +2007,8 @@ swap_out_buffer_local_variables (b)
2007 Store in *NEXT_PTR the next position after POS where an overlay starts, 2007 Store in *NEXT_PTR the next position after POS where an overlay starts,
2008 or ZV if there are no more overlays. 2008 or ZV if there are no more overlays.
2009 Store in *PREV_PTR the previous position before POS where an overlay ends, 2009 Store in *PREV_PTR the previous position before POS where an overlay ends,
2010 or BEGV if there are no previous overlays. 2010 or where an overlay starts which ends at or after POS;
2011 or BEGV if there are no such overlays.
2011 NEXT_PTR and/or PREV_PTR may be 0, meaning don't store that info. 2012 NEXT_PTR and/or PREV_PTR may be 0, meaning don't store that info.
2012 2013
2013 *VEC_PTR and *LEN_PTR should contain a valid vector and size 2014 *VEC_PTR and *LEN_PTR should contain a valid vector and size
@@ -2052,9 +2053,13 @@ overlays_at (pos, extend, vec_ptr, len_ptr, next_ptr, prev_ptr)
2052 prev = endpos; 2053 prev = endpos;
2053 break; 2054 break;
2054 } 2055 }
2056 startpos = OVERLAY_POSITION (start);
2057 /* This one ends at or after POS
2058 so its start counts for NEXT_PTR if it's before POS. */
2059 if (prev < startpos && startpos < pos)
2060 prev = startpos;
2055 if (endpos == pos) 2061 if (endpos == pos)
2056 continue; 2062 continue;
2057 startpos = OVERLAY_POSITION (start);
2058 if (startpos <= pos) 2063 if (startpos <= pos)
2059 { 2064 {
2060 if (idx == len) 2065 if (idx == len)
@@ -2121,9 +2126,14 @@ overlays_at (pos, extend, vec_ptr, len_ptr, next_ptr, prev_ptr)
2121 if (!inhibit_storing) 2126 if (!inhibit_storing)
2122 vec[idx] = overlay; 2127 vec[idx] = overlay;
2123 idx++; 2128 idx++;
2129
2130 if (startpos < pos && startpos > prev)
2131 prev = startpos;
2124 } 2132 }
2125 else if (endpos < pos && endpos > prev) 2133 else if (endpos < pos && endpos > prev)
2126 prev = endpos; 2134 prev = endpos;
2135 else if (endpos == pos && startpos > prev)
2136 prev = startpos;
2127 } 2137 }
2128 2138
2129 if (next_ptr) 2139 if (next_ptr)