From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#18196: 24.4.50; crash when setting face background in terminal frame Date: Tue, 05 Aug 2014 19:47:54 +0200 Message-ID: <53E118CA.2090602@gmx.at> References: <87ppgf4aki.fsf@gateway.local.navru.net> <53E09B27.7050100@gmx.at> <53E0AA14.3010501@gmx.at> <87siladgd0.fsf@gateway.local.navru.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010401080803070302060007" X-Trace: ger.gmane.org 1407260968 22609 80.91.229.3 (5 Aug 2014 17:49:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Aug 2014 17:49:28 +0000 (UTC) Cc: 18196@debbugs.gnu.org To: Nicolas Avrutin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 05 19:49:21 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XEirQ-0001Lo-P9 for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Aug 2014 19:49:21 +0200 Original-Received: from localhost ([::1]:60857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEirQ-0000za-Cx for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Aug 2014 13:49:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEirG-0000ye-0G for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2014 13:49:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEir8-0000hl-Dl for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2014 13:49:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52141) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEir8-0000hX-9i for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2014 13:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XEir7-0007xB-Lo for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2014 13:49:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Aug 2014 17:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18196 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18196-submit@debbugs.gnu.org id=B18196.140726089130493 (code B ref 18196); Tue, 05 Aug 2014 17:49:01 +0000 Original-Received: (at 18196) by debbugs.gnu.org; 5 Aug 2014 17:48:11 +0000 Original-Received: from localhost ([127.0.0.1]:59080 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XEiqI-0007vk-3c for submit@debbugs.gnu.org; Tue, 05 Aug 2014 13:48:10 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:54632) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XEiqE-0007v9-B3 for 18196@debbugs.gnu.org; Tue, 05 Aug 2014 13:48:07 -0400 Original-Received: from [93.82.13.132] ([93.82.13.132]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0MexlN-1X3UYA1PGT-00OX5S; Tue, 05 Aug 2014 19:48:00 +0200 In-Reply-To: <87siladgd0.fsf@gateway.local.navru.net> X-Provags-ID: V03:K0:FV3IhyhFcVESwW5opxdCjP6vbUXV8UEH/ytNa+ufL9UHkjK4o55 198zg3K5zIMknuy5pksZBpnpoMJ8NC6kgu20ZM2iYUB9h2QiPUbTGqyI3/HzuzIfd7GtNFt zKSKOWDNjAOTWIlTcIOPwf6Z/G1Nc71BqjI6H95CdtAsUEqmPQpkUFGv2BBB9gPngEMskZv 6eGBpYcqXbVEmE4v28Nxg== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:92153 Archived-At: This is a multi-part message in MIME format. --------------010401080803070302060007 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit > Your patch fixes this crash, however it introduces a new crash when > opening a new frame in emacs -nw. This crash is not present without your > patch. I see. Please try again with the attached patch. Thanks, martin --------------010401080803070302060007 Content-Type: text/plain; charset=windows-1252; name="tty-frame-size.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="tty-frame-size.diff" === modified file 'src/dispnew.c' --- src/dispnew.c 2014-08-03 23:16:39 +0000 +++ src/dispnew.c 2014-08-05 09:36:54 +0000 @@ -5444,7 +5444,9 @@ /* Record the new sizes, but don't reallocate the data structures now. Let that be done later outside of the signal handler. */ - change_frame_size (XFRAME (frame), width, height, 0, 1, 0, 0); + change_frame_size (XFRAME (frame), width, + height - FRAME_MENU_BAR_LINES (XFRAME (frame)), + 0, 1, 0, 0); } } } === modified file 'src/frame.c' --- src/frame.c 2014-08-04 16:47:27 +0000 +++ src/frame.c 2014-08-05 17:38:10 +0000 @@ -215,7 +215,8 @@ { return (frame_inhibit_implied_resize - || !NILP (get_frame_param (f, Qfullscreen))); + || !NILP (get_frame_param (f, Qfullscreen)) + || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)); } #if 0 @@ -563,7 +564,7 @@ /* MSDOS frames cannot PRETEND, as they change frame size by manipulating video hardware. */ if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f)) - FrameRows (FRAME_TTY (f)) = new_lines; + FrameRows (FRAME_TTY (f)) = new_lines + FRAME_TOP_MARGIN (f); } /* Assign new sizes. */ @@ -1037,7 +1038,7 @@ { int width, height; get_tty_size (fileno (FRAME_TTY (f)->input), &width, &height); - adjust_frame_size (f, width, height, 5, 0); + adjust_frame_size (f, width, height - FRAME_MENU_BAR_LINES (f), 5, 0); } adjust_frame_glyphs (f); @@ -1168,8 +1169,8 @@ 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); + if (FRAME_TOTAL_LINES (f) != FrameRows (tty)) + FrameRows (tty) = FRAME_TOTAL_LINES (f); } tty->top_frame = frame; } === modified file 'src/keyboard.c' --- src/keyboard.c 2014-08-05 05:43:35 +0000 +++ src/keyboard.c 2014-08-05 09:37:28 +0000 @@ -1868,7 +1868,7 @@ safe_run_hooks_error (Lisp_Object error, ptrdiff_t nargs, Lisp_Object *args) { Lisp_Object hook, fun, msgargs[4]; - + eassert (nargs == 2); hook = args[0]; fun = args[1]; @@ -10221,8 +10221,9 @@ with a window system; but suspend should be disabled in that case. */ get_tty_size (fileno (CURTTY ()->input), &width, &height); if (width != old_width || height != old_height) - change_frame_size (SELECTED_FRAME (), width, height - - FRAME_MENU_BAR_LINES (SELECTED_FRAME ()), 0, 0, 0, 0); + change_frame_size (SELECTED_FRAME (), width, + height - FRAME_MENU_BAR_LINES (SELECTED_FRAME ()), + 0, 0, 0, 0); /* Run suspend-resume-hook. */ hook = intern ("suspend-resume-hook"); === modified file 'src/menu.c' --- src/menu.c 2014-07-03 06:00:53 +0000 +++ src/menu.c 2014-08-05 09:29:29 +0000 @@ -1455,7 +1455,7 @@ their upper-left corner at the given position.) */ if (STRINGP (prompt)) x_coord -= SCHARS (prompt); - y_coord = FRAME_LINES (f); + y_coord = FRAME_TOTAL_LINES (f); } XSETFRAME (frame, f); === modified file 'src/term.c' --- src/term.c 2014-07-27 13:21:30 +0000 +++ src/term.c 2014-08-05 09:37:43 +0000 @@ -91,7 +91,7 @@ #define OUTPUT(tty, a) \ emacs_tputs ((tty), a, \ - FRAME_LINES (XFRAME (selected_frame)) - curY (tty), \ + FRAME_TOTAL_LINES (XFRAME (selected_frame)) - curY (tty), \ cmputc) #define OUTPUT1(tty, a) emacs_tputs ((tty), a, 1, cmputc) @@ -201,7 +201,7 @@ off the screen, so it won't be overwritten and lost. */ int i; current_tty = tty; - for (i = 0; i < FRAME_LINES (XFRAME (selected_frame)); i++) + for (i = 0; i < FRAME_TOTAL_LINES (XFRAME (selected_frame)); i++) cmputc ('\n'); } @@ -257,7 +257,7 @@ { struct tty_display_info *tty = FRAME_TTY (f); - tty->specified_window = size ? size : FRAME_LINES (f); + tty->specified_window = size ? size : FRAME_TOTAL_LINES (f); if (FRAME_SCROLL_REGION_OK (f)) tty_set_scroll_region (f, 0, tty->specified_window); } @@ -272,9 +272,9 @@ buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1, 0, 0); else if (tty->TS_set_scroll_region_1) buf = tparam (tty->TS_set_scroll_region_1, 0, 0, - FRAME_LINES (f), start, - FRAME_LINES (f) - stop, - FRAME_LINES (f)); + FRAME_TOTAL_LINES (f), start, + FRAME_TOTAL_LINES (f) - stop, + FRAME_TOTAL_LINES (f)); else buf = tparam (tty->TS_set_window, 0, 0, start, 0, stop, FRAME_COLS (f)); @@ -446,7 +446,7 @@ } else { - for (i = curY (tty); i < FRAME_LINES (f); i++) + for (i = curY (tty); i < FRAME_TOTAL_LINES (f); i++) { cursor_to (f, i, 0); clear_end_of_line (f, FRAME_COLS (f)); @@ -748,7 +748,7 @@ since that would scroll the whole frame on some terminals. */ if (AutoWrap (tty) - && curY (tty) + 1 == FRAME_LINES (f) + && curY (tty) + 1 == FRAME_TOTAL_LINES (f) && (curX (tty) + len) == FRAME_COLS (f)) len --; if (len <= 0) @@ -820,7 +820,7 @@ since that would scroll the whole frame on some terminals. */ if (AutoWrap (tty) - && curY (tty) + 1 == FRAME_LINES (f) + && curY (tty) + 1 == FRAME_TOTAL_LINES (f) && (curX (tty) + len) == FRAME_COLS (f)) len --; if (len <= 0) @@ -1009,7 +1009,7 @@ && vpos + i >= tty->specified_window) return; if (!FRAME_MEMORY_BELOW_FRAME (f) - && vpos + i >= FRAME_LINES (f)) + && vpos + i >= FRAME_TOTAL_LINES (f)) return; if (multi) @@ -1046,7 +1046,7 @@ && FRAME_MEMORY_BELOW_FRAME (f) && n < 0) { - cursor_to (f, FRAME_LINES (f) + n, 0); + cursor_to (f, FRAME_TOTAL_LINES (f) + n, 0); clear_to_end (f); } } @@ -2405,13 +2405,14 @@ struct frame *f = XFRAME (t->display_info.tty->top_frame); int width, height; int old_height = FRAME_COLS (f); - int old_width = FRAME_LINES (f); + int old_width = FRAME_TOTAL_LINES (f); /* Check if terminal/window size has changed while the frame was suspended. */ get_tty_size (fileno (t->display_info.tty->input), &width, &height); if (width != old_width || height != old_height) - change_frame_size (f, width, height - FRAME_MENU_BAR_LINES (f), 0, 0, 0, 0); + change_frame_size (f, width, height - FRAME_MENU_BAR_LINES (f), + 0, 0, 0, 0); SET_FRAME_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1); } @@ -2894,7 +2895,7 @@ /* Don't try to display more menu items than the console can display using the available screen lines. Exclude the echo area line, as it will be overwritten by the help-echo anyway. */ - int max_items = min (menu->count - first_item, FRAME_LINES (sf) - 1 - y); + int max_items = min (menu->count - first_item, FRAME_TOTAL_LINES (sf) - 1 - y); menu_help_message = NULL; @@ -3274,7 +3275,7 @@ { mi_result input_status; int min_y = state[0].y; - int max_y = min (min_y + state[0].menu->count, FRAME_LINES (sf) - 1) - 1; + int max_y = min (min_y + state[0].menu->count, FRAME_TOTAL_LINES (sf) - 1) - 1; input_status = read_menu_input (sf, &x, &y, min_y, max_y, &first_time); if (input_status) === modified file 'src/w32console.c' --- src/w32console.c 2014-07-27 13:21:30 +0000 +++ src/w32console.c 2014-08-05 09:30:47 +0000 @@ -118,7 +118,7 @@ w32con_clear_to_end (struct frame *f) { w32con_clear_end_of_line (f, FRAME_COLS (f) - 1); - w32con_ins_del_lines (f, cursor_coords.Y, FRAME_LINES (f) - cursor_coords.Y - 1); + w32con_ins_del_lines (f, cursor_coords.Y, FRAME_TOTAL_LINES (f) - cursor_coords.Y - 1); } /* Clear the frame. */ @@ -133,7 +133,7 @@ GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info); /* Remember that the screen buffer might be wider than the window. */ - n = FRAME_LINES (f) * info.dwSize.X; + n = FRAME_TOTAL_LINES (f) * info.dwSize.X; dest.X = dest.Y = 0; FillConsoleOutputAttribute (cur_screen, char_attr_normal, n, dest, &r); @@ -175,18 +175,18 @@ if (n < 0) { scroll.Top = vpos - n; - scroll.Bottom = FRAME_LINES (f); + scroll.Bottom = FRAME_TOTAL_LINES (f); dest.Y = vpos; } else { scroll.Top = vpos; - scroll.Bottom = FRAME_LINES (f) - n; + scroll.Bottom = FRAME_TOTAL_LINES (f) - n; dest.Y = vpos + n; } clip.Top = clip.Left = scroll.Left = 0; clip.Right = scroll.Right = FRAME_COLS (f); - clip.Bottom = FRAME_LINES (f); + clip.Bottom = FRAME_TOTAL_LINES (f); dest.X = 0; --------------010401080803070302060007--