[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/insdel.c
From: |
Andrew Innes |
Subject: |
[Emacs-diffs] Changes to emacs/src/insdel.c |
Date: |
Wed, 05 Dec 2001 16:37:11 -0500 |
Index: emacs/src/insdel.c
diff -c emacs/src/insdel.c:1.161 emacs/src/insdel.c:1.162
*** emacs/src/insdel.c:1.161 Tue Nov 13 02:47:32 2001
--- emacs/src/insdel.c Wed Dec 5 16:37:11 2001
***************
*** 520,526 ****
/* Make the gap NBYTES_ADDED bytes longer. */
void
! make_gap (nbytes_added)
int nbytes_added;
{
Lisp_Object tem;
--- 520,526 ----
/* Make the gap NBYTES_ADDED bytes longer. */
void
! make_gap_larger (nbytes_added)
int nbytes_added;
{
Lisp_Object tem;
***************
*** 567,572 ****
--- 567,641 ----
*(Z_ADDR) = 0;
Vinhibit_quit = tem;
+ }
+
+
+ /* Make the gap NBYTES_REMOVED bytes shorted. */
+
+ void
+ make_gap_smaller (nbytes_removed)
+ int nbytes_removed;
+ {
+ Lisp_Object tem;
+ int real_gap_loc;
+ int real_gap_loc_byte;
+ int real_Z;
+ int real_Z_byte;
+ int old_gap_size;
+
+ /* Make sure the gap is at least 20 bytes. */
+ if (GAP_SIZE - nbytes_removed < 20)
+ nbytes_removed = GAP_SIZE - 20;
+
+ /* Prevent quitting in move_gap. */
+ tem = Vinhibit_quit;
+ Vinhibit_quit = Qt;
+
+ real_gap_loc = GPT;
+ real_gap_loc_byte = GPT_BYTE;
+ old_gap_size = GAP_SIZE;
+ real_Z = Z;
+ real_Z_byte = Z_BYTE;
+
+ /* Pretend that the last unwanted part of the gap is the entire gap,
+ and that the first desired part of the gap is part of the buffer
+ text. */
+ bzero (GPT_ADDR, GAP_SIZE - nbytes_removed);
+ GPT += GAP_SIZE - nbytes_removed;
+ GPT_BYTE += GAP_SIZE - nbytes_removed;
+ Z += GAP_SIZE - nbytes_removed;
+ Z_BYTE += GAP_SIZE - nbytes_removed;
+ GAP_SIZE = nbytes_removed;
+
+ /* Move the unwanted pretend gap to the end of the buffer. This
+ adjusts the markers properly too. */
+ gap_right (Z, Z_BYTE);
+
+ enlarge_buffer_text (current_buffer, -nbytes_removed);
+
+ /* Now restore the desired gap. */
+ GAP_SIZE = old_gap_size - nbytes_removed;
+ GPT = real_gap_loc;
+ GPT_BYTE = real_gap_loc_byte;
+ Z = real_Z;
+ Z_BYTE = real_Z_byte;
+
+ /* Put an anchor. */
+ *(Z_ADDR) = 0;
+
+ Vinhibit_quit = tem;
+ }
+
+ void
+ make_gap (nbytes_added)
+ int nbytes_added;
+ {
+ if (nbytes_added >= 0)
+ make_gap_larger (nbytes_added);
+ #if defined (USE_MMAP_FOR_BUFFERS) || defined (REL_ALLOC)
+ else
+ make_gap_smaller (-nbytes_added);
+ #endif
}
/* Copy NBYTES bytes of text from FROM_ADDR to TO_ADDR.
- [Emacs-diffs] Changes to emacs/src/insdel.c,
Andrew Innes <=