Mercurial > hg > xemacs-beta
comparison src/insdel.c @ 183:e121b013d1f0 r20-3b18
Import from CVS: tag r20-3b18
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:54:23 +0200 |
parents | 85ec50267440 |
children | 3d6bfa290dbd |
comparison
equal
deleted
inserted
replaced
182:f07455f06202 | 183:e121b013d1f0 |
---|---|
2676 | 2676 |
2677 record_delete (buf, from, numdel); | 2677 record_delete (buf, from, numdel); |
2678 BUF_MODIFF (buf)++; | 2678 BUF_MODIFF (buf)++; |
2679 MARK_BUFFERS_CHANGED; | 2679 MARK_BUFFERS_CHANGED; |
2680 | 2680 |
2681 /* Relocate point as if it were a marker. */ | 2681 /* ### Point used to be modified here, but this causes problems with MULE, |
2682 if (bi_from < BI_BUF_PT (buf)) | 2682 as point is used to calculate bytinds, and if the offset in bc_numdel causes |
2683 { | 2683 point to move to a non first-byte location, causing some other function to |
2684 if (BI_BUF_PT (buf) < bi_to) | 2684 throw an assertion in ASSERT_VALID_BYTIND. I've moved the code to right after |
2685 JUST_SET_POINT (buf, from, bi_from); | 2685 the other movements and adjustments, but before the gap is moved. |
2686 else | 2686 -- jh 970813 */ |
2687 JUST_SET_POINT (buf, BUF_PT (buf) - numdel, | |
2688 BI_BUF_PT (buf) - bc_numdel); | |
2689 } | |
2690 | 2687 |
2691 /* Detach any extents that are completely within the range [FROM, TO], | 2688 /* Detach any extents that are completely within the range [FROM, TO], |
2692 if the extents are detachable. | 2689 if the extents are detachable. |
2693 | 2690 |
2694 This must come AFTER record_delete(), so that the appropriate extents | 2691 This must come AFTER record_delete(), so that the appropriate extents |
2704 (- bc_numdel - BUF_GAP_SIZE (buf))); | 2701 (- bc_numdel - BUF_GAP_SIZE (buf))); |
2705 | 2702 |
2706 /* Relocate any extent endpoints just like markers. */ | 2703 /* Relocate any extent endpoints just like markers. */ |
2707 adjust_extents_for_deletion (bufobj, bi_from, bi_to, BUF_GAP_SIZE (buf), | 2704 adjust_extents_for_deletion (bufobj, bi_from, bi_to, BUF_GAP_SIZE (buf), |
2708 bc_numdel, BUF_GAP_SIZE (buf)); | 2705 bc_numdel, BUF_GAP_SIZE (buf)); |
2706 | |
2707 /* Relocate point as if it were a marker. */ | |
2708 if (bi_from < BI_BUF_PT (buf)) | |
2709 { | |
2710 if (BI_BUF_PT (buf) < bi_to) | |
2711 JUST_SET_POINT (buf, from, bi_from); | |
2712 else | |
2713 JUST_SET_POINT (buf, BUF_PT (buf) - numdel, | |
2714 BI_BUF_PT (buf) - bc_numdel); | |
2715 } | |
2709 | 2716 |
2710 SET_BUF_GAP_SIZE (buf, BUF_GAP_SIZE (buf) + bc_numdel); | 2717 SET_BUF_GAP_SIZE (buf, BUF_GAP_SIZE (buf) + bc_numdel); |
2711 SET_BOTH_BUF_ZV (buf, BUF_ZV (buf) - numdel, BI_BUF_ZV (buf) - bc_numdel); | 2718 SET_BOTH_BUF_ZV (buf, BUF_ZV (buf) - numdel, BI_BUF_ZV (buf) - bc_numdel); |
2712 SET_BOTH_BUF_Z (buf, BUF_Z (buf) - numdel, BI_BUF_Z (buf) - bc_numdel); | 2719 SET_BOTH_BUF_Z (buf, BUF_Z (buf) - numdel, BI_BUF_Z (buf) - bc_numdel); |
2713 SET_BI_BUF_GPT (buf, bi_from); | 2720 SET_BI_BUF_GPT (buf, bi_from); |
2995 void | 3002 void |
2996 convert_emchar_string_into_bufbyte_dynarr (Emchar *arr, int nels, | 3003 convert_emchar_string_into_bufbyte_dynarr (Emchar *arr, int nels, |
2997 bufbyte_dynarr *dyn) | 3004 bufbyte_dynarr *dyn) |
2998 { | 3005 { |
2999 Bufbyte str[MAX_EMCHAR_LEN]; | 3006 Bufbyte str[MAX_EMCHAR_LEN]; |
3000 Bytecount len; | |
3001 int i; | 3007 int i; |
3002 | 3008 |
3003 for (i = 0; i < nels; i++) | 3009 for (i = 0; i < nels; i++) |
3004 { | 3010 { |
3005 len = set_charptr_emchar (str, arr[i]); | 3011 Bytecount len = set_charptr_emchar (str, arr[i]); |
3006 Dynarr_add_many (dyn, str, len); | 3012 Dynarr_add_many (dyn, str, len); |
3007 } | 3013 } |
3008 } | 3014 } |
3009 | 3015 |
3010 /* Convert an array of Emchars into the equivalent string representation. | 3016 /* Convert an array of Emchars into the equivalent string representation. |
3056 init_buffer_text (struct buffer *b, int indirect_p) | 3062 init_buffer_text (struct buffer *b, int indirect_p) |
3057 { | 3063 { |
3058 if (!indirect_p) | 3064 if (!indirect_p) |
3059 { | 3065 { |
3060 SET_BUF_GAP_SIZE (b, 20); | 3066 SET_BUF_GAP_SIZE (b, 20); |
3061 (void) BUFFER_ALLOC (b->text->beg, | 3067 BUFFER_ALLOC (b->text->beg, BUF_GAP_SIZE (b) + BUF_END_SENTINEL_SIZE); |
3062 BUF_GAP_SIZE (b) + BUF_END_SENTINEL_SIZE); | |
3063 if (! BUF_BEG_ADDR (b)) | 3068 if (! BUF_BEG_ADDR (b)) |
3064 memory_full (); | 3069 memory_full (); |
3065 | 3070 |
3066 SET_BUF_END_GAP_SIZE (b, 0); | 3071 SET_BUF_END_GAP_SIZE (b, 0); |
3067 SET_BI_BUF_GPT (b, 1); | 3072 SET_BI_BUF_GPT (b, 1); |
3081 { | 3086 { |
3082 b->text->mule_bufpos_cache[i] = 1; | 3087 b->text->mule_bufpos_cache[i] = 1; |
3083 b->text->mule_bytind_cache[i] = 1; | 3088 b->text->mule_bytind_cache[i] = 1; |
3084 } | 3089 } |
3085 } | 3090 } |
3086 #endif | 3091 #endif /* MULE */ |
3087 | 3092 |
3088 BUF_MODIFF (b) = 1; | 3093 BUF_MODIFF (b) = 1; |
3089 BUF_SAVE_MODIFF (b) = 1; | 3094 BUF_SAVE_MODIFF (b) = 1; |
3090 | 3095 |
3091 JUST_SET_POINT (b, 1, 1); | 3096 JUST_SET_POINT (b, 1, 1); |