#include "lisp.h"
#include "intervals.h"
#include "buffer.h"
+#include "charset.h"
#include "window.h"
#include "blockinput.h"
or may be where a quit was detected. */
adjust_markers (pos + 1, GPT, GAP_SIZE);
GPT = pos + 1;
+ if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
QUIT;
}
adjust_markers (GPT + GAP_SIZE, pos + 1 + GAP_SIZE, - GAP_SIZE);
GPT = pos + 1;
+ if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
QUIT;
}
register int pos, amount;
{
Lisp_Object marker;
+ int adjusted = 0;
marker = BUF_MARKERS (current_buffer);
{
register struct Lisp_Marker *m = XMARKER (marker);
if (m->insertion_type && m->bufpos == pos)
- m->bufpos += amount;
+ {
+ m->bufpos += amount;
+ adjusted = 1;
+ }
marker = m->chain;
}
+ if (adjusted)
+ /* Adjusting only markers whose insertion-type is t may result in
+ disordered overlays in the slot `overlays_before'. */
+ fix_overlays_before (current_buffer, pos, pos + amount);
}
/* Add the specified amount to point. This is used only when the value
error ("Buffer exceeds maximum size");
BLOCK_INPUT;
- result = BUFFER_REALLOC (BEG_ADDR, (Z - BEG + GAP_SIZE + increment));
+ /* We allocate extra 1-byte `\0' at the tail for anchoring a search. */
+ result = BUFFER_REALLOC (BEG_ADDR, (Z - BEG + GAP_SIZE + increment + 1));
if (result == 0)
{
GAP_SIZE += old_gap_size;
GPT = real_gap_loc;
+ /* Put an anchor. */
+ *(Z_ADDR) = 0;
+
Vinhibit_quit = tem;
}
\f
GPT += length;
ZV += length;
Z += length;
+ if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
adjust_overlays_for_insert (PT, length);
adjust_markers_for_insert (PT, length);
adjust_point (length);
GPT += length;
ZV += length;
Z += length;
+ if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
adjust_overlays_for_insert (PT, length);
adjust_markers_for_insert (PT, length);
GPT += length;
ZV += length;
Z += length;
+ if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */
adjust_overlays_for_insert (PT, length);
adjust_markers_for_insert (PT, length);
adjust_point (length);
void
insert_char (c)
- unsigned char c;
+ int c;
{
- insert (&c, 1);
+ unsigned char workbuf[4], *str;
+ int len = CHAR_STRING (c, workbuf, str);
+
+ insert (str, len);
}
/* Insert the null-terminated string S before point */
ZV -= numdel;
Z -= numdel;
GPT = from;
+ *(GPT_ADDR) = 0; /* Put an anchor. */
if (GPT - BEG < beg_unchanged)
beg_unchanged = GPT - BEG;