comparison src/terminal.c @ 13329:424321d6eea7 v8.0.1539

patch 8.0.1539: no test for the popup menu positioning commit https://github.com/vim/vim/commit/6bb2cdfe604e51eec216cbe23bb6e8fb47810347 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 24 19:53:53 2018 +0100 patch 8.0.1539: no test for the popup menu positioning Problem: No test for the popup menu positioning. Solution: Add a screendump test for the popup menu.
author Christian Brabandt <cb@256bit.org>
date Sat, 24 Feb 2018 20:00:07 +0100
parents 013c44d9dc09
children 73325d39591a
comparison
equal deleted inserted replaced
13328:2c639a9a4def 13329:424321d6eea7
1827 if (t_colors >= 16) 1827 if (t_colors >= 16)
1828 return color->ansi_index; 1828 return color->ansi_index;
1829 switch (color->ansi_index) 1829 switch (color->ansi_index)
1830 { 1830 {
1831 case 0: return 0; 1831 case 0: return 0;
1832 case 1: return lookup_color( 0, fg, boldp) + 1; 1832 case 1: return lookup_color( 0, fg, boldp) + 1; /* black */
1833 case 2: return lookup_color( 4, fg, boldp) + 1; /* dark red */ 1833 case 2: return lookup_color( 4, fg, boldp) + 1; /* dark red */
1834 case 3: return lookup_color( 2, fg, boldp) + 1; /* dark green */ 1834 case 3: return lookup_color( 2, fg, boldp) + 1; /* dark green */
1835 case 4: return lookup_color( 6, fg, boldp) + 1; /* brown */ 1835 case 4: return lookup_color( 6, fg, boldp) + 1; /* brown */
1836 case 5: return lookup_color( 1, fg, boldp) + 1; /* dark blue*/ 1836 case 5: return lookup_color( 1, fg, boldp) + 1; /* dark blue*/
1837 case 6: return lookup_color( 5, fg, boldp) + 1; /* dark magenta */ 1837 case 6: return lookup_color( 5, fg, boldp) + 1; /* dark magenta */
2870 (int)color->red, (int)color->green, (int)color->blue, 2870 (int)color->red, (int)color->green, (int)color->blue,
2871 (int)color->ansi_index); 2871 (int)color->ansi_index);
2872 } 2872 }
2873 2873
2874 /* 2874 /*
2875 * "term_dumpwrite(buf, filename, max-height, max-width)" function 2875 * "term_dumpwrite(buf, filename, options)" function
2876 * 2876 *
2877 * Each screen cell in full is: 2877 * Each screen cell in full is:
2878 * |{characters}+{attributes}#{fg-color}{color-idx}#{bg-color}{color-idx} 2878 * |{characters}+{attributes}#{fg-color}{color-idx}#{bg-color}{color-idx}
2879 * {characters} is a space for an empty cell 2879 * {characters} is a space for an empty cell
2880 * For a double-width character "+" is changed to "*" and the next cell is 2880 * For a double-width character "+" is changed to "*" and the next cell is
2897 f_term_dumpwrite(typval_T *argvars, typval_T *rettv UNUSED) 2897 f_term_dumpwrite(typval_T *argvars, typval_T *rettv UNUSED)
2898 { 2898 {
2899 buf_T *buf = term_get_buf(argvars); 2899 buf_T *buf = term_get_buf(argvars);
2900 term_T *term; 2900 term_T *term;
2901 char_u *fname; 2901 char_u *fname;
2902 int max_height = 99999; 2902 int max_height = 0;
2903 int max_width = 99999; 2903 int max_width = 0;
2904 stat_T st; 2904 stat_T st;
2905 FILE *fd; 2905 FILE *fd;
2906 VTermPos pos; 2906 VTermPos pos;
2907 VTermScreen *screen; 2907 VTermScreen *screen;
2908 VTermScreenCell prev_cell; 2908 VTermScreenCell prev_cell;
2911 return; 2911 return;
2912 if (buf == NULL) 2912 if (buf == NULL)
2913 return; 2913 return;
2914 term = buf->b_term; 2914 term = buf->b_term;
2915 2915
2916 if (argvars[2].v_type != VAR_UNKNOWN)
2917 {
2918 dict_T *d;
2919
2920 if (argvars[2].v_type != VAR_DICT)
2921 {
2922 EMSG(_(e_dictreq));
2923 return;
2924 }
2925 d = argvars[2].vval.v_dict;
2926 if (d != NULL)
2927 {
2928 max_height = get_dict_number(d, (char_u *)"rows");
2929 max_width = get_dict_number(d, (char_u *)"columns");
2930 }
2931 }
2932
2916 fname = get_tv_string_chk(&argvars[1]); 2933 fname = get_tv_string_chk(&argvars[1]);
2917 if (fname == NULL) 2934 if (fname == NULL)
2918 return; 2935 return;
2919 if (mch_stat((char *)fname, &st) >= 0) 2936 if (mch_stat((char *)fname, &st) >= 0)
2920 { 2937 {
2921 EMSG2(_("E953: File exists: %s"), fname); 2938 EMSG2(_("E953: File exists: %s"), fname);
2922 return; 2939 return;
2923 } 2940 }
2924 2941
2925 if (argvars[2].v_type != VAR_UNKNOWN)
2926 {
2927 max_height = get_tv_number(&argvars[2]);
2928 if (argvars[3].v_type != VAR_UNKNOWN)
2929 max_width = get_tv_number(&argvars[3]);
2930 }
2931
2932 if (*fname == NUL || (fd = mch_fopen((char *)fname, WRITEBIN)) == NULL) 2942 if (*fname == NUL || (fd = mch_fopen((char *)fname, WRITEBIN)) == NULL)
2933 { 2943 {
2934 EMSG2(_(e_notcreate), *fname == NUL ? (char_u *)_("<empty>") : fname); 2944 EMSG2(_(e_notcreate), *fname == NUL ? (char_u *)_("<empty>") : fname);
2935 return; 2945 return;
2936 } 2946 }
2937 2947
2938 vim_memset(&prev_cell, 0, sizeof(prev_cell)); 2948 vim_memset(&prev_cell, 0, sizeof(prev_cell));
2939 2949
2940 screen = vterm_obtain_screen(term->tl_vterm); 2950 screen = vterm_obtain_screen(term->tl_vterm);
2941 for (pos.row = 0; pos.row < max_height && pos.row < term->tl_rows; 2951 for (pos.row = 0; (max_height == 0 || pos.row < max_height)
2942 ++pos.row) 2952 && pos.row < term->tl_rows; ++pos.row)
2943 { 2953 {
2944 int repeat = 0; 2954 int repeat = 0;
2945 2955
2946 for (pos.col = 0; pos.col < max_width && pos.col < term->tl_cols; 2956 for (pos.col = 0; (max_width == 0 || pos.col < max_width)
2947 ++pos.col) 2957 && pos.col < term->tl_cols; ++pos.col)
2948 { 2958 {
2949 VTermScreenCell cell; 2959 VTermScreenCell cell;
2950 int same_attr; 2960 int same_attr;
2951 int same_chars = TRUE; 2961 int same_chars = TRUE;
2952 int i; 2962 int i;