]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #17875 with changing TTY frame size, then selecting new frame.
authorEli Zaretskii <eliz@gnu.org>
Mon, 30 Jun 2014 16:45:38 +0000 (19:45 +0300)
committerEli Zaretskii <eliz@gnu.org>
Mon, 30 Jun 2014 16:45:38 +0000 (19:45 +0300)
 src/frame.c (do_switch_frame): When switching to another TTY frame,
 make sure FrameCols and FrameRows are in sync with the new frame's
 data.

src/ChangeLog
src/frame.c

index eac62eef7a7d56a34752a1739bbff14765ea8163..6d1e23b40fd7909dad4790705afb3d1d4a4b274d 100644 (file)
@@ -1,3 +1,9 @@
+2014-06-30  Eli Zaretskii  <eliz@gnu.org>
+
+       * frame.c (do_switch_frame): When switching to another TTY frame,
+       make sure FrameCols and FrameRows are in sync with the new frame's
+       data.  (Bug#17875)
+
 2014-06-28  Andreas Schwab  <schwab@linux-m68k.org>
 
        * coding.c (encode_coding_utf_8): Correctly count produced_chars
index 35c926ce7ef8dd38e27f87ca0c8a264757de8c09..0c13016435214ba34b96cbcead2b442814daa147 100644 (file)
@@ -46,6 +46,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifdef HAVE_WINDOW_SYSTEM
 #include "fontset.h"
 #endif
+#include "cm.h"
 #ifdef MSDOS
 #include "msdos.h"
 #include "dosfns.h"
@@ -851,7 +852,9 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
 
   if (FRAME_TERMCAP_P (XFRAME (frame)) || FRAME_MSDOS_P (XFRAME (frame)))
     {
-      Lisp_Object top_frame = FRAME_TTY (XFRAME (frame))->top_frame;
+      struct frame *f = XFRAME (frame);
+      struct tty_display_info *tty = FRAME_TTY (f);
+      Lisp_Object top_frame = tty->top_frame;
 
       /* Don't mark the frame garbaged and/or obscured if we are
         switching to the frame that is already the top frame of that
@@ -861,9 +864,16 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
          if (FRAMEP (top_frame))
            /* Mark previously displayed frame as now obscured.  */
            SET_FRAME_VISIBLE (XFRAME (top_frame), 2);
-         SET_FRAME_VISIBLE (XFRAME (frame), 1);
+         SET_FRAME_VISIBLE (f, 1);
+         /* If the new TTY frame changed dimensions, we need to
+            resync term.c's idea of the frame size with the new
+            frame's data.  */
+         if (FRAME_COLS (f) != FrameCols (tty))
+           FrameCols (tty) = FRAME_COLS (f);
+         if (FRAME_LINES (f) != FrameRows (tty))
+           FrameRows (tty) = FRAME_LINES (f);
        }
-      FRAME_TTY (XFRAME (frame))->top_frame = frame;
+      tty->top_frame = frame;
     }
 
   selected_frame = frame;