* bug#18196: 24.4.50; crash when setting face background in terminal frame @ 2014-08-05 8:12 Nicolas Avrutin 2014-08-05 8:51 ` martin rudalics 0 siblings, 1 reply; 26+ messages in thread From: Nicolas Avrutin @ 2014-08-05 8:12 UTC (permalink / raw) To: 18196 Starting emacs with -nw and setting a face background (only tested with the 'default face) causes emacs to crash. Steps to reproduce: 1. build emacs from trunk (the crash does not occur on the emacs-24 branch) 2. emacs -Q -nw 3. M-: (set-face-attribute 'default nil :background "blue") Backtrace: (gdb) bt full #0 terminate_due_to_signal (sig=sig@entry=6, backtrace_limit=backtrace_limit@entry=40) at emacs.c:359 No locals. #1 0x00000000004f4e77 in emacs_abort () at sysdep.c:2198 No locals. #2 0x000000000049ea53 in cmcheckmagic (tty=0x6, tty@entry=0x13c6ce0) at cm.c:120 No locals. #3 0x00000000004a4a48 in tty_write_glyphs (f=<optimized out>, string=0xe35a50, len=<optimized out>) at term.c:802 conversion_buffer = <optimized out> coding = 0x13c6a70 n = <optimized out> stringlen = 0 tty = 0x13c6ce0 #4 0x00000000004a6ee8 in write_glyphs (f=f@entry=0xbe4e38, string=string@entry=0xe34130, len=len@entry=134) at terminal.c:162 No locals. #5 0x000000000041b01c in update_frame_line (f=f@entry=0xbe4e38, vpos=<optimized out>) at dispnew.c:4854 obody = 0x0 nbody = 0xe34130 op1 = <optimized out> op2 = <optimized out> np1 = <optimized out> nend = 0xe35a50 tem = <optimized out> osp = <optimized out> nsp = <optimized out> begmatch = <optimized out> endmatch = <optimized out> olen = 0 nlen = 134 current_matrix = <optimized out> desired_matrix = <optimized out> current_row = <optimized out> desired_row = <optimized out> must_write_whole_line_p = <optimized out> write_spaces_p = <optimized out> colored_spaces_p = true #6 0x000000000041caf3 in update_frame_1 (f=f@entry=0xbe4e38, force_p=force_p@entry=true, inhibit_id_p=inhibit_id_p@entry=false, set_cursor_p=set_cursor_p@entry=true) at dispnew.c:4515 current_matrix = 0xbe8420 desired_matrix = 0xbe83b0 i = <optimized out> pause_p = <optimized out> preempt_count = 17 #7 0x000000000041dbf0 in update_frame (f=f@entry=0xbe4e38, force_p=true, force_p@entry=false, inhibit_hairy_id_p=inhibit_hairy_id_p@entry=false) at dispnew.c:3116 paused_p = <optimized out> #8 0x00000000004512a4 in redisplay_internal () at xdisp.c:13869 gcscrollbars = <optimized out> w = <optimized out> sw = <optimized out> pending = <optimized out> must_finish = <optimized out> match_p = <optimized out> tlbufpos = <optimized out> tlendpos = <optimized out> number_of_visible_frames = <optimized out> polling_stopped_here = 1 tail = 12362998 consider_all_windows_p = <optimized out> update_miniwindow_p = <optimized out> #9 0x00000000004517fd in redisplay () at xdisp.c:13115 No locals. #10 0x00000000004e838b in read_char (commandflag=1, map=map@entry=19795862, prev_event=12390578, used_mouse_menu=used_mouse_menu@entry=0x7fffffffc25b, end_time=end_time@entry=0x0) at keyboard.c:2563 echo_current = false c = <optimized out> jmpcount = <optimized out> local_getcjmp = {{ __jmpbuf = {16752048, 5179671, 12390578, 0, 12417413, 12423154, 192, 0}, __mask_was_saved = -16040, __saved_mask = { __val = {12390578, 12390578, 16752054, 0, 2, 19795878, 4294967295, 12390578, 12390626, 12390578, 5181284, 19584758, 12390578, 12390626, 0, 12390578} } }} save_jump = {{ ---Type <return> to continue, or q <return> to quit--- __jmpbuf = {0, 0, 0, -1, 4294967297, 4, 0, 0}, __mask_was_saved = 0, __saved_mask = { __val = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5488403, 0, 5468688, 2, 15884032, 16910658} } }} tem = <optimized out> save = <optimized out> previous_echo_area_message = 12390578 also_record = 12390578 reread = false polling_stopped_here = false orig_kboard = 0x13c92d0 #11 0x00000000004e99a9 in read_key_sequence (keybuf=keybuf@entry=0x7fffffffc320, bufsize=bufsize@entry=30, prompt=<optimized out>, dont_downcase_last=dont_downcase_last@entry=false, can_return_switch_frame=can_return_switch_frame@entry=true, fix_current_buffer=fix_current_buffer@entry=true, prevent_redisplay=false) at keyboard.c:9125 interrupted_kboard = 0x13c92d0 key = <optimized out> used_mouse_menu = false echo_local_start = 0 last_real_key_start = 0 keys_local_start = <optimized out> new_binding = <optimized out> t = 0 echo_start = 0 keys_start = 0 current_binding = 19795862 first_event = 12390578 first_unbound = 31 mock_input = 0 fkey = { parent = 15725926, map = 15725926, start = 0, end = 0 } keytran = { parent = 12370502, map = 12370502, start = 0, end = 0 } indec = { parent = 15725942, map = 15725942, start = 0, end = 0 } shift_translated = false delayed_switch_frame = 12390578 original_uppercase = 12581826 original_uppercase_position = -1 dummyflag = false starting_buffer = 0xbd7980 fake_prefixed_keys = 12390578 #12 0x00000000004eb2b8 in command_loop_1 () at keyboard.c:1438 cmd = <optimized out> keybuf = {108, 232, 11995584, 12390400, 0, 5470196, 140737488339968, 5535579, 12515824, 12390578, 12390578, 12390578, 20586736, 12390578, 0, 5470239, 12515826, 5470566, 12515824, 2, 12625046, 5533128, 0, 2, 15899862, 4000, 1, 0, 0, 5541270} i = <optimized out> prev_modiff = 10 prev_buffer = 0xbd7980 #13 0x0000000000546570 in internal_condition_case (bfun=bfun@entry=0x4eafbc <command_loop_1>, handlers=12442482, hfun=hfun@entry=0x4e22f6 <cmd_error>) at eval.c:1347 val = <optimized out> c = <optimized out> #14 0x00000000004de295 in command_loop_2 (ignore=ignore@entry=12390578) at keyboard.c:1169 val = <optimized out> #15 0x0000000000546451 in internal_catch (tag=12438450, func=func@entry=0x4de27b <command_loop_2>, arg=12390578) at eval.c:1111 val = <optimized out> c = <optimized out> #16 0x00000000004de22d in command_loop () at keyboard.c:1148 No locals. #17 0x00000000004e1f58 in recursive_edit_1 () at keyboard.c:769 val = <optimized out> ---Type <return> to continue, or q <return> to quit--- #18 0x00000000004e2228 in Frecursive_edit () at keyboard.c:840 buffer = <optimized out> #19 0x00000000004ddce4 in main (argc=<optimized out>, argv=0x7fffffffc638) at emacs.c:1650 dummy = 6031885 stack_bottom_variable = 0 '\000' do_initial_setlocale = <optimized out> dumping = false skip_args = 1 rlim = { rlim_cur = 8720000, rlim_max = 18446744073709551615 } no_loadup = false junk = 0x0 dname_arg = 0x0 ch_to_dir = 0x0 original_pwd = 0x0 Lisp Backtrace: "redisplay_internal (C function)" (0xb99298) In GNU Emacs 24.4.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.12.2) of 2014-08-05 on gateway Windowing system distributor `The X.Org Foundation', version 11.0.11501000 System Description: Arch Linux Configured using: `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --mandir=/usr/share/man --with-sound=alsa --without-gconf --with-x-toolkit=gtk3 --without-toolkit-scroll-bars --with-xft 'CFLAGS=-Og -g3' CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t Recent input: M-x r e p o r t - e m <tab> <return> Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message dired format-spec rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind gfilenotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) Memory information: ((conses 16 75917 8244) (symbols 48 17987 0) (miscs 40 38 91) (strings 32 10685 4040) (string-bytes 1 302814) (vectors 16 9357) (vector-slots 8 386642 15148) (floats 8 70 190) (intervals 56 185 0) (buffers 976 11) (heap 1024 15888 917)) -- Nicolas Avrutin ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-05 8:12 bug#18196: 24.4.50; crash when setting face background in terminal frame Nicolas Avrutin @ 2014-08-05 8:51 ` martin rudalics 2014-08-05 9:55 ` martin rudalics 0 siblings, 1 reply; 26+ messages in thread From: martin rudalics @ 2014-08-05 8:51 UTC (permalink / raw) To: Nicolas Avrutin, 18196 > Steps to reproduce: > 1. build emacs from trunk (the crash does not occur on the emacs-24 > branch) > 2. emacs -Q -nw > 3. M-: (set-face-attribute 'default nil :background "blue") > > Backtrace: > (gdb) bt full > #0 terminate_due_to_signal (sig=sig@entry=6, backtrace_limit=backtrace_limit@entry=40) at emacs.c:359 > No locals. > #1 0x00000000004f4e77 in emacs_abort () at sysdep.c:2198 > No locals. > #2 0x000000000049ea53 in cmcheckmagic (tty=0x6, tty@entry=0x13c6ce0) at cm.c:120 This is bug#18136 hitting again. I'm on it but it may take some time. Thanks, martin ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-05 8:51 ` martin rudalics @ 2014-08-05 9:55 ` martin rudalics 2014-08-05 16:34 ` Nicolas Avrutin 0 siblings, 1 reply; 26+ messages in thread From: martin rudalics @ 2014-08-05 9:55 UTC (permalink / raw) To: Nicolas Avrutin, 18196 [-- Attachment #1: Type: text/plain, Size: 124 bytes --] > This is bug#18136 hitting again. I'm on it but it may take some time. Can you try the attached patch? Thanks, martin [-- Attachment #2: tty-frame-size.diff --] [-- Type: text/plain, Size: 8081 bytes --] === 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 09:45:01 +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. */ === 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; ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-05 9:55 ` martin rudalics @ 2014-08-05 16:34 ` Nicolas Avrutin 2014-08-05 17:47 ` martin rudalics 0 siblings, 1 reply; 26+ messages in thread From: Nicolas Avrutin @ 2014-08-05 16:34 UTC (permalink / raw) To: martin rudalics; +Cc: 18196 On Tue, Aug 05 2014, martin rudalics <rudalics@gmx.at> wrote: > Can you try the attached patch? 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. In addition, I've also found another related issue that was present before your patch, though it might be better suited for bug #18136. After opening emacs -nw and resizing the terminal or creating a new frame [C-x 5 2], the modeline moves down a line and overlaps the echo area. It is then possible to get the modeline back up by either closing all subsequent frames [C-x 5 0] or turning the menu bar off and on [M-: (menu-bar-mode -1) RET M-: (menu-bar-mode 1) RET] As for the crash: Steps to reproduce (with your patch applied): 1. emacs -Q -nw 2. C-x 5 2 Backtrace: (gdb) bt full #0 terminate_due_to_signal (sig=sig@entry=6, backtrace_limit=backtrace_limit@entry=40) at emacs.c:359 No locals. #1 0x00000000004f4ea8 in emacs_abort () at sysdep.c:2198 No locals. #2 0x000000000049ea76 in cmcheckmagic (tty=0x6, tty@entry=0x13c6ce0) at cm.c:120 No locals. #3 0x00000000004a4a6b in tty_write_glyphs (f=<optimized out>, string=0xcf81d0, len=<optimized out>) at term.c:802 conversion_buffer = <optimized out> coding = 0x13c6a70 n = <optimized out> stringlen = 0 tty = 0x13c6ce0 #4 0x00000000004a6f0b in write_glyphs (f=f@entry=0x10dfaa0, string=string@entry=0xcf68b0, len=len@entry=134) at terminal.c:162 No locals. #5 0x000000000041b01c in update_frame_line (f=f@entry=0x10dfaa0, vpos=vpos@entry=75) at dispnew.c:4854 obody = 0x0 nbody = 0xcf68b0 op1 = <optimized out> op2 = <optimized out> np1 = <optimized out> nend = 0xcf81d0 tem = <optimized out> osp = <optimized out> nsp = <optimized out> begmatch = <optimized out> endmatch = <optimized out> olen = 0 nlen = 134 current_matrix = <optimized out> desired_matrix = <optimized out> current_row = <optimized out> desired_row = <optimized out> must_write_whole_line_p = <optimized out> write_spaces_p = <optimized out> colored_spaces_p = false #6 0x000000000041cb9a in update_frame_1 (f=f@entry=0x10dfaa0, force_p=force_p@entry=true, inhibit_id_p=<optimized out>, inhibit_id_p@entry=false, set_cursor_p=set_cursor_p@entry=true) at dispnew.c:4541 current_matrix = 0xc7cb70 desired_matrix = 0x13ed3f0 i = 75 pause_p = <optimized out> preempt_count = 17 #7 0x000000000041dbf0 in update_frame (f=f@entry=0x10dfaa0, force_p=true, force_p@entry=false, inhibit_hairy_id_p=inhibit_hairy_id_p@entry=false) at dispnew.c:3116 paused_p = <optimized out> #8 0x00000000004512c7 in redisplay_internal () at xdisp.c:13869 gcscrollbars = <optimized out> w = <optimized out> sw = <optimized out> pending = <optimized out> must_finish = <optimized out> match_p = <optimized out> tlbufpos = <optimized out> tlendpos = <optimized out> number_of_visible_frames = <optimized out> polling_stopped_here = 1 tail = 19721462 consider_all_windows_p = <optimized out> update_miniwindow_p = <optimized out> #9 0x0000000000451820 in redisplay () at xdisp.c:13115 No locals. #10 0x00000000004e83bc in read_char (commandflag=1, map=map@entry=14224790, prev_event=12390578, used_mouse_menu=used_mouse_menu@entry=0x7fffffffc25b, end_time=end_time@entry=0x0) at keyboard.c:2566 echo_current = true c = <optimized out> jmpcount = <optimized out> local_getcjmp = {{ __jmpbuf = {16752048, 5179720, 12390578, 0, 12417413, 12423154, 192, 0}, __mask_was_saved = -16040, __saved_mask = { __val = {12390578, 12390578, 16752054, 4, 2, 14224774, 4294967295, 12390578, 12390626, 12390578, 5181333, 19584758, 12390578, 17693349, 0, 12390578} } }} save_jump = {{ ---Type <return> to continue, or q <return> to quit--- __jmpbuf = {0, 140737352476816, 140737353742776, 4241052, 140737243393400, 4212872, 12390578, 20237522}, __mask_was_saved = 20237522, __saved_mask = { __val = {20237522, 12390578, 5, 12390578, 20237522, 12425333, 140737351932527, 3, 140733193388034, 5, 5488452, 12529426, 12417408, 2, 15884032, 16910658} } }} tem = <optimized out> save = <optimized out> previous_echo_area_message = 12390578 also_record = 12390578 reread = false polling_stopped_here = false orig_kboard = 0x13c92d0 #11 0x00000000004e99da in read_key_sequence (keybuf=keybuf@entry=0x7fffffffc320, bufsize=bufsize@entry=30, prompt=<optimized out>, dont_downcase_last=dont_downcase_last@entry=false, can_return_switch_frame=can_return_switch_frame@entry=true, fix_current_buffer=fix_current_buffer@entry=true, prevent_redisplay=false) at keyboard.c:9128 interrupted_kboard = 0x13c92d0 key = <optimized out> used_mouse_menu = false echo_local_start = 0 last_real_key_start = 0 keys_local_start = <optimized out> new_binding = <optimized out> t = 0 echo_start = 0 keys_start = 0 current_binding = 14224790 first_event = 12390578 first_unbound = 31 mock_input = 0 fkey = { parent = 15725926, map = 15725926, start = 0, end = 0 } keytran = { parent = 12370502, map = 12370502, start = 0, end = 0 } indec = { parent = 15725942, map = 15725942, start = 0, end = 0 } shift_translated = false delayed_switch_frame = 12390578 original_uppercase = 12514784 original_uppercase_position = -1 dummyflag = false starting_buffer = 0xbd7980 fake_prefixed_keys = 12390578 #12 0x00000000004eb2e9 in command_loop_1 () at keyboard.c:1438 cmd = <optimized out> keybuf = {96, 212, 200, 12390400, 0, 5470245, 140737488339968, 5535628, 12515824, 12390578, 12390578, 12390578, 20586736, 12390578, 0, 5470288, 12515826, 5470615, 12515824, 2, 12625046, 5533177, 0, 2, 15899862, 4000, 1, 0, 0, 5541319} i = <optimized out> prev_modiff = 10 prev_buffer = 0xbd7980 #13 0x00000000005465a1 in internal_condition_case (bfun=bfun@entry=0x4eafed <command_loop_1>, handlers=12442482, hfun=hfun@entry=0x4e2321 <cmd_error>) at eval.c:1347 val = <optimized out> c = <optimized out> #14 0x00000000004de2c3 in command_loop_2 (ignore=ignore@entry=12390578) at keyboard.c:1169 val = <optimized out> #15 0x0000000000546482 in internal_catch (tag=12438450, func=func@entry=0x4de2a9 <command_loop_2>, arg=12390578) at eval.c:1111 val = <optimized out> c = <optimized out> #16 0x00000000004de25b in command_loop () at keyboard.c:1148 No locals. #17 0x00000000004e1f83 in recursive_edit_1 () at keyboard.c:769 ---Type <return> to continue, or q <return> to quit--- val = <optimized out> #18 0x00000000004e2253 in Frecursive_edit () at keyboard.c:840 buffer = <optimized out> #19 0x00000000004ddd12 in main (argc=<optimized out>, argv=0x7fffffffc638) at emacs.c:1650 dummy = 6031933 stack_bottom_variable = 0 '\000' do_initial_setlocale = <optimized out> dumping = false skip_args = 1 rlim = { rlim_cur = 8720000, rlim_max = 18446744073709551615 } no_loadup = false junk = 0x0 dname_arg = 0x0 ch_to_dir = 0x0 original_pwd = 0x0 Lisp Backtrace: "redisplay_internal (C function)" (0xb99298) -- Nicolas Avrutin ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-05 16:34 ` Nicolas Avrutin @ 2014-08-05 17:47 ` martin rudalics 2014-08-05 19:06 ` Nicolas Avrutin 0 siblings, 1 reply; 26+ messages in thread From: martin rudalics @ 2014-08-05 17:47 UTC (permalink / raw) To: Nicolas Avrutin; +Cc: 18196 [-- Attachment #1: Type: text/plain, Size: 222 bytes --] > 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 [-- Attachment #2: tty-frame-size.diff --] [-- Type: text/plain, Size: 8713 bytes --] === 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; ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-05 17:47 ` martin rudalics @ 2014-08-05 19:06 ` Nicolas Avrutin 2014-08-05 21:18 ` Nicolas Avrutin 0 siblings, 1 reply; 26+ messages in thread From: Nicolas Avrutin @ 2014-08-05 19:06 UTC (permalink / raw) To: martin rudalics; +Cc: 18196 On Tue, Aug 05 2014, martin rudalics <rudalics@gmx.at> wrote: > I see. Please try again with the attached patch. Looks good! This one seems to solve the crashes and also fixes the issue I mentioned with the modeline and echo area. Thanks -- Nicolas Avrutin ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-05 19:06 ` Nicolas Avrutin @ 2014-08-05 21:18 ` Nicolas Avrutin 2014-08-06 9:42 ` martin rudalics 0 siblings, 1 reply; 26+ messages in thread From: Nicolas Avrutin @ 2014-08-05 21:18 UTC (permalink / raw) To: martin rudalics; +Cc: 18196 On Tue, Aug 05 2014, Nicolas Avrutin <nicolasavru@gmail.com> wrote: > ... also fixes the issue I mentioned with the modeline and echo area. Actually, it doesn't completely fix that issue. It happens much less, but I can still reproduce it sometimes. If I open emacsclient -nw in a small terminal (less than 1/4 of my 1920x1080 screen), all text is black (and thus invisible) and the modeline again creeps into the echo area, though an old replica of the modeline remains one line above the echo area. In addition, the menu bar is invisible and contains a copy of the first line of text. When this happens, I can almost always fix it by enlarging the terminal (full-screening it, for exaample) and then restoring it to the small size. My guess (based on skimming the discussion in bug #18136) would be that some function is being called when the terminal (and thus frame) is resized, but not when the frame is first created. -- Nicolas Avrutin ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-05 21:18 ` Nicolas Avrutin @ 2014-08-06 9:42 ` martin rudalics 2014-08-06 15:40 ` Nicolas Avrutin 2014-08-06 17:59 ` Nicolas Avrutin 0 siblings, 2 replies; 26+ messages in thread From: martin rudalics @ 2014-08-06 9:42 UTC (permalink / raw) To: Nicolas Avrutin; +Cc: 18196 [-- Attachment #1: Type: text/plain, Size: 1113 bytes --] >> ... also fixes the issue I mentioned with the modeline and echo area. > > Actually, it doesn't completely fix that issue. It happens much less, > but I can still reproduce it sometimes. If I open emacsclient -nw in a > small terminal (less than 1/4 of my 1920x1080 screen), all text is black > (and thus invisible) and the modeline again creeps into the echo area, > though an old replica of the modeline remains one line above the echo > area. In addition, the menu bar is invisible and contains a copy of the > first line of text. > > When this happens, I can almost always fix it by enlarging the terminal > (full-screening it, for exaample) and then restoring it to the small > size. My guess (based on skimming the discussion in bug #18136) would be > that some function is being called when the terminal (and thus frame) is > resized, but not when the frame is first created. Might be. I attached a new patch. If you still see the problem please tell me the size of the terminal and maybe add a screenshot. Can you type into the text window or the minibuffer when it happens? martin [-- Attachment #2: tty-frame-size.diff --] [-- Type: text/plain, Size: 9594 bytes --] === 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-06 08:45:15 +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. */ @@ -917,7 +918,9 @@ #endif FRAME_MENU_BAR_LINES (f) = NILP (Vmenu_bar_mode) ? 0 : 1; + FRAME_LINES (f) = FRAME_LINES (f) - FRAME_MENU_BAR_LINES (f); FRAME_MENU_BAR_HEIGHT (f) = FRAME_MENU_BAR_LINES (f) * FRAME_LINE_HEIGHT (f); + FRAME_TEXT_HEIGHT (f) = FRAME_TEXT_HEIGHT (f) - FRAME_MENU_BAR_HEIGHT (f); /* Set the top frame to the newly created frame. */ if (FRAMEP (FRAME_TTY (f)->top_frame) @@ -1037,7 +1040,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 +1171,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; } @@ -2733,7 +2736,7 @@ return make_number (FRAME_PIXEL_HEIGHT (f)); else #endif - return make_number (FRAME_LINES (f)); + return make_number (FRAME_TOTAL_LINES (f)); } DEFUN ("frame-pixel-width", Fframe_pixel_width, @@ -2750,7 +2753,7 @@ return make_number (FRAME_PIXEL_WIDTH (f)); else #endif - return make_number (FRAME_COLS (f)); + return make_number (FRAME_TOTAL_COLS (f)); } DEFUN ("tool-bar-pixel-width", Ftool_bar_pixel_width, === 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; ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-06 9:42 ` martin rudalics @ 2014-08-06 15:40 ` Nicolas Avrutin 2014-08-06 17:59 ` Nicolas Avrutin 1 sibling, 0 replies; 26+ messages in thread From: Nicolas Avrutin @ 2014-08-06 15:40 UTC (permalink / raw) To: martin rudalics; +Cc: 18196 [-- Attachment #1: Type: text/plain, Size: 2937 bytes --] On Wed, Aug 06 2014, martin rudalics <rudalics@gmx.at> wrote: > Might be. I attached a new patch. If you still see the problem please > tell me the size of the terminal and maybe add a screenshot. Can you > type into the text window or the minibuffer when it happens? The second issue is still there with the last patch. Interestingly enough, I can only reproduce this with emacsclient, not emacs itself. I don't see a difference with this issue between your second patch and your third patch. Steps to reproduce: 1. emacs -Q 2. M-: server-start 3. emacsclient -nw The dimensions of the terminal with the emacsclient are 134 cols and 38 lines (according to tput cols and tput lines). The dimensions of the terminal window (including scroll bar and 1px window border on all sides) should be 960x540 (1/4 of a 1920x1080 screen). I don't know the exact width of the scroll bar, so I can't easily give you the dimensions of the "interior" of the terminal. I can also reproduce the issue with a terminal smaller than this. Screenshots: 1.png: emacs window on the left, terminal from which emacs was opened on the top right, terminal with emacsclient -nw opened in the bottom right. Notice that neither the next from the *scratch* buffer nor the menu bar are visible. 2.png: I type "foo bar" in the emacsclient. The text appears in emacsclient and the emacs window because they are both in the *scratch* buffer. Notice how in the emacsclient, the buffer is marked as modified on the line below the displayed modeline. The modeline is actually on the bottom line, not on the second line from the bottom. The second line is a static artifact. 3.png: I press M-: and type something in the minibuffer. It overwrites the actual modeline on the bottom line, of which the modified buffer marker was the only thing visible. Entering the minibuffer caused an entry in the menubar to change. The new entry (Minibuf Help) is now visible. 4.png: I press C-g to exit the minibuffer then RET to advance to the next line and then down arrow. The line number in the modeline (line 6) is displayed on the last line, the same line as the echo area. The menubar is updated. 5.png: I press C-SPC and up arrow to select the next on the first few lines. The next becomes visible now. 6.png: I press C-g to cancel the selection. The text remains visible. 7.png: I press F10 to open the menu and then F10 again to close it. The parts of the menubar that were redrawn when I did that (File part of Edit) are visible now. I press C-x C-f and open a new file. Most of the modeline is redrawn on the bottom line. The original location of the modeline on the second to last has not been redrawn since openening the emacsclient. At any point, if I full-screen the terminal with the emacsclient, the entire emacsclient gets redrawn and the display bugs disappear. If I then restore the terminal to the smaller size, it continues to function properly. Thanks [-- Attachment #2: 1.png --] [-- Type: image/png, Size: 39304 bytes --] [-- Attachment #3: 2.png --] [-- Type: image/png, Size: 40717 bytes --] [-- Attachment #4: 3.png --] [-- Type: image/png, Size: 41962 bytes --] [-- Attachment #5: 4.png --] [-- Type: image/png, Size: 42236 bytes --] [-- Attachment #6: 5.png --] [-- Type: image/png, Size: 47733 bytes --] [-- Attachment #7: 6.png --] [-- Type: image/png, Size: 46979 bytes --] [-- Attachment #8: 7.png --] [-- Type: image/png, Size: 42612 bytes --] [-- Attachment #9: Type: text/plain, Size: 21 bytes --] -- Nicolas Avrutin ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-06 9:42 ` martin rudalics 2014-08-06 15:40 ` Nicolas Avrutin @ 2014-08-06 17:59 ` Nicolas Avrutin 2014-08-07 15:08 ` martin rudalics 1 sibling, 1 reply; 26+ messages in thread From: Nicolas Avrutin @ 2014-08-06 17:59 UTC (permalink / raw) To: martin rudalics; +Cc: 18196 [-- Attachment #1: Type: text/plain, Size: 3037 bytes --] Doesn't seem like my email went though because my screenshots were too large. Let's try this again. On Wed, Aug 06 2014, martin rudalics <rudalics@gmx.at> wrote: > Might be. I attached a new patch. If you still see the problem please > tell me the size of the terminal and maybe add a screenshot. Can you > type into the text window or the minibuffer when it happens? The second issue is still there with the last patch. Interestingly enough, I can only reproduce this with emacsclient, not emacs itself. I don't see a difference with this issue between your second patch and your third patch. Steps to reproduce: 1. emacs -Q 2. M-: server-start 3. emacsclient -nw The dimensions of the terminal with the emacsclient are 134 cols and 38 lines (according to tput cols and tput lines). The dimensions of the terminal window (including scroll bar and 1px window border on all sides) should be 960x540 (1/4 of a 1920x1080 screen). I don't know the exact width of the scroll bar, so I can't easily give you the dimensions of the "interior" of the terminal. I can also reproduce the issue with a terminal smaller than this. Screenshots: 1.png: emacs window on the left, terminal from which emacs was opened on the top right, terminal with emacsclient -nw opened in the bottom right. Notice that neither the next from the *scratch* buffer nor the menu bar are visible. 2.png: I type "foo bar" in the emacsclient. The text appears in emacsclient and the emacs window because they are both in the *scratch* buffer. Notice how in the emacsclient, the buffer is marked as modified on the line below the displayed modeline. The modeline is actually on the bottom line, not on the second line from the bottom. The second line is a static artifact. 3.png: I press M-: and type something in the minibuffer. It overwrites the actual modeline on the bottom line, of which the modified buffer marker was the only thing visible. Entering the minibuffer caused an entry in the menubar to change. The new entry (Minibuf Help) is now visible. 4.png: I press C-g to exit the minibuffer then RET to advance to the next line and then down arrow. The line number in the modeline (line 6) is displayed on the last line, the same line as the echo area. The menubar is updated. 5.png: I press C-SPC and up arrow to select the next on the first few lines. The next becomes visible now. 6.png: I press C-g to cancel the selection. The text remains visible. 7.png: I press F10 to open the menu and then F10 again to close it. The parts of the menubar that were redrawn when I did that (File part of Edit) are visible now. I press C-x C-f and open a new file. Most of the modeline is redrawn on the bottom line. The original location of the modeline on the second to last has not been redrawn since openening the emacsclient. At any point, if I full-screen the terminal with the emacsclient, the entire emacsclient gets redrawn and the display bugs disappear. If I then restore the terminal to the smaller size, it continues to function properly. Thanks [-- Attachment #2: 1.png --] [-- Type: image/png, Size: 16144 bytes --] [-- Attachment #3: 2.png --] [-- Type: image/png, Size: 16557 bytes --] [-- Attachment #4: 3.png --] [-- Type: image/png, Size: 17054 bytes --] [-- Attachment #5: 4.png --] [-- Type: image/png, Size: 17102 bytes --] [-- Attachment #6: 5.png --] [-- Type: image/png, Size: 18909 bytes --] [-- Attachment #7: 6.png --] [-- Type: image/png, Size: 19041 bytes --] [-- Attachment #8: 7.png --] [-- Type: image/png, Size: 17061 bytes --] [-- Attachment #9: Type: text/plain, Size: 21 bytes --] -- Nicolas Avrutin ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-06 17:59 ` Nicolas Avrutin @ 2014-08-07 15:08 ` martin rudalics 2014-08-07 15:36 ` Eli Zaretskii 2014-08-07 18:12 ` Nicolas Avrutin 0 siblings, 2 replies; 26+ messages in thread From: martin rudalics @ 2014-08-07 15:08 UTC (permalink / raw) To: Nicolas Avrutin; +Cc: 18196 > Steps to reproduce: > 1. emacs -Q > 2. M-: server-start > 3. emacsclient -nw Easily reproducible. > The dimensions of the terminal with the emacsclient are 134 cols and 38 > lines (according to tput cols and tput lines). The dimensions of the > terminal window (including scroll bar and 1px window border on all > sides) should be 960x540 (1/4 of a 1920x1080 screen). I don't know the > exact width of the scroll bar, so I can't easily give you the dimensions > of the "interior" of the terminal. I can also reproduce the issue with a > terminal smaller than this. Hopefully this was a trivial bug which tried to apply the minimum pixel height of your server root window (some few lines multiplied by your default character height, I get a value of 72 here) to the terminal window. This can easily exceed the capabilities of the terminal window (which is clearly less than 72 lines here). I checked in a fix. Please try again with the latest trunk and the last patch I sent you (provided it still applies). In any case this raises a general question for TTYs: How to proceed when the terminal window is made so small that the Emacs windows won't fit any more in their frame? This is an unlikely situation and we earlier handled it by deleting all windows but the frame's selected window. I suppose I have to do that now again :-( Thanks for the illustrative caps, martin ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-07 15:08 ` martin rudalics @ 2014-08-07 15:36 ` Eli Zaretskii 2014-08-07 18:12 ` Nicolas Avrutin 1 sibling, 0 replies; 26+ messages in thread From: Eli Zaretskii @ 2014-08-07 15:36 UTC (permalink / raw) To: martin rudalics; +Cc: 18196, nicolasavru > Date: Thu, 07 Aug 2014 17:08:11 +0200 > From: martin rudalics <rudalics@gmx.at> > Cc: 18196@debbugs.gnu.org > > In any case this raises a general question for TTYs: How to proceed when > the terminal window is made so small that the Emacs windows won't fit > any more in their frame? This is an unlikely situation and we earlier > handled it by deleting all windows but the frame's selected window. I > suppose I have to do that now again :-( Yes. But if that somehow doesn't play right, just exiting would be OK, I think. ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-07 15:08 ` martin rudalics 2014-08-07 15:36 ` Eli Zaretskii @ 2014-08-07 18:12 ` Nicolas Avrutin 2014-08-08 8:43 ` martin rudalics 2014-08-10 9:17 ` martin rudalics 1 sibling, 2 replies; 26+ messages in thread From: Nicolas Avrutin @ 2014-08-07 18:12 UTC (permalink / raw) To: martin rudalics; +Cc: 18196 On Thu, Aug 07 2014, martin rudalics <rudalics@gmx.at> wrote: > Please try again with the latest trunk and the last patch I sent you > (provided it still applies). Everything looks good. Your patch still applies fine and fixes the face background crash, and your commit fixes the terminal emacsclient display issue. Thanks -- Nicolas Avrutin ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-07 18:12 ` Nicolas Avrutin @ 2014-08-08 8:43 ` martin rudalics 2014-08-08 9:19 ` Eli Zaretskii 2014-08-10 9:17 ` martin rudalics 1 sibling, 1 reply; 26+ messages in thread From: martin rudalics @ 2014-08-08 8:43 UTC (permalink / raw) To: Nicolas Avrutin; +Cc: 18196, Mat Smiglarski [-- Attachment #1: Type: text/plain, Size: 2513 bytes --] > Everything looks good. Your patch still applies fine and fixes the face > background crash, and your commit fixes the terminal emacsclient display > issue. OK. This was part one of our endeavour. We now have to discuss with Eli on how to proceed. The current patch has three advantages: (1) It doesn't violate the uniform interface where all calls to change_frame_size and adjust_frame_size use the window's text sizes as arguments. (2) It doesn't require any change in window.c. (3) It has been tested. It has the following disadvantages: (1) Code changes in term.c and w32console.c from FRAME_LINES to FRAME_TOTAL_LINES. (2) change_frame_size and adjust_frame_size must be explicitly called with FRAME_MENU_BAR_LINES subtracted after calling get_tty_size. Alternatively, I could try to do what I mentioned earlier: Change the definition of FRAME_TOP_MARGIN and FRAME_TOP_MARGIN_HEIGHT so that these do not count the menubar for TTY frames. This means that I would have to check every use of these macros for whether the underlying system is a TTY or not. This solution would have the following advantages: (1) Code in term.c and w32console.c would remain unchanged. (2) The calls of change_frame_size and adjust_frame_size after a get_tty_size would remain unchanged. Disadvantages are: (1) Code in window.c would have to be special cased for TTY: Affected are Fdelete_other_windows_internal, Fwindow_resize_apply_total and resize_frame_windows. (2) I don't yet know how the two uses of FRAME_TOP_MARGIN in dispnew.c would be affected. I suspect that something there might be fishy anyway without any visible consequences but am too silly to understand it. (3) The semantics of the size arguments in change_frame_size and adjust_frame_size would become inconsistent wrt GUI builds. We'd include the menubar for TTYs and exclude them for GUIs. (4) We'd have to specially mention TTYs in all documentations of frame size parameters and functions setting or querying the size of frames. Personally, I think that the real show-stopper here is (4). One major aim of adjust_frame_size was to provide a unified concept where functions like `frame-text-height' and `set-frame-height' conceptually do not count menu and tool bars throughout all builds, that is, always refer to the "same object". In any case I once more attach the patch I posted earlier. Mat could you try whether it solves Bug#18161 for you? martin [-- Attachment #2: tty-frame-size.diff --] [-- Type: text/plain, Size: 9594 bytes --] === 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-06 08:45:15 +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. */ @@ -917,7 +918,9 @@ #endif FRAME_MENU_BAR_LINES (f) = NILP (Vmenu_bar_mode) ? 0 : 1; + FRAME_LINES (f) = FRAME_LINES (f) - FRAME_MENU_BAR_LINES (f); FRAME_MENU_BAR_HEIGHT (f) = FRAME_MENU_BAR_LINES (f) * FRAME_LINE_HEIGHT (f); + FRAME_TEXT_HEIGHT (f) = FRAME_TEXT_HEIGHT (f) - FRAME_MENU_BAR_HEIGHT (f); /* Set the top frame to the newly created frame. */ if (FRAMEP (FRAME_TTY (f)->top_frame) @@ -1037,7 +1040,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 +1171,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; } @@ -2733,7 +2736,7 @@ return make_number (FRAME_PIXEL_HEIGHT (f)); else #endif - return make_number (FRAME_LINES (f)); + return make_number (FRAME_TOTAL_LINES (f)); } DEFUN ("frame-pixel-width", Fframe_pixel_width, @@ -2750,7 +2753,7 @@ return make_number (FRAME_PIXEL_WIDTH (f)); else #endif - return make_number (FRAME_COLS (f)); + return make_number (FRAME_TOTAL_COLS (f)); } DEFUN ("tool-bar-pixel-width", Ftool_bar_pixel_width, === 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; ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-08 8:43 ` martin rudalics @ 2014-08-08 9:19 ` Eli Zaretskii 2014-08-08 10:10 ` martin rudalics 0 siblings, 1 reply; 26+ messages in thread From: Eli Zaretskii @ 2014-08-08 9:19 UTC (permalink / raw) To: martin rudalics; +Cc: 18196, penthief, nicolasavru > Date: Fri, 08 Aug 2014 10:43:05 +0200 > From: martin rudalics <rudalics@gmx.at> > CC: 18196@debbugs.gnu.org, "eliz@gnu.org" <eliz@gnu.org>, > Mat Smiglarski <penthief@SDF.ORG> > > OK. This was part one of our endeavour. We now have to discuss with > Eli on how to proceed. The current patch has three advantages: > > (1) It doesn't violate the uniform interface where all calls to > change_frame_size and adjust_frame_size use the window's text sizes > as arguments. > > (2) It doesn't require any change in window.c. > > (3) It has been tested. > > It has the following disadvantages: > > (1) Code changes in term.c and w32console.c from FRAME_LINES to > FRAME_TOTAL_LINES. > > (2) change_frame_size and adjust_frame_size must be explicitly called > with FRAME_MENU_BAR_LINES subtracted after calling get_tty_size. I don't mind these disadvantages, if what you describe is all of them. (I don't know enough about the code involved to have my own opinion on the disadvantages.) So, unless you prefer the other alternatives, I have no objections to your going ahead with this one. Thanks. ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-08 9:19 ` Eli Zaretskii @ 2014-08-08 10:10 ` martin rudalics 2014-08-08 14:38 ` Mat Smiglarski 0 siblings, 1 reply; 26+ messages in thread From: martin rudalics @ 2014-08-08 10:10 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 18196, penthief, nicolasavru > I don't mind these disadvantages, if what you describe is all of > them. (I don't know enough about the code involved to have my own > opinion on the disadvantages.) I hope I listed them all. > So, unless you prefer the other alternatives, I have no objections to > your going ahead with this one. Fine. I'll wait till I get a response from Mat Smiglarski. Thanks, martin ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-08 10:10 ` martin rudalics @ 2014-08-08 14:38 ` Mat Smiglarski 2014-08-10 9:18 ` martin rudalics 0 siblings, 1 reply; 26+ messages in thread From: Mat Smiglarski @ 2014-08-08 14:38 UTC (permalink / raw) To: martin rudalics; +Cc: 18196, nicolasavru > Fine. I'll wait till I get a response from Mat Smiglarski. > > Thanks, martin Oh, hello. I am in the process of relocating and won't see my laptop until Monday. I am sorry I cannot confirm the patch works on this occasion. ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-08 14:38 ` Mat Smiglarski @ 2014-08-10 9:18 ` martin rudalics 2014-08-12 4:00 ` tsugutomo.enami 2014-08-12 21:27 ` Mat Smiglarski 0 siblings, 2 replies; 26+ messages in thread From: martin rudalics @ 2014-08-10 9:18 UTC (permalink / raw) To: Mat Smiglarski; +Cc: 18196, nicolasavru > Oh, hello. I am in the process of relocating and won't see my laptop until Monday. > > I am sorry I cannot confirm the patch works on this occasion. I meanwhile checked it in on trunk as revision#117679. Please update your trunk as soon as you can and tell me whether it fixes your bug. Thanks, martin ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-10 9:18 ` martin rudalics @ 2014-08-12 4:00 ` tsugutomo.enami 2014-08-12 9:53 ` martin rudalics 2014-08-12 21:27 ` Mat Smiglarski 1 sibling, 1 reply; 26+ messages in thread From: tsugutomo.enami @ 2014-08-12 4:00 UTC (permalink / raw) To: martin rudalics; +Cc: 18196 > I meanwhile checked it in on trunk as revision#117679. Hi. I still have a problem regarding to tty frame height and toggling menu-bar-mode even after the revision#117679 (actually, I have emacs built from revision#117691). The symptom is that the value of frame height in frame-parameter remain unchanged after menu-bar-mode is toggled. As a result, screen is drawed wrong or incorrect scroll region is set when emacs is suspended (until, for example, sending SIGWINCH by kill command or by changing terminal size). I guess change_frame_size needs to be called with updated FRAME_MENU_BAR_LINES when menu-bar-mode is toggled. If necessary, I'll file another bug report so please let me know. enami. ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-12 4:00 ` tsugutomo.enami @ 2014-08-12 9:53 ` martin rudalics 2014-08-12 22:07 ` tsugutomo.enami 0 siblings, 1 reply; 26+ messages in thread From: martin rudalics @ 2014-08-12 9:53 UTC (permalink / raw) To: tsugutomo.enami; +Cc: 18196 > I still have a problem regarding to tty frame height and toggling > menu-bar-mode even after the revision#117679 (actually, I have emacs > built from revision#117691). > > The symptom is that the value of frame height in frame-parameter remain > unchanged after menu-bar-mode is toggled. As a result, screen is drawed > wrong or incorrect scroll region is set when emacs is suspended (until, > for example, sending SIGWINCH by kill command or by changing terminal > size). > > I guess change_frame_size needs to be called with updated > FRAME_MENU_BAR_LINES when menu-bar-mode is toggled. I guess you're right and I did so in revision 117694 on trunk. This should also fix an older crash when toggling the menu bar on with a one line high window on top of the frame. > If necessary, I'll file another bug report so please let me know. Please do so if the bug persists, a new one was introduced or you notice any other anomaly. Thanks, martin ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-12 9:53 ` martin rudalics @ 2014-08-12 22:07 ` tsugutomo.enami 2014-08-13 6:21 ` martin rudalics 0 siblings, 1 reply; 26+ messages in thread From: tsugutomo.enami @ 2014-08-12 22:07 UTC (permalink / raw) To: martin rudalics; +Cc: 18196 Hi, > I guess you're right and I did so in revision 117694 on trunk. This > should also fix an older crash when toggling the menu bar on with a one > line high window on top of the frame. I've just tested the revision and now it looks working fine. Thanks for you quick fix. enami. ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-12 22:07 ` tsugutomo.enami @ 2014-08-13 6:21 ` martin rudalics 0 siblings, 0 replies; 26+ messages in thread From: martin rudalics @ 2014-08-13 6:21 UTC (permalink / raw) To: tsugutomo.enami; +Cc: 18196 > I've just tested the revision and now it looks working fine. > Thanks for you quick fix. Thanks for checking, martin ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-10 9:18 ` martin rudalics 2014-08-12 4:00 ` tsugutomo.enami @ 2014-08-12 21:27 ` Mat Smiglarski 2014-08-13 6:21 ` martin rudalics 1 sibling, 1 reply; 26+ messages in thread From: Mat Smiglarski @ 2014-08-12 21:27 UTC (permalink / raw) To: martin rudalics; +Cc: 18196 On 2014-08-08 09:43, martin rudalics wrote: > In any case I once more attach the patch I posted earlier. Mat could > you try whether it solves Bug#18161 for you? On 2014-08-10 10:18, martin rudalics wrote: > I meanwhile checked it in on trunk as revision#117679. Please update > your trunk as soon as you can and tell me whether it fixes your bug. Yes, Bug#18161 is fixed on trunk as well as the emacs-24 branch. Regards, Mat My git-bisect attempt suggests trunk's original fix was here. commit 09862253094207f2002e457fba5dd569cf19f1cd Author: martin rudalics <rudalics@gmx.at> Date: Sun Jul 27 15:21:30 2014 +0200 ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-12 21:27 ` Mat Smiglarski @ 2014-08-13 6:21 ` martin rudalics 0 siblings, 0 replies; 26+ messages in thread From: martin rudalics @ 2014-08-13 6:21 UTC (permalink / raw) To: Mat Smiglarski; +Cc: 18196 > Yes, Bug#18161 is fixed on trunk as well as the emacs-24 branch. Hmmm... Are you sure it happened on the branch as well? martin ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-07 18:12 ` Nicolas Avrutin 2014-08-08 8:43 ` martin rudalics @ 2014-08-10 9:17 ` martin rudalics 2014-08-10 23:43 ` Nicolas Avrutin 1 sibling, 1 reply; 26+ messages in thread From: martin rudalics @ 2014-08-10 9:17 UTC (permalink / raw) To: Nicolas Avrutin; +Cc: 18196 > Everything looks good. Your patch still applies fine and fixes the face > background crash, and your commit fixes the terminal emacsclient display > issue. I checked that in now as revision#117679 on trunk. Please check whether everything works as expected. And thanks again for your invaluable help in debugging this. martin ^ permalink raw reply [flat|nested] 26+ messages in thread
* bug#18196: 24.4.50; crash when setting face background in terminal frame 2014-08-10 9:17 ` martin rudalics @ 2014-08-10 23:43 ` Nicolas Avrutin 0 siblings, 0 replies; 26+ messages in thread From: Nicolas Avrutin @ 2014-08-10 23:43 UTC (permalink / raw) To: martin rudalics; +Cc: 18196 On Sun, Aug 10 2014, martin rudalics <rudalics@gmx.at> wrote: > I checked that in now as revision#117679 on trunk. Please check whether > everything works as expected. And thanks again for your invaluable help > in debugging this. Everything looks good. Thanks for the quick fixes to these bugs. -- Nicolas Avrutin ^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2014-08-13 6:21 UTC | newest] Thread overview: 26+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-08-05 8:12 bug#18196: 24.4.50; crash when setting face background in terminal frame Nicolas Avrutin 2014-08-05 8:51 ` martin rudalics 2014-08-05 9:55 ` martin rudalics 2014-08-05 16:34 ` Nicolas Avrutin 2014-08-05 17:47 ` martin rudalics 2014-08-05 19:06 ` Nicolas Avrutin 2014-08-05 21:18 ` Nicolas Avrutin 2014-08-06 9:42 ` martin rudalics 2014-08-06 15:40 ` Nicolas Avrutin 2014-08-06 17:59 ` Nicolas Avrutin 2014-08-07 15:08 ` martin rudalics 2014-08-07 15:36 ` Eli Zaretskii 2014-08-07 18:12 ` Nicolas Avrutin 2014-08-08 8:43 ` martin rudalics 2014-08-08 9:19 ` Eli Zaretskii 2014-08-08 10:10 ` martin rudalics 2014-08-08 14:38 ` Mat Smiglarski 2014-08-10 9:18 ` martin rudalics 2014-08-12 4:00 ` tsugutomo.enami 2014-08-12 9:53 ` martin rudalics 2014-08-12 22:07 ` tsugutomo.enami 2014-08-13 6:21 ` martin rudalics 2014-08-12 21:27 ` Mat Smiglarski 2014-08-13 6:21 ` martin rudalics 2014-08-10 9:17 ` martin rudalics 2014-08-10 23:43 ` Nicolas Avrutin
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).