# HG changeset patch # User vimboss # Date 1104666199 0 # Node ID 8c25f10d49e7186c9785a0f01612166f20a29298 # Parent 90188be4861fb74e280cb576160a89786f9b56ca updated for version 7.0028 diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.0aa. Last change: 2004 Dec 31 +*todo.txt* For Vim version 7.0aa. Last change: 2005 Jan 01 VIM REFERENCE MANUAL by Bram Moolenaar @@ -30,12 +30,15 @@ be worked on, but only if you sponsor Vi *known-bugs* -------------------- Known bugs and current work ----------------------- -When using ":new" relative cursor position causes first line to disappear. -(Jens Paulus, Opening a new window) +patch for QuickFixCmdPre and QuickFixCmdPost autocommands. (Ciaran McCreesh, +2005 Jan 1) + +New toolbar button from Martin Dalecki: +- add remark in version7.txt +- check if it works for pixmap loaded from a file. Awaiting response: - Patch for mch_FullName() also in Vim 6.3? os_mswin.c -- patch for MakePre and MakePost autocommands. (Ciaran McCreesh) - Win32: "gvim -V100" should use dialog with scrollbar. Using gui_mch_dialog() would be good, but need to move display_errors() to after creating the window, so that s_hwnd is valid. @@ -64,7 +67,6 @@ PLANNED FOR VERSION 7.0: - function reference Check old patch from Robert Webb for array support. Add type checking? See ~/vim/ideas.txt. -- Add "{range}execute": execute lines from a buffer. - Add SPELLCHECKER, with easy to add support for many languages. 8 Add spell checking. Use "ispell -a" somehow. ~/vim/patches/wm_vim-5_4d.zip can be used as an example (includes @@ -82,6 +84,7 @@ PLANNED FOR VERSION 7.0: - Patch from Martin Dalecki. (2004 Dec) Uses ispell implements "undercurl" attribute. But how to set its color? Perhaps use "guicurl=Red" instead? + If underline and undercurl are both there use undercurl only. - REFACTORING: The main() function is very long. Move parts to separate functions, especially loops. Ideas from Walter Briscoe (2003 Apr 3, 2004 Feb 9). @@ -1514,9 +1517,12 @@ 7 SpecialKey highlighting overrules sy Built-in script language: 8 Add referring to key options with "&t_xx". Both for "echo &t_xx" and ":let &t_xx =". Useful for making portable mappings. -8 Allow range for ":exec". Pass it on to the executed command. (Webb) 8 exists("&&option") tests if 'option' is actually implemented. Useful for 'shellslash', for example. +- Add "{range}source": execute lines from a buffer. + Alternative: Allow range for ":exec", pass it on to the executed command. + (Webb) + You can already yank lines and use :@" to execute them. 8 Have a look at VSEL. Would it be useful to include? (Bigham) 8 Add ":fungroup" command, to group function definitions together. When encountered, all functions in the group are removed. Suggest using an diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt --- a/runtime/doc/version7.txt +++ b/runtime/doc/version7.txt @@ -1,4 +1,4 @@ -*version7.txt* For Vim version 7.0aa. Last change: 2004 Dec 31 +*version7.txt* For Vim version 7.0aa. Last change: 2005 Jan 01 VIM REFERENCE MANUAL by Bram Moolenaar @@ -627,4 +627,13 @@ break, resulting in "selected 202 of 201 Motif: fonts were not used for dialog components. (Martin Dalecki) +When using "y`x" where mark x is in the first column, the last line was +not included. + +Not all test scripts work properly on MS-Windows when checked out from CVS. +Use a Vim command to fix all fileformats to dos before executing the tests. + +When using ":new" and the file fits in the window, lines could still be above +the window. Now remove empty lines instead of keeping the relative position. + vim:tw=78:ts=8:ft=help:norl: diff --git a/src/eval.c b/src/eval.c --- a/src/eval.c +++ b/src/eval.c @@ -418,7 +418,7 @@ static void var_free_one __ARGS((VAR v)) static void list_one_var __ARGS((VAR v, char_u *prefix)); static void list_vim_var __ARGS((int i)); static void list_one_var_a __ARGS((char_u *prefix, char_u *name, int type, char_u *string)); -static void set_var __ARGS((char_u *name, VAR varp)); +static void set_var __ARGS((char_u *name, VAR varp, int copy)); static void copy_var __ARGS((VAR from, VAR to)); static char_u *find_option_end __ARGS((char_u **arg, int *opt_flags)); static char_u *trans_function_name __ARGS((char_u **pp, int skip, int internal)); @@ -455,7 +455,7 @@ set_internal_string_var(name, value) varp = alloc_string_var(val); if (varp != NULL) { - set_var(name, varp); + set_var(name, varp, FALSE); free_var(varp); } } @@ -1214,7 +1214,7 @@ ex_let(eap) } else { - set_var(temp_string, &retvar); + set_var(temp_string, &retvar, TRUE); vim_free(temp_string); } } @@ -1223,7 +1223,7 @@ ex_let(eap) { c1 = *p; *p = NUL; - set_var(arg, &retvar); + set_var(arg, &retvar, TRUE); *p = c1; /* put char back for error messages */ } } @@ -6879,7 +6879,7 @@ f_setbufvar(argvars, retvar) { STRCPY(bufvarname, "b:"); STRCPY(bufvarname + 2, varname); - set_var(bufvarname, varp); + set_var(bufvarname, varp, TRUE); vim_free(bufvarname); } } @@ -7040,7 +7040,7 @@ f_setwinvar(argvars, retvar) { STRCPY(winvarname, "w:"); STRCPY(winvarname + 2, varname); - set_var(winvarname, varp); + set_var(winvarname, varp, TRUE); vim_free(winvarname); } } @@ -7193,7 +7193,8 @@ f_remote_peek(argvars, retvar) { v.var_type = VAR_STRING; v.var_val.var_string = vim_strsave(s); - set_var(get_var_string(&argvars[1]), &v); + set_var(get_var_string(&argvars[1]), &v, FALSE); + vim_free(v.var_val.var_string); } #else retvar->var_val.var_number = -1; @@ -7313,7 +7314,8 @@ remote_common(argvars, retvar, expr) sprintf((char *)str, "0x%x", (unsigned int)w); v.var_type = VAR_STRING; v.var_val.var_string = vim_strsave(str); - set_var(get_var_string(&argvars[2]), &v); + set_var(get_var_string(&argvars[2]), &v, FALSE); + vim_free(v.var_val.var_string); } } #endif @@ -9191,9 +9193,10 @@ list_one_var_a(prefix, name, type, strin * Otherwise the variable is created. */ static void -set_var(name, varp) +set_var(name, varp, copy) char_u *name; VAR varp; + int copy; /* make copy of value in "varp" */ { int i; VAR v; @@ -9215,10 +9218,17 @@ set_var(name, varp) if (vimvars[i].type == VAR_STRING) { vim_free(vimvars[i].val); - vimvars[i].val = vim_strsave(get_var_string(varp)); + if (copy || varp->var_type != VAR_STRING) + vimvars[i].val = vim_strsave(get_var_string(varp)); + else + { + /* Take over the string to avoid an extra alloc/free. */ + vimvars[i].val = varp->var_val.var_string; + varp->var_val.var_string = NULL; + } } else - vimvars[i].val = (char_u *)(long)varp->var_val.var_number; + vimvars[i].val = (char_u *)get_var_number(varp); } return; } @@ -9254,7 +9264,13 @@ set_var(name, varp) if (i == gap->ga_len) ++gap->ga_len; } - copy_var(varp, v); + if (copy || varp->var_type != VAR_STRING) + copy_var(varp, v); + else + { + v->var_type = varp->var_type; + v->var_val.var_string = varp->var_val.var_string; + } } static void @@ -10663,7 +10679,7 @@ read_viminfo_varlist(virp, writing) /* assign the value to the variable */ if (varp != NULL) { - set_var(virp->vir_line + 1, varp); + set_var(virp->vir_line + 1, varp, FALSE); free_var(varp); } } diff --git a/src/gui_x11.c b/src/gui_x11.c --- a/src/gui_x11.c +++ b/src/gui_x11.c @@ -1286,8 +1286,8 @@ gui_mch_init_check() open_app_context(); if (app_context != NULL) gui.dpy = XtOpenDisplay(app_context, 0, VIM_NAME, VIM_CLASS, - cmdline_options, XtNumber(cmdline_options), - CARDINAL &gui_argc, gui_argv); + cmdline_options, XtNumber(cmdline_options), + CARDINAL &gui_argc, gui_argv); if (app_context == NULL || gui.dpy == NULL) { @@ -1565,9 +1565,7 @@ gui_mch_init() gui_mch_uninit() { gui_x11_destroy_widgets(); -#ifndef LESSTIF_VERSION XtCloseDisplay(gui.dpy); -#endif gui.dpy = NULL; vimShell = (Widget)0; } @@ -1787,6 +1785,9 @@ gui_mch_set_shellsize(width, height, min int base_width; int base_height; { +#ifdef FEAT_XIM + height += xim_get_status_area_height(), +#endif XtVaSetValues(vimShell, XtNwidthInc, gui.char_width, XtNheightInc, gui.char_height, @@ -1797,11 +1798,7 @@ gui_mch_set_shellsize(width, height, min XtNminWidth, min_width, XtNminHeight, min_height, XtNwidth, width, -#ifdef FEAT_XIM - XtNheight, height + xim_get_status_area_height(), -#else XtNheight, height, -#endif NULL); } @@ -3505,244 +3502,6 @@ mch_set_mouse_shape(shape) } #endif -#if defined(FEAT_TOOLBAR) || defined(PROTO) -/* - * Icons used by the toolbar code. - */ -#include "../pixmaps/tb_new.xpm" -#include "../pixmaps/tb_open.xpm" -#include "../pixmaps/tb_close.xpm" -#include "../pixmaps/tb_save.xpm" -#include "../pixmaps/tb_print.xpm" -#include "../pixmaps/tb_cut.xpm" -#include "../pixmaps/tb_copy.xpm" -#include "../pixmaps/tb_paste.xpm" -#include "../pixmaps/tb_find.xpm" -#include "../pixmaps/tb_find_next.xpm" -#include "../pixmaps/tb_find_prev.xpm" -#include "../pixmaps/tb_find_help.xpm" -#include "../pixmaps/tb_exit.xpm" -#include "../pixmaps/tb_undo.xpm" -#include "../pixmaps/tb_redo.xpm" -#include "../pixmaps/tb_help.xpm" -#include "../pixmaps/tb_macro.xpm" -#include "../pixmaps/tb_make.xpm" -#include "../pixmaps/tb_save_all.xpm" -#include "../pixmaps/tb_jump.xpm" -#include "../pixmaps/tb_ctags.xpm" -#include "../pixmaps/tb_load_session.xpm" -#include "../pixmaps/tb_save_session.xpm" -#include "../pixmaps/tb_new_session.xpm" -#include "../pixmaps/tb_blank.xpm" -#include "../pixmaps/tb_maximize.xpm" -#include "../pixmaps/tb_split.xpm" -#include "../pixmaps/tb_minimize.xpm" -#include "../pixmaps/tb_shell.xpm" -#include "../pixmaps/tb_replace.xpm" -#include "../pixmaps/tb_vsplit.xpm" -#include "../pixmaps/tb_maxwidth.xpm" -#include "../pixmaps/tb_minwidth.xpm" - -/* - * Those are the pixmaps used for the default buttons. - */ -static char **(built_in_pixmaps[]) = -{ - tb_new_xpm, - tb_open_xpm, - tb_save_xpm, - tb_undo_xpm, - tb_redo_xpm, - tb_cut_xpm, - tb_copy_xpm, - tb_paste_xpm, - tb_print_xpm, - tb_help_xpm, - tb_find_xpm, - tb_save_all_xpm, - tb_save_session_xpm, - tb_new_session_xpm, - tb_load_session_xpm, - tb_macro_xpm, - tb_replace_xpm, - tb_close_xpm, - tb_maximize_xpm, - tb_minimize_xpm, - tb_split_xpm, - tb_shell_xpm, - tb_find_prev_xpm, - tb_find_next_xpm, - tb_find_help_xpm, - tb_make_xpm, - tb_jump_xpm, - tb_ctags_xpm, - tb_vsplit_xpm, - tb_maxwidth_xpm, - tb_minwidth_xpm, - tb_exit_xpm -}; - -static void createXpmImages __ARGS((char_u *path, char **xpm, Pixmap *sen, Pixmap *insen)); - -/* - * Allocated a pixmap for toolbar menu "menu". - * Return in "sen" and "insen". "insen" can be NULL. - */ - void -get_toolbar_pixmap(menu, sen, insen) - vimmenu_T *menu; - Pixmap *sen; - Pixmap *insen; -{ - char_u buf[MAXPATHL]; /* buffer storing expanded pathname */ - char **xpm = NULL; /* xpm array */ - - buf[0] = NUL; /* start with NULL path */ - - if (menu->iconfile != NULL) - { - /* Use the "icon=" argument. */ - gui_find_iconfile(menu->iconfile, buf, "xpm"); - createXpmImages(buf, NULL, sen, insen); - - /* If it failed, try using the menu name. */ - if (*sen == (Pixmap)0 && gui_find_bitmap(menu->name, buf, "xpm") == OK) - createXpmImages(buf, NULL, sen, insen); - if (*sen != (Pixmap)0) - return; - } - - if (menu->icon_builtin || gui_find_bitmap(menu->name, buf, "xpm") == FAIL) - { - if (menu->iconidx >= 0 && menu->iconidx - < (sizeof(built_in_pixmaps) / sizeof(built_in_pixmaps[0]))) - xpm = built_in_pixmaps[menu->iconidx]; - else - xpm = tb_blank_xpm; - } - - if (xpm != NULL || buf[0] != NUL) - createXpmImages(buf, xpm, sen, insen); -} - -/* Indices for named colors */ -#define BACKGROUND 0 -#define FOREGROUND 1 -#define BOTTOM_SHADOW 2 -#define TOP_SHADOW 3 -#define HIGHLIGHT 4 - -/* - * Read an Xpm file, doing color substitutions for the foreground and - * background colors. If there is an error reading a color xpm file, - * drop back and read the monochrome file. If successful, create the - * insensitive Pixmap too. - */ - static void -createXpmImages(path, xpm, sen, insen) - char_u *path; - char **xpm; - Pixmap *sen; - Pixmap *insen; /* can be NULL */ -{ - Window rootWindow; - XpmAttributes attrs; - XpmColorSymbol color[5] = - { - {"none", "none", 0}, - {"iconColor1", NULL, 0}, - {"bottomShadowColor", NULL, 0}, - {"topShadowColor", NULL, 0}, - {"selectColor", NULL, 0} - }; - int screenNum; - int status; - Pixmap mask; - Pixmap map; - - gui_mch_get_toolbar_colors( - &color[BACKGROUND].pixel, - &color[FOREGROUND].pixel, - &color[BOTTOM_SHADOW].pixel, - &color[TOP_SHADOW].pixel, - &color[HIGHLIGHT].pixel); - - /* Setup the color subsititution table */ - attrs.valuemask = XpmColorSymbols; - attrs.colorsymbols = color; - attrs.numsymbols = 5; - - screenNum = DefaultScreen(gui.dpy); - rootWindow = RootWindow(gui.dpy, screenNum); - - /* Create the "sensitive" pixmap */ - if (xpm != NULL) - status = XpmCreatePixmapFromData(gui.dpy, rootWindow, xpm, - &map, &mask, &attrs); - else - status = XpmReadFileToPixmap(gui.dpy, rootWindow, (char *)path, - &map, &mask, &attrs); - if (status == XpmSuccess && map != 0) - { - XGCValues gcvalues; - GC back_gc; - GC mask_gc; - - /* Need to create new Pixmaps with the mask applied. */ - gcvalues.foreground = color[BACKGROUND].pixel; - back_gc = XCreateGC(gui.dpy, map, GCForeground, &gcvalues); - mask_gc = XCreateGC(gui.dpy, map, GCForeground, &gcvalues); - XSetClipMask(gui.dpy, mask_gc, mask); - - /* Create the "sensitive" pixmap. */ - *sen = XCreatePixmap(gui.dpy, rootWindow, - attrs.width, attrs.height, - DefaultDepth(gui.dpy, screenNum)); - XFillRectangle(gui.dpy, *sen, back_gc, 0, 0, - attrs.width, attrs.height); - XCopyArea(gui.dpy, map, *sen, mask_gc, 0, 0, - attrs.width, attrs.height, 0, 0); - -#ifdef FEAT_GUI_MOTIF /* not used for Athena */ - if (insen != NULL) - { - int x, y; - int startX; - - /* Create the "insensitive" pixmap. It's a copy of the "sensitive" - * pixmap with half the pixels set to the background color. */ - *insen = XCreatePixmap(gui.dpy, rootWindow, - attrs.width, attrs.height, - DefaultDepth(gui.dpy, screenNum)); - XCopyArea(gui.dpy, *sen, *insen, back_gc, 0, 0, - attrs.width, attrs.height, 0, 0); - for (y = 0; y < attrs.height; y++) - { - if (y % 2 == 0) - startX = 0; - else - startX = 1; - for (x = startX; x < attrs.width; x += 2) - XDrawPoint(gui.dpy, *insen, back_gc, x, y); - } - - } -#endif - XFreeGC(gui.dpy, back_gc); - XFreeGC(gui.dpy, mask_gc); - XFreePixmap(gui.dpy, map); - } - else - { - *sen = 0; - if (insen != NULL) - *insen = 0; - } - - XpmFreeAttributes(&attrs); -} -#endif - #if (defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL)) || defined(PROTO) /* * Set the balloon-eval used for the tooltip of a toolbar menu item. diff --git a/src/proto/gui_x11.pro b/src/proto/gui_x11.pro --- a/src/proto/gui_x11.pro +++ b/src/proto/gui_x11.pro @@ -66,6 +66,5 @@ void *gui_mch_register_sign __ARGS((char void gui_mch_destroy_sign __ARGS((void *sign)); void gui_mch_mousehide __ARGS((int hide)); void mch_set_mouse_shape __ARGS((int shape)); -void get_toolbar_pixmap __ARGS((vimmenu_T *menu, Pixmap *sen, Pixmap *insen)); void gui_mch_menu_set_tip __ARGS((vimmenu_T *menu)); /* vim: set ft=c : */ diff --git a/src/testdir/test54.in b/src/testdir/test54.in --- a/src/testdir/test54.in +++ b/src/testdir/test54.in @@ -4,7 +4,7 @@ STARTTEST :so small.vim :e xx :!rm -f test.out -:au BufLeave :!echo "buffer-local autommand in %" >> test.out +:au BufLeave :!echo buffer-local autommand in %>> test.out :e somefile " here, autocommand for xx shall write test.out : " but autocommand shall not apply to buffer named :bwipe xx " here, autocommand shall be auto-deleted