summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-04-27 00:02:13 +0000
committerBram Moolenaar <Bram@vim.org>2006-04-27 00:02:13 +0000
commitf193fffd16563cfbe7c02a21e19c8bb11707581d (patch)
tree4bae3092421aa986103b8000b1012989a9ea49e6 /src
parent551dbcc9b604c2992f908fb475e797fcc116315b (diff)
updated for version 7.0f02v7.0f02
Diffstat (limited to 'src')
-rw-r--r--src/Make_mvc.mak2
-rw-r--r--src/buffer.c11
-rw-r--r--src/edit.c24
-rw-r--r--src/eval.c13
-rw-r--r--src/ex_docmd.c4
-rw-r--r--src/feature.h5
-rw-r--r--src/fileio.c25
-rw-r--r--src/getchar.c23
-rw-r--r--src/gui.c13
-rw-r--r--src/gui.h8
-rw-r--r--src/gui_gtk_x11.c10
-rw-r--r--src/gui_motif.c47
-rw-r--r--src/gui_w48.c8
-rw-r--r--src/normal.c4
-rw-r--r--src/ops.c36
-rw-r--r--src/os_mswin.c26
-rw-r--r--src/proto/buffer.pro134
-rw-r--r--src/proto/charset.pro108
-rw-r--r--src/proto/getchar.pro123
-rw-r--r--src/proto/normal.pro48
-rw-r--r--src/proto/ops.pro117
-rw-r--r--src/spell.c14
-rw-r--r--src/syntax.c8
-rw-r--r--src/version.h6
-rw-r--r--src/vim.h3
25 files changed, 506 insertions, 314 deletions
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak
index afc05d5275..0812f4d3f0 100644
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -1046,7 +1046,7 @@ proto.h: \
proto/window.pro \
$(NETBEANS_PRO)
-.SUFFIXES: .cod
+.SUFFIXES: .cod .i
# Generate foo.cod (mixed source and assembly listing) from foo.c via "nmake
# foo.cod"
diff --git a/src/buffer.c b/src/buffer.c
index 7d625f2e59..6a7fa2f544 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2635,8 +2635,11 @@ buf_set_name(fnum, name)
{
vim_free(buf->b_sfname);
vim_free(buf->b_ffname);
- buf->b_sfname = vim_strsave(name);
- buf->b_ffname = FullName_save(buf->b_sfname, FALSE);
+ buf->b_ffname = vim_strsave(name);
+ buf->b_sfname = NULL;
+ /* Allocate ffname and expand into full path. Also resolves .lnk
+ * files on Win32. */
+ fname_expand(buf, &buf->b_ffname, &buf->b_sfname);
buf->b_fname = buf->b_sfname;
}
}
@@ -4187,11 +4190,11 @@ fname_expand(buf, ffname, sfname)
#ifdef FEAT_SHORTCUT
if (!buf->b_p_bin)
{
- char_u *rfname = NULL;
+ char_u *rfname;
/* If the file name is a shortcut file, use the file it links to. */
rfname = mch_resolve_shortcut(*ffname);
- if (rfname)
+ if (rfname != NULL)
{
vim_free(*ffname);
*ffname = rfname;
diff --git a/src/edit.c b/src/edit.c
index 25fffad587..30d4c3bfa9 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -335,6 +335,12 @@ edit(cmdchar, startln, count)
}
#ifdef FEAT_INS_EXPAND
+ /* Don't allow recursive insert mode when busy with completion. */
+ if (compl_started || pum_visible())
+ {
+ EMSG(_(e_secure));
+ return FALSE;
+ }
ins_compl_clear(); /* clear stuff for CTRL-X mode */
#endif
@@ -5147,7 +5153,7 @@ insertchar(c, flags, second_indent)
* when 'formatexpr' isn't set or it returns non-zero. */
#if defined(FEAT_EVAL)
if (*curbuf->b_p_fex == NUL
- || fex_format(curwin->w_cursor.lnum, 1L) != 0)
+ || fex_format(curwin->w_cursor.lnum, 1L, c) != 0)
#endif
internal_format(textwidth, second_indent, flags, c == NUL);
}
@@ -7243,6 +7249,9 @@ ins_reg()
int need_redraw = FALSE;
int regname;
int literally = 0;
+#ifdef FEAT_VISUAL
+ int vis_active = VIsual_active;
+#endif
/*
* If we are going to wait for a character, show a '"'.
@@ -7344,6 +7353,12 @@ ins_reg()
/* If the inserted register is empty, we need to remove the '"' */
if (need_redraw || stuff_empty())
edit_unputchar();
+
+#ifdef FEAT_VISUAL
+ /* Disallow starting Visual mode here, would get a weird mode. */
+ if (!vis_active && VIsual_active)
+ end_visual_mode();
+#endif
}
/*
@@ -8954,6 +8969,13 @@ ins_eol(c)
* in open_line().
*/
+#ifdef FEAT_VIRTUALEDIT
+ /* Put cursor on NUL if on the last char and coladd is 1 (happens after
+ * CTRL-O). */
+ if (virtual_active() && curwin->w_cursor.coladd > 0)
+ coladvance(getviscol());
+#endif
+
#ifdef FEAT_RIGHTLEFT
# ifdef FEAT_FKMAP
if (p_altkeymap && p_fkmap)
diff --git a/src/eval.c b/src/eval.c
index 56e534e6dc..2d85e6c2ae 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -341,6 +341,7 @@ static struct vimvar
{VV_NAME("swapname", VAR_STRING), VV_RO},
{VV_NAME("swapchoice", VAR_STRING), 0},
{VV_NAME("swapcommand", VAR_STRING), VV_RO},
+ {VV_NAME("char", VAR_STRING), VV_RO},
};
/* shorthand */
@@ -9000,6 +9001,7 @@ f_feedkeys(argvars, rettv)
char_u *keys, *flags;
char_u nbuf[NUMBUFLEN];
int typed = FALSE;
+ char_u *keys_esc;
rettv->vval.v_number = 0;
keys = get_tv_string(&argvars[0]);
@@ -9019,9 +9021,16 @@ f_feedkeys(argvars, rettv)
}
}
- ins_typebuf(keys, (remap ? REMAP_YES : REMAP_NONE),
+ /* Need to escape K_SPECIAL and CSI before putting the string in the
+ * typeahead buffer. */
+ keys_esc = vim_strsave_escape_csi(keys);
+ if (keys_esc != NULL)
+ {
+ ins_typebuf(keys_esc, (remap ? REMAP_YES : REMAP_NONE),
typebuf.tb_len, !typed, FALSE);
- typebuf_was_filled = TRUE;
+ vim_free(keys_esc);
+ typebuf_was_filled = TRUE;
+ }
}
}
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 3e4c963c41..2fc5d0a94a 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -1824,8 +1824,8 @@ do_one_cmd(cmdlinep, sourcing,
#ifdef FEAT_AUTOCMD
if (cmdmod.save_ei == NULL)
{
- /* Set 'eventignore' to "all". Don't free the
- * existing option value, we restore it later. */
+ /* Set 'eventignore' to "all". Restore the
+ * existing option value later. */
cmdmod.save_ei = vim_strsave(p_ei);
set_string_option_direct((char_u *)"ei", -1,
(char_u *)"all", OPT_FREE, SID_NONE);
diff --git a/src/feature.h b/src/feature.h
index 82508fdca3..2d49b5c41a 100644
--- a/src/feature.h
+++ b/src/feature.h
@@ -753,7 +753,8 @@
/*
* GUI tabline
*/
-#if defined(FEAT_WINDOWS) && (defined(FEAT_GUI_GTK) \
+#if defined(FEAT_WINDOWS) && defined(FEAT_NORMAL) \
+ && (defined(FEAT_GUI_GTK) \
|| (defined(FEAT_GUI_MOTIF) && defined(HAVE_XM_NOTEBOOK_H)) \
|| (defined(FEAT_GUI_MSWIN) && (!defined(_MSC_VER) || _MSC_VER > 1020)))
# define FEAT_GUI_TABLINE
@@ -1202,7 +1203,7 @@
*/
#if (defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA) \
|| defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32)) \
- && ( (defined(FEAT_TOOLBAR) \
+ && ( ((defined(FEAT_TOOLBAR) || defined(FEAT_GUI_TABLINE)) \
&& !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_W32)) \
|| defined(FEAT_SUN_WORKSHOP) \
|| defined(FEAT_NETBEANS_INTG) || defined(FEAT_EVAL))
diff --git a/src/fileio.c b/src/fileio.c
index 27d8ed7e70..01953f381a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -829,7 +829,8 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
/* When the file is utf-8 but a character doesn't fit in
* 'encoding' don't retry. In help text editing utf-8 bytes
* doesn't make sense. */
- keep_dest_enc = TRUE;
+ if (!enc_utf8)
+ keep_dest_enc = TRUE;
}
fenc_alloced = FALSE;
}
@@ -7485,12 +7486,13 @@ event_ignored(event)
{
char_u *p = p_ei;
- if (STRICMP(p_ei, "all") == 0)
- return TRUE;
-
- while (*p)
+ while (*p != NUL)
+ {
+ if (STRNICMP(p, "all", 3) == 0 && (p[3] == NUL || p[3] == ','))
+ return TRUE;
if (event_name2nr(p, &p) == event)
return TRUE;
+ }
return FALSE;
}
@@ -7503,12 +7505,17 @@ check_ei()
{
char_u *p = p_ei;
- if (STRICMP(p_ei, "all") == 0)
- return OK;
-
while (*p)
- if (event_name2nr(p, &p) == NUM_EVENTS)
+ {
+ if (STRNICMP(p, "all", 3) == 0 && (p[3] == NUL || p[3] == ','))
+ {
+ p += 3;
+ if (*p == ',')
+ ++p;
+ }
+ else if (event_name2nr(p, &p) == NUM_EVENTS)
return FAIL;
+ }
return OK;
}
diff --git a/src/getchar.c b/src/getchar.c
index e6ba2485df..629ad770be 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -4301,11 +4301,29 @@ eval_map_expr(str)
{
char_u *res;
char_u *p;
- char_u *s, *d;
p = eval_to_string(str, NULL, FALSE);
if (p == NULL)
return NULL;
+ res = vim_strsave_escape_csi(p);
+ vim_free(p);
+
+ return res;
+}
+#endif
+
+#if defined(FEAT_EVAL) || defined(PROTO)
+/*
+ * Copy "p" to allocated memory, escaping K_SPECIAL and CSI so that the result
+ * can be put in the typeahead buffer.
+ * Returns NULL when out of memory.
+ */
+ char_u *
+vim_strsave_escape_csi(p)
+ char_u *p;
+{
+ char_u *res;
+ char_u *s, *d;
/* Need a buffer to hold up to three times as much. */
res = alloc((unsigned)(STRLEN(p) * 3) + 1);
@@ -4331,9 +4349,6 @@ eval_map_expr(str)
}
*d = NUL;
}
-
- vim_free(p);
-
return res;
}
#endif
diff --git a/src/gui.c b/src/gui.c
index 4006891783..9a69a09f39 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -3507,14 +3507,19 @@ send_tabline_event(nr)
if (nr == tabpage_index(curtab))
return FALSE;
+
+ /* Don't put events in the input queue now. */
+ if (hold_gui_events
# ifdef FEAT_CMDWIN
- if (cmdwin_type != 0)
+ || cmdwin_type != 0
+# endif
+ )
{
/* Set it back to the current tab page. */
gui_mch_set_curtab(tabpage_index(curtab));
return FALSE;
}
-# endif
+
string[0] = CSI;
string[1] = KS_TABLINE;
string[2] = KE_FILLER;
@@ -3534,6 +3539,10 @@ send_tabline_menu_event(tabidx, event)
{
char_u string[3];
+ /* Don't put events in the input queue now. */
+ if (hold_gui_events)
+ return;
+
string[0] = CSI;
string[1] = KS_TABMENU;
string[2] = KE_FILLER;
diff --git a/src/gui.h b/src/gui.h
index e654a21b60..87fd4c1525 100644
--- a/src/gui.h
+++ b/src/gui.h
@@ -21,6 +21,14 @@
#endif
#ifdef FEAT_GUI_GTK
+# ifdef VMS /* undef MIN and MAX because Intrinsic.h redefines them anyway */
+# ifdef MAX
+# undef MAX
+# endif
+# ifdef MIN
+# undef MIN
+# endif
+# endif
# include <X11/Intrinsic.h>
# include <gtk/gtk.h>
#endif
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 88559e5341..1037ac2139 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -3183,6 +3183,15 @@ on_tabline_menu(GtkWidget *widget, GdkEvent *event)
GtkWidget *page;
GtkWidget *label;
+ /* When ignoring events return TRUE so that the selected page doesn't
+ * change. */
+ if (hold_gui_events
+# ifdef FEAT_CMDWIN
+ || cmdwin_type != 0
+# endif
+ )
+ return TRUE;
+
/* Find out where the click was. */
for (clicked_page = 1; ; ++clicked_page)
{
@@ -3217,6 +3226,7 @@ on_tabline_menu(GtkWidget *widget, GdkEvent *event)
gtk_main_quit();
}
}
+
/* We didn't handle the event. */
return FALSE;
}
diff --git a/src/gui_motif.c b/src/gui_motif.c
index 69399b0dad..f7b32d5941 100644
--- a/src/gui_motif.c
+++ b/src/gui_motif.c
@@ -88,6 +88,7 @@ static void scroll_cb __ARGS((Widget w, XtPointer client_data, XtPointer call_da
static void tabline_cb __ARGS((Widget w, XtPointer client_data, XtPointer call_data));
static void tabline_button_cb __ARGS((Widget w, XtPointer client_data, XtPointer call_data));
static void tabline_menu_cb __ARGS((Widget w, XtPointer closure, XEvent *e, Boolean *continue_dispatch));
+static void tabline_balloon_cb __ARGS((BalloonEval *beval, int state));
#endif
#ifdef FEAT_TOOLBAR
# ifdef FEAT_FOOTER
@@ -252,6 +253,14 @@ tabline_menu_cb(w, closure, e, continue_dispatch)
if (event->button != Button3)
return;
+ /* When ignoring events don't show the menu. */
+ if (hold_gui_events
+# ifdef FEAT_CMDWIN
+ || cmdwin_type != 0
+# endif
+ )
+ return;
+
if (event->subwindow != None)
{
tab_w = XtWindowToWidget(XtDisplay(w), event->subwindow);
@@ -267,6 +276,28 @@ tabline_menu_cb(w, closure, e, continue_dispatch)
XmMenuPosition(tabLine_menu, (XButtonPressedEvent *)e) ;
XtManageChild(tabLine_menu);
}
+
+/*ARGSUSED*/
+ static void
+tabline_balloon_cb(beval, state)
+ BalloonEval *beval;
+ int state;
+{
+ int nr;
+ tabpage_T *tp;
+
+ if (beval->target == (Widget)0)
+ return;
+
+ XtVaGetValues(beval->target, XmNpageNumber, &nr, NULL);
+ tp = find_tabpage(nr);
+ if (tp == NULL)
+ return;
+
+ get_tabline_label(tp, TRUE);
+ gui_mch_post_balloon(beval, NameBuff);
+}
+
#endif
/*
@@ -1365,9 +1396,9 @@ gui_mch_add_menu_item(menu, idx)
if (xms != NULL)
XmStringFree(xms);
-#ifdef FEAT_BEVAL
+# ifdef FEAT_BEVAL
gui_mch_menu_set_tip(menu);
-#endif
+# endif
menu->parent = parent;
menu->submenu_id = NULL;
@@ -3024,8 +3055,7 @@ gui_mch_show_toolbar(int showit)
int n = 0;
/* Enable/Disable tooltip (OK to enable while
- * currently enabled)
- */
+ * currently enabled). */
if (cur->tip != NULL)
(*action)(cur->tip);
if (!menu_is_separator(cur->name))
@@ -3326,6 +3356,7 @@ gui_mch_update_tabline(void)
int last_page, tab_count;
XmString label_str;
char *label_cstr;
+ BalloonEval *beval;
if (tabLine == (Widget)0)
return;
@@ -3338,7 +3369,7 @@ gui_mch_update_tabline(void)
page_status = XmNotebookGetPageInfo(tabLine, nr, &page_info);
if (page_status == XmPAGE_INVALID
- || page_info.major_tab_widget == (Widget)0)
+ || page_info.major_tab_widget == (Widget)0)
{
/* Add the tab */
n = 0;
@@ -3349,6 +3380,9 @@ gui_mch_update_tabline(void)
XtSetArg(args[n], XmNshadowThickness , 1); n++;
tab = XmCreatePushButton(tabLine, "-Empty-", args, n);
XtManageChild(tab);
+ beval = gui_mch_create_beval_area(tab, NULL, tabline_balloon_cb,
+ NULL);
+ XtVaSetValues(tab, XmNuserData, beval, NULL);
}
else
tab = page_info.major_tab_widget;
@@ -3387,6 +3421,9 @@ gui_mch_update_tabline(void)
&& page_info.page_number == nr
&& page_info.major_tab_widget != (Widget)0)
{
+ XtVaGetValues(page_info.major_tab_widget, XmNuserData, &beval, NULL);
+ if (beval != NULL)
+ gui_mch_destroy_beval_area(beval);
XtUnmanageChild(page_info.major_tab_widget);
XtDestroyWidget(page_info.major_tab_widget);
}
diff --git a/src/gui_w48.c b/src/gui_w48.c
index 44d03d067a..8fa049a9ac 100644
--- a/src/gui_w48.c
+++ b/src/gui_w48.c
@@ -2209,6 +2209,14 @@ show_tabline_popup_menu(void)
long rval;
POINT pt;
+ /* When ignoring events don't show the menu. */
+ if (hold_gui_events
+# ifdef FEAT_CMDWIN
+ || cmdwin_type != 0
+# endif
+ )
+ return;
+
tab_pmenu = CreatePopupMenu();
if (tab_pmenu == NULL)
return;
diff --git a/src/normal.c b/src/normal.c
index 6512574518..966bb3219d 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -3209,9 +3209,7 @@ end_visual_mode()
clear_showcmd();
#endif
- /* Don't leave the cursor past the end of the line */
- if (curwin->w_cursor.col > 0 && *ml_get_cursor() == NUL)
- --curwin->w_cursor.col;
+ adjust_cursor_eol();
}
/*
diff --git a/src/ops.c b/src/ops.c
index 00780acd72..732323e88a 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -3728,8 +3728,18 @@ end:
vim_free(y_array);
/* If the cursor is past the end of the line put it at the end. */
- if (gchar_cursor() == NUL
- && curwin->w_cursor.col > 0
+ adjust_cursor_eol();
+}
+
+/*
+ * When the cursor is on the NUL past the end of the line and it should not be
+ * there move it left.
+ */
+ void
+adjust_cursor_eol()
+{
+ if (curwin->w_cursor.col > 0
+ && gchar_cursor() == NUL
#ifdef FEAT_VIRTUALEDIT
&& (ve_flags & VE_ONEMORE) == 0
#endif
@@ -3737,6 +3747,7 @@ end:
{
/* Put the cursor on the last character in the line. */
dec_cursor();
+
#ifdef FEAT_VIRTUALEDIT
if (ve_flags == VE_ALL)
{
@@ -4326,24 +4337,38 @@ op_formatexpr(oap)
redraw_curbuf_later(INVERTED);
# endif
- (void)fex_format(oap->start.lnum, oap->line_count);
+ (void)fex_format(oap->start.lnum, oap->line_count, NUL);
}
int
-fex_format(lnum, count)
+fex_format(lnum, count, c)
linenr_T lnum;
long count;
+ int c; /* character to be inserted */
{
int use_sandbox = was_set_insecurely((char_u *)"formatexpr",
OPT_LOCAL);
int r;
+ char_u buf[NUMBUFLEN];
/*
* Set v:lnum to the first line number and v:count to the number of lines.
+ * Set v:char to the character to be inserted (can be NUL).
*/
set_vim_var_nr(VV_LNUM, lnum);
set_vim_var_nr(VV_COUNT, count);
+#ifdef FEAT_MBYTE
+ if (has_mbyte)
+ buf[(*mb_char2bytes)(c, buf)] = NUL;
+ else
+#endif
+ {
+ buf[0] = c;
+ buf[1] = NUL;
+ }
+ set_vim_var_string(VV_CHAR, buf, -1);
+
/*
* Evaluate the function.
*/
@@ -4352,6 +4377,9 @@ fex_format(lnum, count)
r = eval_to_number(curbuf->b_p_fex);
if (use_sandbox)
--sandbox;
+
+ set_vim_var_string(VV_CHAR, NULL, -1);
+
return r;
}
#endif
diff --git a/src/os_mswin.c b/src/os_mswin.c
index efbd01d736..26d8533aa9 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -2695,6 +2695,9 @@ serverInitMessaging(void)
s_hinst, NULL);
}
+/* Used by serverSendToVim() to find an alternate server name. */
+static char_u *altname_buf_ptr = NULL;
+
/*
* Get the title of the window "hwnd", which is the Vim server name, in
* "name[namelen]" and return the length.
@@ -2732,6 +2735,15 @@ enumWindowsGetServer(HWND hwnd, LPARAM lparam)
return FALSE;
}
+ /* If we are looking for an alternate server, remember this name. */
+ if (altname_buf_ptr != NULL
+ && STRNICMP(server, id->name, STRLEN(id->name)) == 0
+ && vim_isdigit(server[STRLEN(id->name)]))
+ {
+ STRCPY(altname_buf_ptr, server);
+ altname_buf_ptr = NULL; /* don't use another name */
+ }
+
/* Otherwise, keep looking */
return TRUE;
}
@@ -2871,10 +2883,22 @@ serverSendToVim(name, cmd, result, ptarget, asExpr, silent)
int asExpr; /* Expression or keys? */
int silent; /* don't complain about no server */
{
- HWND target = findServer(name);
+ HWND target;
COPYDATASTRUCT data;
char_u *retval = NULL;
int retcode = 0;
+ char_u altname_buf[MAX_PATH];
+
+ /* If the server name does not end in a digit then we look for an
+ * alternate name. e.g. when "name" is GVIM the we may find GVIM2. */
+ if (STRLEN(name) > 1 && !vim_isdigit(name[STRLEN(name) - 1]))
+ altname_buf_ptr = altname_buf;
+ altname_buf[0] = NUL;
+ target = findServer(name);
+ altname_buf_ptr = NULL;
+ if (target == 0 && altname_buf[0] != NUL)
+ /* Use another server name we found. */
+ target = findServer(altname_buf);
if (target == 0)
{
diff --git a/src/proto/buffer.pro b/src/proto/buffer.pro
index 9da8c3e6e1..91934432d4 100644
--- a/src/proto/buffer.pro
+++ b/src/proto/buffer.pro
@@ -1,69 +1,69 @@
/* buffer.c */
-extern int open_buffer __ARGS((int read_stdin, exarg_T *eap));
-extern int buf_valid __ARGS((buf_T *buf));
-extern void close_buffer __ARGS((win_T *win, buf_T *buf, int action));
-extern void buf_clear_file __ARGS((buf_T *buf));
-extern void buf_freeall __ARGS((buf_T *buf, int del_buf, int wipe_buf));
-extern void goto_buffer __ARGS((exarg_T *eap, int start, int dir, int count));
-extern void handle_swap_exists __ARGS((buf_T *old_curbuf));
-extern char_u *do_bufdel __ARGS((int command, char_u *arg, int addr_count, int start_bnr, int end_bnr, int forceit));
-extern int do_buffer __ARGS((int action, int start, int dir, int count, int forceit));
-extern void set_curbuf __ARGS((buf_T *buf, int action));
-extern void enter_buffer __ARGS((buf_T *buf));
-extern buf_T *buflist_new __ARGS((char_u *ffname, char_u *sfname, linenr_T lnum, int flags));
-extern void free_buf_options __ARGS((buf_T *buf, int free_p_ff));
-extern int buflist_getfile __ARGS((int n, linenr_T lnum, int options, int forceit));
-extern void buflist_getfpos __ARGS((void));
-extern buf_T *buflist_findname_exp __ARGS((char_u *fname));
-extern buf_T *buflist_findname __ARGS((char_u *ffname));
-extern int buflist_findpat __ARGS((char_u *pattern, char_u *pattern_end, int unlisted, int diffmode));
-extern int ExpandBufnames __ARGS((char_u *pat, int *num_file, char_u ***file, int options));
-extern buf_T *buflist_findnr __ARGS((int nr));
-extern char_u *buflist_nr2name __ARGS((int n, int fullname, int helptail));
-extern void get_winopts __ARGS((buf_T *buf));
-extern pos_T *buflist_findfpos __ARGS((buf_T *buf));
-extern linenr_T buflist_findlnum __ARGS((buf_T *buf));
-extern void buflist_list __ARGS((exarg_T *eap));
-extern int buflist_name_nr __ARGS((int fnum, char_u **fname, linenr_T *lnum));
-extern int setfname __ARGS((buf_T *buf, char_u *ffname, char_u *sfname, int message));
-extern void buf_set_name __ARGS((int fnum, char_u *name));
-extern void buf_name_changed __ARGS((buf_T *buf));
-extern buf_T *setaltfname __ARGS((char_u *ffname, char_u *sfname, linenr_T lnum));
-extern char_u *getaltfname __ARGS((int errmsg));
-extern int buflist_add __ARGS((char_u *fname, int flags));
-extern void buflist_slash_adjust __ARGS((void));
-extern void buflist_altfpos __ARGS((void));
-extern int otherfile __ARGS((char_u *ffname));
-extern void buf_setino __ARGS((buf_T *buf));
-extern void fileinfo __ARGS((int fullname, int shorthelp, int dont_truncate));
-extern void col_print __ARGS((char_u *buf, int col, int vcol));
-extern void maketitle __ARGS((void));
-extern void resettitle __ARGS((void));
-extern void free_titles __ARGS((void));
-extern int build_stl_str_hl __ARGS((win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use_sandbox, int fillchar, int maxwidth, struct stl_hlrec *hltab, struct stl_hlrec *tabtab));
-extern void get_rel_pos __ARGS((win_T *wp, char_u *str));
-extern int append_arg_number __ARGS((win_T *wp, char_u *buf, int add_file, int maxlen));
-extern char_u *fix_fname __ARGS((char_u *fname));
-extern void fname_expand __ARGS((buf_T *buf, char_u **ffname, char_u **sfname));
-extern char_u *alist_name __ARGS((aentry_T *aep));
-extern void do_arg_all __ARGS((int count, int forceit, int keep_tabs));
-extern void ex_buffer_all __ARGS((exarg_T *eap));
-extern void do_modelines __ARGS((int flags));
-extern int read_viminfo_bufferlist __ARGS((vir_T *virp, int writing));
-extern void write_viminfo_bufferlist __ARGS((FILE *fp));
-extern char *buf_spname __ARGS((buf_T *buf));
-extern void buf_addsign __ARGS((buf_T *buf, int id, linenr_T lnum, int typenr));
-extern int buf_change_sign_type __ARGS((buf_T *buf, int markId, int typenr));
-extern int_u buf_getsigntype __ARGS((buf_T *buf, linenr_T lnum, int type));
-extern linenr_T buf_delsign __ARGS((buf_T *buf, int id));
-extern int buf_findsign __ARGS((buf_T *buf, int id));
-extern int buf_findsign_id __ARGS((buf_T *buf, linenr_T lnum));
-extern int buf_findsigntype_id __ARGS((buf_T *buf, linenr_T lnum, int typenr));
-extern int buf_signcount __ARGS((buf_T *buf, linenr_T lnum));
-extern void buf_delete_all_signs __ARGS((void));
-extern void sign_list_placed __ARGS((buf_T *rbuf));
-extern void sign_mark_adjust __ARGS((linenr_T line1, linenr_T line2, long amount, long amount_after));
-extern void set_buflisted __ARGS((int on));
-extern int buf_contents_changed __ARGS((buf_T *buf));
-extern void wipe_buffer __ARGS((buf_T *buf, int aucmd));
+int open_buffer __ARGS((int read_stdin, exarg_T *eap));
+int buf_valid __ARGS((buf_T *buf));
+void close_buffer __ARGS((win_T *win, buf_T *buf, int action));
+void buf_clear_file __ARGS((buf_T *buf));
+void buf_freeall __ARGS((buf_T *buf, int del_buf, int wipe_buf));
+void goto_buffer __ARGS((exarg_T *eap, int start, int dir, int count));
+void handle_swap_exists __ARGS((buf_T *old_curbuf));
+char_u *do_bufdel __ARGS((int command, char_u *arg, int addr_count, int start_bnr, int end_bnr, int forceit));
+int do_buffer __ARGS((int action, int start, int dir, int count, int forceit));
+void set_curbuf __ARGS((buf_T *buf, int action));
+void enter_buffer __ARGS((buf_T *buf));
+buf_T *buflist_new __ARGS((char_u *ffname, char_u *sfname, linenr_T lnum, int flags));
+void free_buf_options __ARGS((buf_T *buf, int free_p_ff));
+int buflist_getfile __ARGS((int n, linenr_T lnum, int options, int forceit));
+void buflist_getfpos __ARGS((void));
+buf_T *buflist_findname_exp __ARGS((char_u *fname));
+buf_T *buflist_findname __ARGS((char_u *ffname));
+int buflist_findpat __ARGS((char_u *pattern, char_u *pattern_end, int unlisted, int diffmode));
+int ExpandBufnames __ARGS((char_u *pat, int *num_file, char_u ***file, int options));
+buf_T *buflist_findnr __ARGS((int nr));
+char_u *buflist_nr2name __ARGS((int n, int fullname, int helptail));
+void get_winopts __ARGS((buf_T *buf));
+pos_T *buflist_findfpos __ARGS((buf_T *buf));
+linenr_T buflist_findlnum __ARGS((buf_T *buf));
+void buflist_list __ARGS((exarg_T *eap));
+int buflist_name_nr __ARGS((int fnum, char_u **fname, linenr_T *lnum));
+int setfname __ARGS((buf_T *buf, char_u *ffname, char_u *sfname, int message));
+void buf_set_name __ARGS((int fnum, char_u *name));
+void buf_name_changed __ARGS((buf_T *buf));
+buf_T *setaltfname __ARGS((char_u *ffname, char_u *sfname, linenr_T lnum));
+char_u *getaltfname __ARGS((int errmsg));
+int buflist_add __ARGS((char_u *fname, int flags));
+void buflist_slash_adjust __ARGS((void));
+void buflist_altfpos __ARGS((void));
+int otherfile __ARGS((char_u *ffname));
+void buf_setino __ARGS((buf_T *buf));
+void fileinfo __ARGS((int fullname, int shorthelp, int dont_truncate));
+void col_print __ARGS((char_u *buf, int col, int vcol));
+void maketitle __ARGS((void));
+void resettitle __ARGS((void));
+void free_titles __ARGS((void));
+int build_stl_str_hl __ARGS((win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use_sandbox, int fillchar, int maxwidth, struct stl_hlrec *hltab, struct stl_hlrec *tabtab));
+void get_rel_pos __ARGS((win_T *wp, char_u *str));
+int append_arg_number __ARGS((win_T *wp, char_u *buf, int add_file, int maxlen));
+char_u *fix_fname __ARGS((char_u *fname));
+void fname_expand __ARGS((buf_T *buf, char_u **ffname, char_u **sfname));
+char_u *alist_name __ARGS((aentry_T *aep));
+void do_arg_all __ARGS((int count, int forceit, int keep_tabs));
+void ex_buffer_all __ARGS((exarg_T *eap));
+void do_modelines __ARGS((int flags));
+int read_viminfo_bufferlist __ARGS((vir_T *virp, int writing));
+void write_viminfo_bufferlist __ARGS((FILE *fp));
+char *buf_spname __ARGS((buf_T *buf));
+void buf_addsign __ARGS((buf_T *buf, int id, linenr_T lnum, int typenr));
+int buf_change_sign_type __ARGS((buf_T *buf, int markId, int typenr));
+int_u buf_getsigntype __ARGS((buf_T *buf, linenr_T lnum, int type));
+linenr_T buf_delsign __ARGS((buf_T *buf, int id));
+int buf_findsign __ARGS((buf_T *buf, int id));
+int buf_findsign_id __ARGS((buf_T *buf, linenr_T lnum));
+int buf_findsigntype_id __ARGS((buf_T *buf, linenr_T lnum, int typenr));
+int buf_signcount __ARGS((buf_T *buf, linenr_T lnum));
+void buf_delete_all_signs __ARGS((void));
+void sign_list_placed __ARGS((buf_T *rbuf));
+void sign_mark_adjust __ARGS((linenr_T line1, linenr_T line2, long amount, long amount_after));
+void set_buflisted __ARGS((int on));
+int buf_contents_changed __ARGS((buf_T *buf));
+void wipe_buffer __ARGS((buf_T *buf, int aucmd));
/* vim: set ft=c : */
diff --git a/src/proto/charset.pro b/src/proto/charset.pro
index a6f4802622..4b6890d18b 100644
--- a/src/proto/charset.pro
+++ b/src/proto/charset.pro
@@ -1,56 +1,56 @@
/* charset.c */
-extern int init_chartab __ARGS((void));
-extern int buf_init_chartab __ARGS((buf_T *buf, int global));
-extern void trans_characters __ARGS((char_u *buf, int bufsize));
-extern char_u *transstr __ARGS((char_u *s));
-extern char_u *str_foldcase __ARGS((char_u *str, int orglen, char_u *buf, int buflen));
-extern char_u *transchar __ARGS((int c));
-extern char_u *transchar_byte __ARGS((int c));
-extern void transchar_nonprint __ARGS((char_u *buf, int c));
-extern void transchar_hex __ARGS((char_u *buf, int c));
-extern int byte2cells __ARGS((int b));
-extern int char2cells __ARGS((int c));
-extern int ptr2cells __ARGS((char_u *p));
-extern int vim_strsize __ARGS((char_u *s));
-extern int vim_strnsize __ARGS((char_u *s, int len));
-extern int chartabsize __ARGS((char_u *p, colnr_T col));
-extern int linetabsize __ARGS((char_u *s));
-extern int win_linetabsize __ARGS((win_T *wp, char_u *p, colnr_T len));
-extern int vim_isIDc __ARGS((int c));
-extern int vim_iswordc __ARGS((int c));
-extern int vim_iswordp __ARGS((char_u *p));
-extern int vim_iswordc_buf __ARGS((char_u *p, buf_T *buf));
-extern int vim_isfilec __ARGS((int c));
-extern int vim_isprintc __ARGS((int c));
-extern int vim_isprintc_strict __ARGS((int c));
-extern int lbr_chartabsize __ARGS((unsigned char *s, colnr_T col));
-extern int lbr_chartabsize_adv __ARGS((char_u **s, colnr_T col));
-extern int win_lbr_chartabsize __ARGS((win_T *wp, char_u *s, colnr_T col, int *headp));
-extern int in_win_border __ARGS((win_T *wp, colnr_T vcol));
-extern void getvcol __ARGS((win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *end));
-extern colnr_T getvcol_nolist __ARGS((pos_T *posp));
-extern void getvvcol __ARGS((win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *end));
-extern void getvcols __ARGS((win_T *wp, pos_T *pos1, pos_T *pos2, colnr_T *left, colnr_T *right));
-extern char_u *skipwhite __ARGS((char_u *p));
-extern char_u *skipdigits __ARGS