[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/insdel.c
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] Changes to emacs/src/insdel.c |
Date: |
Thu, 26 Jun 2003 19:17:29 -0400 |
Index: emacs/src/insdel.c
diff -c emacs/src/insdel.c:1.173 emacs/src/insdel.c:1.174
*** emacs/src/insdel.c:1.173 Tue Feb 4 09:03:12 2003
--- emacs/src/insdel.c Thu Jun 26 19:17:29 2003
***************
*** 1,5 ****
/* Buffer insertion/deletion and gap motion for GNU Emacs.
! Copyright (C) 1985, 86,93,94,95,97,98, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GNU Emacs.
--- 1,5 ----
/* Buffer insertion/deletion and gap motion for GNU Emacs.
! Copyright (C) 1985, 86,93,94,95,97,98, 1999, 2000, 01, 2003
Free Software Foundation, Inc.
This file is part of GNU Emacs.
***************
*** 79,101 ****
void
check_markers ()
{
! register Lisp_Object tail;
int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
! tail = BUF_MARKERS (current_buffer);
!
! while (! NILP (tail))
{
! if (XMARKER (tail)->buffer->text != current_buffer->text)
abort ();
! if (XMARKER (tail)->charpos > Z)
abort ();
! if (XMARKER (tail)->bytepos > Z_BYTE)
abort ();
! if (multibyte && ! CHAR_HEAD_P (FETCH_BYTE (XMARKER (tail)->bytepos)))
abort ();
-
- tail = XMARKER (tail)->chain;
}
}
--- 79,97 ----
void
check_markers ()
{
! register struct Lisp_Marker *tail;
int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
! for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next)
{
! if (tail->buffer->text != current_buffer->text)
abort ();
! if (tail->charpos > Z)
abort ();
! if (tail->bytepos > Z_BYTE)
abort ();
! if (multibyte && ! CHAR_HEAD_P (FETCH_BYTE (tail->bytepos)))
abort ();
}
}
***************
*** 350,360 ****
register struct Lisp_Marker *m;
register int charpos;
! marker = BUF_MARKERS (current_buffer);
!
! while (!NILP (marker))
{
- m = XMARKER (marker);
charpos = m->charpos;
if (charpos > Z)
--- 346,353 ----
register struct Lisp_Marker *m;
register int charpos;
! for (m = BUF_MARKERS (current_buffer); m; m = m->next)
{
charpos = m->charpos;
if (charpos > Z)
***************
*** 371,386 ****
else if (charpos > from)
{
if (! m->insertion_type)
! /* Normal markers will end up at the beginning of the
re-inserted text after undoing a deletion, and must be
adjusted to move them to the correct place. */
record_marker_adjustment (marker, from - charpos);
else if (charpos < to)
! /* Before-insertion markers will automatically move forward
upon re-inserting the deleted text, so we have to arrange
for them to move backward to the correct position. */
record_marker_adjustment (marker, charpos - to);
!
m->charpos = from;
m->bytepos = from_byte;
}
--- 364,382 ----
else if (charpos > from)
{
if (! m->insertion_type)
! { /* Normal markers will end up at the beginning of the
re-inserted text after undoing a deletion, and must be
adjusted to move them to the correct place. */
+ XSETMISC (marker, m);
record_marker_adjustment (marker, from - charpos);
+ }
else if (charpos < to)
! { /* Before-insertion markers will automatically move forward
upon re-inserting the deleted text, so we have to arrange
for them to move backward to the correct position. */
+ XSETMISC (marker, m);
record_marker_adjustment (marker, charpos - to);
! }
m->charpos = from;
m->bytepos = from_byte;
}
***************
*** 392,401 ****
incorrectly make MARKER move forward, so we arrange for it
to then move backward to the correct place at the beginning
of the deleted region. */
record_marker_adjustment (marker, to - from);
}
-
- marker = m->chain;
}
}
--- 388,396 ----
incorrectly make MARKER move forward, so we arrange for it
to then move backward to the correct place at the beginning
of the deleted region. */
+ XSETMISC (marker, m);
record_marker_adjustment (marker, to - from);
}
}
}
***************
*** 413,429 ****
register int from, from_byte, to, to_byte;
int before_markers;
{
! Lisp_Object marker;
int adjusted = 0;
int nchars = to - from;
int nbytes = to_byte - from_byte;
! marker = BUF_MARKERS (current_buffer);
!
! while (!NILP (marker))
{
- register struct Lisp_Marker *m = XMARKER (marker);
-
/* In a single-byte buffer, a marker's two positions must be
equal. */
if (Z == Z_BYTE)
--- 408,420 ----
register int from, from_byte, to, to_byte;
int before_markers;
{
! struct Lisp_Marker *m;
int adjusted = 0;
int nchars = to - from;
int nbytes = to_byte - from_byte;
! for (m = BUF_MARKERS (current_buffer); m; m = m->next)
{
/* In a single-byte buffer, a marker's two positions must be
equal. */
if (Z == Z_BYTE)
***************
*** 447,454 ****
m->bytepos += nbytes;
m->charpos += nchars;
}
-
- marker = m->chain;
}
/* Adjusting only markers whose insertion-type is t may result in
--- 438,443 ----
***************
*** 490,504 ****
new_chars, new_bytes)
int from, from_byte, old_chars, old_bytes, new_chars, new_bytes;
{
! Lisp_Object marker = BUF_MARKERS (current_buffer);
int prev_to_byte = from_byte + old_bytes;
int diff_chars = new_chars - old_chars;
int diff_bytes = new_bytes - old_bytes;
! while (!NILP (marker))
{
- register struct Lisp_Marker *m = XMARKER (marker);
-
if (m->bytepos >= prev_to_byte)
{
m->charpos += diff_chars;
--- 479,491 ----
new_chars, new_bytes)
int from, from_byte, old_chars, old_bytes, new_chars, new_bytes;
{
! register struct Lisp_Marker *m;
int prev_to_byte = from_byte + old_bytes;
int diff_chars = new_chars - old_chars;
int diff_bytes = new_bytes - old_bytes;
! for (m = BUF_MARKERS (current_buffer); m; m = m->next)
{
if (m->bytepos >= prev_to_byte)
{
m->charpos += diff_chars;
***************
*** 509,516 ****
m->charpos = from;
m->bytepos = from_byte;
}
-
- marker = m->chain;
}
CHECK_MARKERS ();
--- 496,501 ----
***************
*** 1930,1936 ****
GCPRO1 (preserve_marker);
verify_interval_modification (current_buffer, start, end);
*preserve_ptr = marker_position (preserve_marker);
! unchain_marker (preserve_marker);
UNGCPRO;
}
else
--- 1915,1921 ----
GCPRO1 (preserve_marker);
verify_interval_modification (current_buffer, start, end);
*preserve_ptr = marker_position (preserve_marker);
! unchain_marker (XMARKER (preserve_marker));
UNGCPRO;
}
else
***************
*** 1978,1984 ****
if (! NILP (preserve_marker)) \
{ \
*preserve_ptr = marker_position (preserve_marker); \
! unchain_marker (preserve_marker); \
}
#define PRESERVE_START_END \
--- 1963,1969 ----
if (! NILP (preserve_marker)) \
{ \
*preserve_ptr = marker_position (preserve_marker); \
! unchain_marker (XMARKER (preserve_marker)); \
}
#define PRESERVE_START_END \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/src/insdel.c,
Stefan Monnier <=