APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1544959519 0
#      Sun Dec 16 11:25:19 2018 +0000
# Node ID ddfa783ef44399fe343ae3af4c24ea92858c1250
# Parent  b9a770da65d3f39da0293bb544259fbaaf0b2270
Save old_pointm, old_startp as markers, avoiding issues with byte-char sync
src/ChangeLog addition:
2018-12-16  Aidan Kehoe  <kehoea(a)parhasard.net>
	* redisplay.c (redisplay_window):
	Avoid problems with possibly having markers point inside
	characters, saev the relevant positions as markers if needed.
diff -r b9a770da65d3 -r ddfa783ef443 src/ChangeLog
--- a/src/ChangeLog	Sat Dec 08 11:44:23 2018 +0000
+++ b/src/ChangeLog	Sun Dec 16 11:25:19 2018 +0000
@@ -1,3 +1,9 @@
+2018-12-16  Aidan Kehoe  <kehoea(a)parhasard.net>
+
+	* redisplay.c (redisplay_window):
+	Avoid problems with possibly having markers point inside
+	characters, save the relevant positions as markers if needed.
+
 2018-12-08  Aidan Kehoe  <kehoea(a)parhasard.net>
 
 	* redisplay.c (redisplay_window):
diff -r b9a770da65d3 -r ddfa783ef443 src/redisplay.c
--- a/src/redisplay.c	Sat Dec 08 11:44:23 2018 +0000
+++ b/src/redisplay.c	Sun Dec 16 11:25:19 2018 +0000
@@ -6301,8 +6301,8 @@
   int echo_active = 0;
   int startp = 1;
   int pointm;
-  Bytebpos old_startp = 1;
-  Bytebpos old_pointm = 1;
+  Lisp_Object old_startp = Qnil;
+  Lisp_Object old_pointm = Qnil;
   int selected_in_its_frame;
   int selected_globally;
   int skip_output = 0;
@@ -6354,12 +6354,11 @@
 
   if (echo_active)
     {
-      old_pointm = selected_globally
-		   ? BYTE_BUF_PT (b)
-		   : byte_marker_position (w->pointm[CURRENT_DISP]);
-      pointm = BUF_BEG (the_buffer);
+      old_pointm = noseeum_copy_marker (selected_globally ? b->point_marker
+                                        : w->pointm[CURRENT_DISP], Qnil);
+      pointm = BUF_BEG (b);
       set_byte_marker_position (w->pointm[DESIRED_DISP], BYTE_BUF_BEG (b),
-                                the_buffer);
+                                wrap_buffer (b));
     }
   else
     {
@@ -6428,7 +6427,7 @@
 
   if (echo_active)
     {
-      old_startp = byte_marker_position (w->start[CURRENT_DISP]);
+      old_startp = noseeum_copy_marker (w->start[CURRENT_DISP], Qnil);
 
       startp = BUF_BEG (b);
       set_byte_marker_position (w->start[DESIRED_DISP], BYTE_BUF_BEG (b),
@@ -6657,16 +6656,11 @@
     {
       w->buffer = old_buffer;
 
-      set_byte_marker_position (w->pointm[DESIRED_DISP],
-                                max (BYTE_BUF_BEG (XBUFFER (old_buffer)), 
-                                     min (BYTE_BUF_Z (XBUFFER (old_buffer)),
-                                          old_pointm)),
-                                old_buffer);
-      set_byte_marker_position (w->pointm[DESIRED_DISP],
-                                max (BYTE_BUF_BEG (XBUFFER (old_buffer)), 
-                                     min (BYTE_BUF_Z (XBUFFER (old_buffer)),
-                                          old_startp)),
-                                old_buffer);
+      Fset_marker (w->pointm[DESIRED_DISP], old_pointm, old_buffer);
+      Fset_marker (w->pointm[DESIRED_DISP], old_startp, old_buffer);
+
+      unchain_marker (old_pointm);
+      unchain_marker (old_startp);      
     }
 
   /* These also have to be set before calling redisplay_output_window
-- 
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)
    
    
    
 
                    
                    
                        
                        Show replies by date