Mercurial > emacs
comparison src/buffer.c @ 11473:24ede15e0aaa
(adjust_overlays_for_insert): New function.
(adjust_overlays_for_delete): New function.
| author | Karl Heuer <kwzh@gnu.org> |
|---|---|
| date | Mon, 17 Apr 1995 23:13:56 +0000 |
| parents | f892e7cb7f51 |
| children | f9b6e65774e7 |
comparison
equal
deleted
inserted
replaced
| 11472:b2ccbdb6336f | 11473:24ede15e0aaa |
|---|---|
| 1934 tail = prev; | 1934 tail = prev; |
| 1935 } | 1935 } |
| 1936 } | 1936 } |
| 1937 | 1937 |
| 1938 XSETFASTINT (buf->overlay_center, pos); | 1938 XSETFASTINT (buf->overlay_center, pos); |
| 1939 } | |
| 1940 | |
| 1941 void | |
| 1942 adjust_overlays_for_insert (pos, length) | |
| 1943 int pos; | |
| 1944 int length; | |
| 1945 { | |
| 1946 /* After an insertion, the lists are still sorted properly, | |
| 1947 but we may need to update the value of the overlay center. */ | |
| 1948 if (XFASTINT (current_buffer->overlay_center) >= pos) | |
| 1949 XSETFASTINT (current_buffer->overlay_center, | |
| 1950 XFASTINT (current_buffer->overlay_center) + length); | |
| 1951 } | |
| 1952 | |
| 1953 void | |
| 1954 adjust_overlays_for_delete (pos, length) | |
| 1955 int pos; | |
| 1956 int length; | |
| 1957 { | |
| 1958 if (XFASTINT (current_buffer->overlay_center) < pos) | |
| 1959 /* The deletion was to our right. No change needed; the before- and | |
| 1960 after-lists are still consistent. */ | |
| 1961 ; | |
| 1962 else if (XFASTINT (current_buffer->overlay_center) > pos + length) | |
| 1963 /* The deletion was to our left. We need to adjust the center value | |
| 1964 to account for the change in position, but the lists are consistent | |
| 1965 given the new value. */ | |
| 1966 XSETFASTINT (current_buffer->overlay_center, | |
| 1967 XFASTINT (current_buffer->overlay_center) - length); | |
| 1968 else | |
| 1969 /* We're right in the middle. There might be things on the after-list | |
| 1970 that now belong on the before-list. Recentering will move them, | |
| 1971 and also update the center point. */ | |
| 1972 recenter_overlay_lists (current_buffer, pos); | |
| 1939 } | 1973 } |
| 1940 | 1974 |
| 1941 /* Fix up overlays that were garbled as a result of permuting markers | 1975 /* Fix up overlays that were garbled as a result of permuting markers |
| 1942 in the range START through END. Any overlay with at least one | 1976 in the range START through END. Any overlay with at least one |
| 1943 endpoint in this range will need to be unlinked from the overlay | 1977 endpoint in this range will need to be unlinked from the overlay |
