diff options
| author | Richard M. Stallman | 1997-04-30 18:34:17 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-04-30 18:34:17 +0000 |
| commit | 12ca5cdf3e6fce94cfebdad1e6688b1812a9b10e (patch) | |
| tree | 55605feea6e2bf7734f7ac815fc4f82b2c3ac8ae /src/process.c | |
| parent | 67ffab69bd46f4870f1b01c771cb9f5b0293661a (diff) | |
| download | emacs-12ca5cdf3e6fce94cfebdad1e6688b1812a9b10e.tar.gz emacs-12ca5cdf3e6fce94cfebdad1e6688b1812a9b10e.zip | |
(read_process_output): Update opoint, old_begv and old_zv
based on actual buffer change rather than size of string.
old_begv and old_zv are now ints.
(status_notify): Likewise for opoint.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/src/process.c b/src/process.c index 0f8e182cb8f..21fd0322a52 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -2795,16 +2795,17 @@ read_process_output (proc, channel) | |||
| 2795 | if (!NILP (p->buffer) && !NILP (XBUFFER (p->buffer)->name)) | 2795 | if (!NILP (p->buffer) && !NILP (XBUFFER (p->buffer)->name)) |
| 2796 | { | 2796 | { |
| 2797 | Lisp_Object old_read_only; | 2797 | Lisp_Object old_read_only; |
| 2798 | Lisp_Object old_begv, old_zv; | 2798 | int old_begv, old_zv; |
| 2799 | Lisp_Object odeactivate; | 2799 | Lisp_Object odeactivate; |
| 2800 | int before; | ||
| 2800 | 2801 | ||
| 2801 | odeactivate = Vdeactivate_mark; | 2802 | odeactivate = Vdeactivate_mark; |
| 2802 | 2803 | ||
| 2803 | Fset_buffer (p->buffer); | 2804 | Fset_buffer (p->buffer); |
| 2804 | opoint = PT; | 2805 | opoint = PT; |
| 2805 | old_read_only = current_buffer->read_only; | 2806 | old_read_only = current_buffer->read_only; |
| 2806 | XSETFASTINT (old_begv, BEGV); | 2807 | old_begv = BEGV; |
| 2807 | XSETFASTINT (old_zv, ZV); | 2808 | old_zv = ZV; |
| 2808 | 2809 | ||
| 2809 | current_buffer->read_only = Qnil; | 2810 | current_buffer->read_only = Qnil; |
| 2810 | 2811 | ||
| @@ -2815,23 +2816,13 @@ read_process_output (proc, channel) | |||
| 2815 | SET_PT (clip_to_bounds (BEGV, marker_position (p->mark), ZV)); | 2816 | SET_PT (clip_to_bounds (BEGV, marker_position (p->mark), ZV)); |
| 2816 | else | 2817 | else |
| 2817 | SET_PT (ZV); | 2818 | SET_PT (ZV); |
| 2819 | before = PT; | ||
| 2818 | 2820 | ||
| 2819 | /* If the output marker is outside of the visible region, save | 2821 | /* If the output marker is outside of the visible region, save |
| 2820 | the restriction and widen. */ | 2822 | the restriction and widen. */ |
| 2821 | if (! (BEGV <= PT && PT <= ZV)) | 2823 | if (! (BEGV <= PT && PT <= ZV)) |
| 2822 | Fwiden (); | 2824 | Fwiden (); |
| 2823 | 2825 | ||
| 2824 | /* Make sure opoint floats ahead of any new text, just as point | ||
| 2825 | would. */ | ||
| 2826 | if (PT <= opoint) | ||
| 2827 | opoint += nchars; | ||
| 2828 | |||
| 2829 | /* Insert after old_begv, but before old_zv. */ | ||
| 2830 | if (PT < XFASTINT (old_begv)) | ||
| 2831 | XSETFASTINT (old_begv, XFASTINT (old_begv) + nchars); | ||
| 2832 | if (PT <= XFASTINT (old_zv)) | ||
| 2833 | XSETFASTINT (old_zv, XFASTINT (old_zv) + nchars); | ||
| 2834 | |||
| 2835 | /* Insert before markers in case we are inserting where | 2826 | /* Insert before markers in case we are inserting where |
| 2836 | the buffer's mark is, and the user's next command is Meta-y. */ | 2827 | the buffer's mark is, and the user's next command is Meta-y. */ |
| 2837 | if (chars_in_decoding_buf) | 2828 | if (chars_in_decoding_buf) |
| @@ -2842,9 +2833,18 @@ read_process_output (proc, channel) | |||
| 2842 | 2833 | ||
| 2843 | update_mode_lines++; | 2834 | update_mode_lines++; |
| 2844 | 2835 | ||
| 2836 | /* Make sure opoint and the old restrictions | ||
| 2837 | float ahead of any new text just as point would. */ | ||
| 2838 | if (opoint >= before) | ||
| 2839 | opoint += PT - before; | ||
| 2840 | if (old_begv > before) | ||
| 2841 | old_begv += PT - before; | ||
| 2842 | if (old_zv >= before) | ||
| 2843 | old_zv += PT - before; | ||
| 2844 | |||
| 2845 | /* If the restriction isn't what it should be, set it. */ | 2845 | /* If the restriction isn't what it should be, set it. */ |
| 2846 | if (XFASTINT (old_begv) != BEGV || XFASTINT (old_zv) != ZV) | 2846 | if (old_begv != BEGV || old_zv != ZV) |
| 2847 | Fnarrow_to_region (old_begv, old_zv); | 2847 | Fnarrow_to_region (make_number (old_begv), make_number (old_zv)); |
| 2848 | 2848 | ||
| 2849 | /* Handling the process output should not deactivate the mark. */ | 2849 | /* Handling the process output should not deactivate the mark. */ |
| 2850 | Vdeactivate_mark = odeactivate; | 2850 | Vdeactivate_mark = odeactivate; |
| @@ -3952,6 +3952,7 @@ status_notify () | |||
| 3952 | Lisp_Object ro, tem; | 3952 | Lisp_Object ro, tem; |
| 3953 | struct buffer *old = current_buffer; | 3953 | struct buffer *old = current_buffer; |
| 3954 | int opoint; | 3954 | int opoint; |
| 3955 | int before; | ||
| 3955 | 3956 | ||
| 3956 | ro = XBUFFER (buffer)->read_only; | 3957 | ro = XBUFFER (buffer)->read_only; |
| 3957 | 3958 | ||
| @@ -3960,6 +3961,7 @@ status_notify () | |||
| 3960 | if (NILP (XBUFFER (buffer)->name)) | 3961 | if (NILP (XBUFFER (buffer)->name)) |
| 3961 | continue; | 3962 | continue; |
| 3962 | Fset_buffer (buffer); | 3963 | Fset_buffer (buffer); |
| 3964 | |||
| 3963 | opoint = PT; | 3965 | opoint = PT; |
| 3964 | /* Insert new output into buffer | 3966 | /* Insert new output into buffer |
| 3965 | at the current end-of-output marker, | 3967 | at the current end-of-output marker, |
| @@ -3968,8 +3970,8 @@ status_notify () | |||
| 3968 | SET_PT (marker_position (p->mark)); | 3970 | SET_PT (marker_position (p->mark)); |
| 3969 | else | 3971 | else |
| 3970 | SET_PT (ZV); | 3972 | SET_PT (ZV); |
| 3971 | if (PT <= opoint) | 3973 | |
| 3972 | opoint += XSTRING (msg)->size + XSTRING (p->name)->size + 10; | 3974 | before = PT; |
| 3973 | 3975 | ||
| 3974 | tem = current_buffer->read_only; | 3976 | tem = current_buffer->read_only; |
| 3975 | current_buffer->read_only = Qnil; | 3977 | current_buffer->read_only = Qnil; |
| @@ -3980,7 +3982,11 @@ status_notify () | |||
| 3980 | current_buffer->read_only = tem; | 3982 | current_buffer->read_only = tem; |
| 3981 | Fset_marker (p->mark, make_number (PT), p->buffer); | 3983 | Fset_marker (p->mark, make_number (PT), p->buffer); |
| 3982 | 3984 | ||
| 3983 | SET_PT (opoint); | 3985 | if (opoint >= before) |
| 3986 | SET_PT (opoint + (PT - before)); | ||
| 3987 | else | ||
| 3988 | SET_PT (opoint); | ||
| 3989 | |||
| 3984 | set_buffer_internal (old); | 3990 | set_buffer_internal (old); |
| 3985 | } | 3991 | } |
| 3986 | } | 3992 | } |