0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

updated for version 7.0035

This commit is contained in:
Bram Moolenaar 2005-01-08 21:49:45 +00:00
parent 9588a0f72b
commit 6cc1619799
6 changed files with 266 additions and 70 deletions

View File

@ -30,8 +30,6 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs* *known-bugs*
-------------------- Known bugs and current work ----------------------- -------------------- Known bugs and current work -----------------------
Add mouse patch from Marcin Dalecki.
Use 'ignorecase' for ":vimgrep"? Use 'ignorecase' for ":vimgrep"?
When allocating a new variable, a search is done for an empty entry. May When allocating a new variable, a search is done for an empty entry. May
@ -72,6 +70,7 @@ PLANNED FOR VERSION 7.0:
- new DATA TYPES: - new DATA TYPES:
- None? (or use empty string?) - None? (or use empty string?)
- dictionary - dictionary
range(start, end, stride) creates a listable dict.
Add type checking? See ~/vim/ideas.txt. Add type checking? See ~/vim/ideas.txt.
- Add SPELLCHECKER, with easy to add support for many languages. - Add SPELLCHECKER, with easy to add support for many languages.
8 Add spell checking. Use "ispell -a" somehow. 8 Add spell checking. Use "ispell -a" somehow.
@ -278,7 +277,7 @@ Awaiting updated patches:
8 "fg" and "bg" don't work in an xterm. Get default colors from xterm 8 "fg" and "bg" don't work in an xterm. Get default colors from xterm
with an ESC sequence. Ideas in: ~/vim/patches/vikas.xtermcolors . with an ESC sequence. Ideas in: ~/vim/patches/vikas.xtermcolors .
7 Add "DefaultFG" and "DefaultBG" for the colors of the menu. (Marcin 7 Add "DefaultFG" and "DefaultBG" for the colors of the menu. (Marcin
Dalecki has a patch for Motif) Dalecki has a patch for Motif and Carbon)
- Add possibility to highlight specific columns (for Fortran). Or put a - Add possibility to highlight specific columns (for Fortran). Or put a
line in between columns (e.g. for 'textwidth'). line in between columns (e.g. for 'textwidth').
Patch to add 'hlcolumn' from Vit Stradal, 2004 May 20. Patch to add 'hlcolumn' from Vit Stradal, 2004 May 20.
@ -569,10 +568,8 @@ Athena GUI:
Motif GUI: Motif GUI:
8 Popup menu ordering is wrong.
7 Use XmStringCreateLocalized() instead of XmStringCreateSimple()? 7 Use XmStringCreateLocalized() instead of XmStringCreateSimple()?
David Harrison says it's OK (it exists in Motif 1.2). David Harrison says it's OK (it exists in Motif 1.2).
8 The texts in the find/replace dialog don't use the right font.
8 Lesstif: When deleting a menu that's torn off, the torn off menu becomes 8 Lesstif: When deleting a menu that's torn off, the torn off menu becomes
very small instead of disappearing. When closing it, Vim crashes. very small instead of disappearing. When closing it, Vim crashes.
(Phillipps) (Phillipps)
@ -1069,8 +1066,6 @@ I can't reproduce these (if you can, let me know how!):
9 NT 4.0 on NTFS file system: Editing ".bashrc" (drag and drop), file 9 NT 4.0 on NTFS file system: Editing ".bashrc" (drag and drop), file
disappears. Editing ".xyz" is OK. Also, drag&drop only works for three disappears. Editing ".xyz" is OK. Also, drag&drop only works for three
files. (McCollister) files. (McCollister)
8 Motif: Tear-off menu item crashes Vim on some machines. (Netherton) It
works fine for me, maybe it's a Motif problem.
Problems that will (probably) not be solved: Problems that will (probably) not be solved:
@ -1334,7 +1329,7 @@ Multi-byte characters:
For Windows, the charset_pairs[] table could be used. But how do we know For Windows, the charset_pairs[] table could be used. But how do we know
if a font exists? if a font exists?
- Do keyboard conversion from 'termencoding' to 'encoding' with - Do keyboard conversion from 'termencoding' to 'encoding' with
convert_input() for Mac GUI, RiscOS GUI, BeOS GUI. convert_input() for Mac GUI and RiscOS GUI.
- Add mnemonics from RFC1345 longer than two characters. - Add mnemonics from RFC1345 longer than two characters.
Support CTRL-K _{mnemonic}_ Support CTRL-K _{mnemonic}_
7 In "-- INSERT (lang) --" show the name of the keymap used instead of 7 In "-- INSERT (lang) --" show the name of the keymap used instead of
@ -2021,11 +2016,6 @@ GUI:
things. things.
7 Motif: For a confirm() dialog <Enter> should be ignored when no default 7 Motif: For a confirm() dialog <Enter> should be ignored when no default
button selected, <Esc> should close the dialog. button selected, <Esc> should close the dialog.
- Motif steals <F10> from us, to pop up menus with the keyboard. How do we
get it back if we want it? It's already solved for GTK.
- Paste in Insert mode should not do autowrap etc. Or maybe this should be
changeable with an option?
- Put a nice picture in the icon (but how do we do that?).
7 When using a pseudo-tty Vim should behave like some terminal (vt52 looks 7 When using a pseudo-tty Vim should behave like some terminal (vt52 looks
simple enough). Terminal codes to/from shell should be translated. simple enough). Terminal codes to/from shell should be translated.
- Would it be useful to be able to quit the GUI and go back to the terminal - Would it be useful to be able to quit the GUI and go back to the terminal

