comparison src/terminal.c @ 13616:b6998c6374e1 v8.0.1680

patch 8.0.1680: memory allocated by libvterm is not profiled commit https://github.com/vim/vim/commit/756ef113d14428e598274f87672d7f0e34ff9781 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Apr 10 12:04:27 2018 +0200 patch 8.0.1680: memory allocated by libvterm is not profiled Problem: Memory allocated by libvterm does not show up in profile. Solution: Pass allocater functions to vterm_new().
author Christian Brabandt <cb@256bit.org>
date Tue, 10 Apr 2018 12:15:08 +0200
parents 200ef826e7dd
children 429f0eb87d6f
comparison
equal deleted inserted replaced
13615:08035c9f650d 13616:b6998c6374e1
37 * When the buffer is changed it is turned into a normal buffer, the attributes 37 * When the buffer is changed it is turned into a normal buffer, the attributes
38 * in tl_scrollback are no longer used. 38 * in tl_scrollback are no longer used.
39 * 39 *
40 * TODO: 40 * TODO:
41 * - Add a way to set the 16 ANSI colors, to be used for 'termguicolors' and in 41 * - Add a way to set the 16 ANSI colors, to be used for 'termguicolors' and in
42 * the GUI. 42 * the GUI. #2747
43 * - Win32: Make terminal used for :!cmd in the GUI work better. Allow for 43 * - Win32: Make terminal used for :!cmd in the GUI work better. Allow for
44 * redirection. Probably in call to channel_set_pipes(). 44 * redirection. Probably in call to channel_set_pipes().
45 * - implement term_setsize() 45 * - implement term_setsize()
46 * - Copy text in the vterm to the Vim buffer once in a while, so that 46 * - Copy text in the vterm to the Vim buffer once in a while, so that
47 * completion works. 47 * completion works.
48 * - Adding WinBar to terminal window doesn't display, text isn't shifted down.
49 * a job that uses 16 colors while Vim is using > 256.
50 * - in GUI vertical split causes problems. Cursor is flickering. (Hirohito 48 * - in GUI vertical split causes problems. Cursor is flickering. (Hirohito
51 * Higashi, 2017 Sep 19) 49 * Higashi, 2017 Sep 19)
52 * - after resizing windows overlap. (Boris Staletic, #2164) 50 * - after resizing windows overlap. (Boris Staletic, #2164)
53 * - Redirecting output does not work on MS-Windows, Test_terminal_redir_file() 51 * - Redirecting output does not work on MS-Windows, Test_terminal_redir_file()
54 * is disabled. 52 * is disabled.
3328 NULL, /* dcs */ 3326 NULL, /* dcs */
3329 NULL /* resize */ 3327 NULL /* resize */
3330 }; 3328 };
3331 3329
3332 /* 3330 /*
3331 * Use Vim's allocation functions for vterm so profiling works.
3332 */
3333 static void *
3334 vterm_malloc(size_t size, void *data UNUSED)
3335 {
3336 return alloc_clear(size);
3337 }
3338
3339 static void
3340 vterm_memfree(void *ptr, void *data UNUSED)
3341 {
3342 vim_free(ptr);
3343 }
3344
3345 static VTermAllocatorFunctions vterm_allocator = {
3346 &vterm_malloc,
3347 &vterm_memfree
3348 };
3349
3350 /*
3333 * Create a new vterm and initialize it. 3351 * Create a new vterm and initialize it.
3334 */ 3352 */
3335 static void 3353 static void
3336 create_vterm(term_T *term, int rows, int cols) 3354 create_vterm(term_T *term, int rows, int cols)
3337 { 3355 {
3338 VTerm *vterm; 3356 VTerm *vterm;
3339 VTermScreen *screen; 3357 VTermScreen *screen;
3340 VTermState *state; 3358 VTermState *state;
3341 VTermValue value; 3359 VTermValue value;
3342 3360
3343 vterm = vterm_new(rows, cols); 3361 vterm = vterm_new_with_allocator(rows, cols, &vterm_allocator, NULL);
3344 term->tl_vterm = vterm; 3362 term->tl_vterm = vterm;
3345 screen = vterm_obtain_screen(vterm); 3363 screen = vterm_obtain_screen(vterm);
3346 vterm_screen_set_callbacks(screen, &screen_callbacks, term); 3364 vterm_screen_set_callbacks(screen, &screen_callbacks, term);
3347 /* TODO: depends on 'encoding'. */ 3365 /* TODO: depends on 'encoding'. */
3348 vterm_set_utf8(vterm, 1); 3366 vterm_set_utf8(vterm, 1);