X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/f5ebe84d75bb75156db9e2e0a7ab356941b4ea75..36dbe6fc3e141e5b4c87efec5026931b89f026a5:/src/term.c diff --git a/src/term.c b/src/term.c index 15d33b4e3e..6ab611d51e 100644 --- a/src/term.c +++ b/src/term.c @@ -44,8 +44,6 @@ along with GNU Emacs. If not, see . */ #include "keymap.h" #include "blockinput.h" #include "syssignal.h" -#include "systty.h" -#include "intervals.h" #ifdef MSDOS #include "msdos.h" static int been_here = -1; @@ -56,10 +54,6 @@ static int been_here = -1; #endif #include "cm.h" -#ifdef HAVE_X_WINDOWS -#include "xterm.h" -#endif - #include "menu.h" /* The name of the default console device. */ @@ -538,15 +532,13 @@ encode_terminal_code (struct glyph *src, int src_len, multibyte-form. But, it may be enlarged on demand if Vglyph_table contains a string or a composite glyph is encountered. */ - if (min (PTRDIFF_MAX, SIZE_MAX) / MAX_MULTIBYTE_LENGTH < src_len) + if (INT_MULTIPLY_WRAPV (src_len, MAX_MULTIBYTE_LENGTH, &required)) memory_full (SIZE_MAX); - required = src_len; - required *= MAX_MULTIBYTE_LENGTH; if (encode_terminal_src_size < required) - { - encode_terminal_src = xrealloc (encode_terminal_src, required); - encode_terminal_src_size = required; - } + encode_terminal_src = xpalloc (encode_terminal_src, + &encode_terminal_src_size, + required - encode_terminal_src_size, + -1, sizeof *encode_terminal_src); charset_list = coding_charset_list (coding); @@ -1862,9 +1854,11 @@ produce_glyphless_glyph (struct it *it, Lisp_Object acronym) else { eassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE); - len = (it->c < 0x10000 ? sprintf (buf, "\\u%04X", it->c) - : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "\\U%06X", it->c) - : sprintf (buf, "\\x%06X", it->c)); + len = sprintf (buf, + (it->c < 0x10000 ? "\\u%04X" + : it->c <= MAX_UNICODE_CHAR ? "\\U%06X" + : "\\x%06X"), + it->c + 0u); } str = buf; } @@ -3115,6 +3109,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, Lisp_Object selectface; int first_item = 0; int col, row; + Lisp_Object prev_inhibit_redisplay = Vinhibit_redisplay; USE_SAFE_ALLOCA; /* Don't allow non-positive x0 and y0, lest the menu will wrap @@ -3157,6 +3152,11 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, buffers_num_deleted = 1; } + /* Inhibit redisplay for as long as the menu is active, to avoid + messing the screen if some timer calls sit-for or a similar + function. */ + Vinhibit_redisplay = Qt; + /* Force update of the current frame, so that the desired and the current matrices are identical. */ update_frame_with_menu (sf, -1, -1); @@ -3347,6 +3347,7 @@ tty_menu_activate (tty_menu *menu, int *pane, int *selidx, if (!kbd_buffer_events_waiting ()) clear_input_pending (); SAFE_FREE (); + Vinhibit_redisplay = prev_inhibit_redisplay; return result; } @@ -4026,12 +4027,12 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed) "Terminal type %s is not defined", "Terminal type %s is not defined.\n\ If that is not the actual type of terminal you have,\n\ -use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ -`setenv TERM ...') to specify the correct type. It may be necessary\n" +use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\ +'setenv TERM ...') to specify the correct type. It may be necessary\n" #ifdef TERMINFO -"to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.", +"to do 'unset TERMINFO' (C-shell: 'unsetenv TERMINFO') as well.", #else -"to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", +"to do 'unset TERMCAP' (C-shell: 'unsetenv TERMCAP') as well.", #endif terminal_type); } @@ -4305,12 +4306,12 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ "Terminal type \"%s\" is not powerful enough to run Emacs.\n\ It lacks the ability to position the cursor.\n\ If that is not the actual type of terminal you have,\n\ -use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ -`setenv TERM ...') to specify the correct type. It may be necessary\n" +use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\ +'setenv TERM ...') to specify the correct type. It may be necessary\n" # ifdef TERMINFO -"to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.", +"to do 'unset TERMINFO' (C-shell: 'unsetenv TERMINFO') as well.", # else /* TERMCAP */ -"to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.", +"to do 'unset TERMCAP' (C-shell: 'unsetenv TERMCAP') as well.", # endif /* TERMINFO */ terminal_type); }