View File

@ -324,6 +324,7 @@ static long list_len __ARGS((listvar *l));
static int list_equal __ARGS((listvar *l1, listvar *l2, int ic)); static int list_equal __ARGS((listvar *l1, listvar *l2, int ic));
static int tv_equal __ARGS((typeval *tv1, typeval *tv2, int ic)); static int tv_equal __ARGS((typeval *tv1, typeval *tv2, int ic));
static listitem *list_find __ARGS((listvar *l, long n)); static listitem *list_find __ARGS((listvar *l, long n));
static long list_idx_of_item __ARGS((listvar *l, listitem *item));
static listitem *list_find_ext __ARGS((listvar *l, long *ip)); static listitem *list_find_ext __ARGS((listvar *l, long *ip));
static void list_append __ARGS((listvar *l, listitem *item)); static void list_append __ARGS((listvar *l, listitem *item));
static int list_append_tv __ARGS((listvar *l, typeval *tv)); static int list_append_tv __ARGS((listvar *l, typeval *tv));
@ -440,6 +441,8 @@ static void f_mapcheck __ARGS((typeval *argvars, typeval *rettv));
static void f_match __ARGS((typeval *argvars, typeval *rettv)); static void f_match __ARGS((typeval *argvars, typeval *rettv));
static void f_matchend __ARGS((typeval *argvars, typeval *rettv)); static void f_matchend __ARGS((typeval *argvars, typeval *rettv));
static void f_matchstr __ARGS((typeval *argvars, typeval *rettv)); static void f_matchstr __ARGS((typeval *argvars, typeval *rettv));
static void f_max __ARGS((typeval *argvars, typeval *rettv));
static void f_min __ARGS((typeval *argvars, typeval *rettv));
static void f_mode __ARGS((typeval *argvars, typeval *rettv)); static void f_mode __ARGS((typeval *argvars, typeval *rettv));
static void f_nextnonblank __ARGS((typeval *argvars, typeval *rettv)); static void f_nextnonblank __ARGS((typeval *argvars, typeval *rettv));
static void f_nr2char __ARGS((typeval *argvars, typeval *rettv)); static void f_nr2char __ARGS((typeval *argvars, typeval *rettv));
@ -1540,8 +1543,8 @@ ex_let_one(arg, tv, copy, endchars)
} }
/* /*
* Set a variable with an index: "name[expr]", "name[expr][expr]", etc. * Set a variable with an index: "name[expr]", "name[expr:expr]",
* Only works if "name" is an existing List. * "name[expr][expr]", etc. Only works if "name" is an existing List.
* "ip" points to the first '['. * "ip" points to the first '['.
* Returns a pointer to just after the last used ']'; NULL for error. * Returns a pointer to just after the last used ']'; NULL for error.
*/ */
@ -1557,9 +1560,15 @@ set_var_idx(name, ip, rettv, copy, endchars)
int c1; int c1;
char_u *p; char_u *p;
typeval var1; typeval var1;
typeval var2;
int range = FALSE;
typeval *tv; typeval *tv;
long n; long n1 = 0, n2 = 0;
listitem *item; int empty1, empty2 = FALSE;
listitem *item = NULL;
listitem *ni;
listitem *ri;
listvar *l = NULL;
c1 = *ip; c1 = *ip;
*ip = NUL; *ip = NUL;
@ -1579,28 +1588,122 @@ set_var_idx(name, ip, rettv, copy, endchars)
p = NULL; p = NULL;
break; break;
} }
p = skipwhite(p + 1); if (range)
if (eval1(&p, &var1, TRUE) == FAIL) /* recursive! */
{ {
EMSG(_("E708: [:] must come last"));
p = NULL; p = NULL;
break; break;
} }
/* Get the index [expr] or the first index [expr: ]. */
p = skipwhite(p + 1);
if (*p == ':')
empty1 = TRUE;
else
{
empty1 = FALSE;
if (eval1(&p, &var1, TRUE) == FAIL) /* recursive! */
{
p = NULL;
break;
}
}
/* Optionally get the second index [ :expr]. */
if (*p == ':')
{
if (rettv->v_type != VAR_LIST || rettv->vval.v_list == NULL)
{
EMSG(_("E709: [:] requires a List value"));
p = NULL;
if (!empty1)
clear_tv(&var1);
break;
}
p = skipwhite(p + 1);
if (*p == ']')
empty2 = TRUE;
else
{
empty2 = FALSE;
if (eval1(&p, &var2, TRUE) == FAIL) /* recursive! */
{
p = NULL;
if (!empty1)
clear_tv(&var1);
break;
}
}
range = TRUE;
}
else
range = FALSE;
if (*p != ']') if (*p != ']')
{ {
EMSG(_(e_missbrac)); EMSG(_(e_missbrac));
clear_tv(&var1); if (!empty1)
clear_tv(&var1);
if (range && !empty2)
clear_tv(&var2);
p = NULL; p = NULL;
break; break;
} }
n = get_tv_number(&var1);
clear_tv(&var1); /*
item = list_find(tv->vval.v_list, n); * Get the number and item for the only or first index.
*/
if (empty1)
n1 = 0;
else
{
n1 = get_tv_number(&var1);
clear_tv(&var1);
}
l = tv->vval.v_list;
item = list_find(l, n1);
if (item == NULL) if (item == NULL)
{ {
EMSGN(_(e_listidx), n); EMSGN(_(e_listidx), n1);
p = NULL; p = NULL;
if (range && !empty2)
clear_tv(&var2);
break; break;
} }
/*
* May need to find the item or absolute index for the second index of
* a range.
* When no index given: "empty2" is TRUE.
* Otherwise "n2" is set to the second index.
*/
if (range && !empty2)
{
n2 = get_tv_number(&var2);
clear_tv(&var2);
if (n2 < 0)
{
ni = list_find(l, n2);
if (ni == NULL)
{
EMSGN(_(e_listidx), n2);
p = NULL;
break;
}
n2 = list_idx_of_item(l, ni);
}
/* Check that n2 isn't before n1. */
if (n1 < 0)
n1 = list_idx_of_item(l, item);
if (n2 < n1)
{
EMSGN(_(e_listidx), n2);
p = NULL;
break;
}
}
tv = &item->li_tv; tv = &item->li_tv;
} }
@ -1611,11 +1714,47 @@ set_var_idx(name, ip, rettv, copy, endchars)
EMSG(_(e_letunexp)); EMSG(_(e_letunexp));
p = NULL; p = NULL;
} }
else if (range)
{
/*
* Assign the List values to the list items.
*/
for (ri = rettv->vval.v_list->lv_first; ri != NULL; )
{
clear_tv(&item->li_tv);
copy_tv(&ri->li_tv, &item->li_tv);
ri = ri->li_next;
if (ri == NULL || (!empty2 && n2 == n1))
break;
if (item->li_next == NULL)
{
/* Need to add an empty item. */
ni = listitem_alloc();
if (ni == NULL)
{
ri = NULL;
break;
}
ni->li_tv.v_type = VAR_NUMBER;
ni->li_tv.vval.v_number = 0;
list_append(l, ni);
}
item = item->li_next;
++n1;
}
if (ri != NULL)
EMSG(_("E710: List value has more items than target"));
else if (empty2 ? item != NULL && item->li_next != NULL : n1 != n2)
EMSG(_("E711: List value has not enough items"));
}
else else
{ {
/*
* Assign the value to the variable or list item.
*/
clear_tv(tv); clear_tv(tv);
if (copy) if (copy)
copy_tv(tv, rettv); copy_tv(rettv, tv);
else else
{ {
*tv = *rettv; *tv = *rettv;
@ -3784,6 +3923,28 @@ list_find(l, n)
return item; return item;
} }
/*
* Locate "item" list "l" and return its index.
* Returns -1 when "item" is not in the list.
*/
static long
list_idx_of_item(l, item)
listvar *l;
listitem *item;
{
long idx = 0;
listitem *li;
if (l == NULL)
return -1;
idx = 0;
for (li = l->lv_first; li != NULL && li != item; li = li->li_next)
++idx;
if (li == NULL)
return -1;
return idx;;
}
/* /*
* Like list_find(), but also find an item just past the end. * Like list_find(), but also find an item just past the end.
* "*ip" is the item to find. * "*ip" is the item to find.
@ -4253,6 +4414,8 @@ static struct fst
{"match", 2, 4, f_match}, {"match", 2, 4, f_match},
{"matchend", 2, 4, f_matchend}, {"matchend", 2, 4, f_matchend},
{"matchstr", 2, 4, f_matchstr}, {"matchstr", 2, 4, f_matchstr},
{"max", 1, 1, f_max},
{"min", 1, 1, f_min},
{"mode", 0, 0, f_mode}, {"mode", 0, 0, f_mode},
{"nextnonblank", 1, 1, f_nextnonblank}, {"nextnonblank", 1, 1, f_nextnonblank},
{"nr2char", 1, 1, f_nr2char}, {"nr2char", 1, 1, f_nr2char},
@ -8085,6 +8248,67 @@ f_matchstr(argvars, rettv)
find_some_match(argvars, rettv, 2); find_some_match(argvars, rettv, 2);
} }
static void max_min __ARGS((typeval *argvars, typeval *rettv, int domax));
static void
max_min(argvars, rettv, domax)
typeval *argvars;
typeval *rettv;
int domax;
{
listvar *l;
listitem *li;
long n = 0;
long i;
if (argvars[0].v_type == VAR_LIST)
{
l = argvars[0].vval.v_list;
if (l != NULL)
{
li = l->lv_first;
if (li != NULL)
{
n = get_tv_number(&li->li_tv);
while (1)
{
li = li->li_next;
if (li == NULL)
break;
i = get_tv_number(&li->li_tv);
if (domax ? i > n : i < n)
n = i;
}
}
}
}
else
EMSG(_(e_listreq));
rettv->vval.v_number = n;
}
/*
* "max()" function
*/
static void
f_max(argvars, rettv)
typeval *argvars;
typeval *rettv;
{
max_min(argvars, rettv, TRUE);
}
/*
* "min()" function
*/
static void
f_min(argvars, rettv)
typeval *argvars;
typeval *rettv;
{
max_min(argvars, rettv, FALSE);
}
/* /*
* "mode()" function * "mode()" function
*/ */
@ -10247,10 +10471,17 @@ f_type(argvars, rettv)
typeval *argvars; typeval *argvars;
typeval *rettv; typeval *rettv;
{ {
if (argvars[0].v_type == VAR_NUMBER) int n;
rettv->vval.v_number = 0;
else switch (argvars[0].v_type)
rettv->vval.v_number = 1; {
case VAR_NUMBER: n = 0; break;
case VAR_STRING: n = 1; break;
case VAR_FUNC: n = 2; break;
case VAR_LIST: n = 3; break;
default: EMSG2(_(e_intern2), "f_type()"); n = 0; break;
}
rettv->vval.v_number = n;
} }
/* /*

View File

@ -6249,25 +6249,12 @@ gui_mch_get_rgb(guicolor_T pixel)
} }
/* /*
* Get current y mouse coordinate in text window. * Get current mouse coordinates in text window.
* Return -1 when unknown.
*/ */
int void
gui_mch_get_mouse_x(void) gui_mch_getmouse(int *x, int *y)
{ {
int win_x; gdk_window_get_pointer(gui.drawarea->window, x, y, NULL);
gdk_window_get_pointer(gui.drawarea->window, &win_x, NULL, NULL);
return win_x;
}
int
gui_mch_get_mouse_y(void)
{
int win_y;
gdk_window_get_pointer(gui.drawarea->window, NULL, &win_y, NULL);
return win_y;
} }
void void

View File

@ -3276,33 +3276,23 @@ gui_x11_callbacks(textArea, vimForm)
} }
/* /*
* Get current y mouse coordinate in text window. * Get current mouse coordinates in text window.
* Return -1 when unknown.
*/ */
int void
gui_mch_get_mouse_x() gui_mch_getmouse(int *x, int *y)
{ {
int rootx, rooty, winx, winy; int rootx, rooty, winx, winy;
Window root, child; Window root, child;
unsigned int mask; unsigned int mask;
if (gui.wid && XQueryPointer(gui.dpy, gui.wid, &root, &child, if (gui.wid && XQueryPointer(gui.dpy, gui.wid, &root, &child,
&rootx, &rooty, &winx, &winy, &mask)) &rootx, &rooty, &winx, &winy, &mask)) {
return winx; *x = winx;
return -1; *y = winy;
} } else {
*x = -1;
int *y = -1;
gui_mch_get_mouse_y() }
{
int rootx, rooty, winx, winy;
Window root, child;
unsigned int mask;
if (gui.wid && XQueryPointer(gui.dpy, gui.wid, &root, &child,
&rootx, &rooty, &winx, &winy, &mask))
return winy;
return -1;
} }
void void

View File

@ -53,8 +53,7 @@ void gui_mch_start_blink __ARGS((void));
void process_event __ARGS((int event, int *block)); void process_event __ARGS((int event, int *block));
void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu)); void gui_mch_show_popupmenu __ARGS((vimmenu_T *menu));
long_u gui_mch_get_rgb __ARGS((guicolor_T pixel)); long_u gui_mch_get_rgb __ARGS((guicolor_T pixel));
int gui_mch_get_mouse_x __ARGS((void)); void gui_mch_getmouse __ARGS((int *x, int *y));
int gui_mch_get_mouse_y __ARGS((void));
void gui_mch_setmouse __ARGS((int x, int y)); void gui_mch_setmouse __ARGS((int x, int y));
void gui_mch_drawsign __ARGS((int row, int col, int typenr)); void gui_mch_drawsign __ARGS((int row, int col, int typenr));
void gui_mch_destroy_sign __ARGS((XImage *sign)); void gui_mch_destroy_sign __ARGS((XImage *sign));

View File

@ -57,8 +57,7 @@ void gui_mch_stop_blink __ARGS((void));
void gui_mch_start_blink __ARGS((void)); void gui_mch_start_blink __ARGS((void));
long_u gui_mch_get_rgb __ARGS((guicolor_T pixel)); long_u gui_mch_get_rgb __ARGS((guicolor_T pixel));
void gui_x11_callbacks __ARGS((Widget textArea, Widget vimForm)); void gui_x11_callbacks __ARGS((Widget textArea, Widget vimForm));
int gui_mch_get_mouse_x __ARGS((void)); void gui_mch_getmouse __ARGS((int *x, int *y));
int gui_mch_get_mouse_y __ARGS((void));
void gui_mch_setmouse __ARGS((int x, int y)); void gui_mch_setmouse __ARGS((int x, int y));
XButtonPressedEvent *gui_x11_get_last_mouse_event __ARGS((void)); XButtonPressedEvent *gui_x11_get_last_mouse_event __ARGS((void));
void gui_mch_drawsign __ARGS((int row, int col, int typenr)); void gui_mch_drawsign __ARGS((int row, int col, int typenr));