Compare commits

..

14 Commits

23 changed files with 434 additions and 143 deletions

View File

@ -1,4 +1,4 @@
*netbeans.txt* For Vim version 7.0. Last change: 2006 Mar 09
*netbeans.txt* For Vim version 7.0. Last change: 2006 Nov 14
VIM REFERENCE MANUAL by Gordon Prieur
@ -259,8 +259,8 @@ problems and has been fixed in 2.2. To decrease the likelihood of this
confusion happening again, netbeans_saved() has been renamed to
netbeans_save_buffer().
We are now at version 2.3. For the differences between 2.2 and 2.3 search for
"2.3" below.
We are now at version 2.4. For the differences between 2.3 and 2.4 search for
"2.4" below.
The messages are currently sent over a socket. Since the messages are in
plain UTF-8 text this protocol could also be used with any other communication
@ -605,6 +605,15 @@ getLength Return the length of the buffer in bytes.
getMark Not implemented.
getAnno serNum
Return the line number of the annotation in the buffer.
Argument:
serNum serial number of this placed annotation
The reply is:
123 lnum line number of the annotation
123 0 invalid annotation serial number
New in version 2.4.
getModified When a buffer is specified: Return zero if the buffer does not
have changes, one if it does have changes.
When no buffer is specified (buffer number zero): Return the

View File

@ -4220,7 +4220,7 @@ alist_name(aep)
/* Use the name from the associated buffer if it exists. */
bp = buflist_findnr(aep->ae_fnum);
if (bp == NULL)
if (bp == NULL || bp->b_fname == NULL)
return aep->ae_fname;
return bp->b_fname;
}

View File

@ -9204,6 +9204,10 @@ ins_eol(c)
#ifdef FEAT_CINDENT
can_cindent = TRUE;
#endif
#ifdef FEAT_FOLDING
/* When inserting a line the cursor line must never be in a closed fold. */
foldOpenCursor();
#endif
return (!i);
}

View File

@ -166,7 +166,6 @@ struct ufunc
int uf_tm_count; /* nr of calls */
proftime_T uf_tm_total; /* time spend in function + children */
proftime_T uf_tm_self; /* time spend in function itself */
proftime_T uf_tm_start; /* time at function call */
proftime_T uf_tm_children; /* time spent in children this call */
/* profiling the function per line */
int *uf_tml_count; /* nr of times line was executed */
@ -18540,12 +18539,14 @@ ex_function(eap)
if (!eap->skip)
{
/* Check the name of the function. */
/* Check the name of the function. Unless it's a dictionary function
* (that we are overwriting). */
if (name != NULL)
arg = name;
else
arg = fudi.fd_newkey;
if (arg != NULL)
if (arg != NULL && (fudi.fd_di == NULL
|| fudi.fd_di->di_tv.v_type != VAR_FUNC))
{
if (*arg == K_SPECIAL)
j = 3;
@ -19764,6 +19765,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
char_u *name;
#ifdef FEAT_PROFILE
proftime_T wait_start;
proftime_T call_start;
#endif
/* If depth of calling is getting too high, don't execute the function */
@ -19943,7 +19945,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
|| (fc.caller != NULL && &fc.caller->func->uf_profiling))
{
++fp->uf_tm_count;
profile_start(&fp->uf_tm_start);
profile_start(&call_start);
profile_zero(&fp->uf_tm_children);
}
script_prof_save(&wait_start);
@ -19973,14 +19975,14 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
if (do_profiling == PROF_YES && (fp->uf_profiling
|| (fc.caller != NULL && &fc.caller->func->uf_profiling)))
{
profile_end(&fp->uf_tm_start);
profile_sub_wait(&wait_start, &fp->uf_tm_start);
profile_add(&fp->uf_tm_total, &fp->uf_tm_start);
profile_self(&fp->uf_tm_self, &fp->uf_tm_start, &fp->uf_tm_children);
profile_end(&call_start);
profile_sub_wait(&wait_start, &call_start);
profile_add(&fp->uf_tm_total, &call_start);
profile_self(&fp->uf_tm_self, &call_start, &fp->uf_tm_children);
if (fc.caller != NULL && &fc.caller->func->uf_profiling)
{
profile_add(&fc.caller->func->uf_tm_children, &fp->uf_tm_start);
profile_add(&fc.caller->func->uf_tml_children, &fp->uf_tm_start);
profile_add(&fc.caller->func->uf_tm_children, &call_start);
profile_add(&fc.caller->func->uf_tml_children, &call_start);
}
}
#endif

View File

@ -8219,8 +8219,9 @@ ex_at(eap)
c = *eap->arg;
if (c == NUL || (c == '*' && *eap->cmd == '*'))
c = '@';
/* put the register in mapbuf */
if (do_execreg(c, TRUE, vim_strchr(p_cpo, CPO_EXECBUF) != NULL) == FAIL)
/* Put the register in the typeahead buffer with the "silent" flag. */
if (do_execreg(c, TRUE, vim_strchr(p_cpo, CPO_EXECBUF) != NULL, TRUE)
== FAIL)
{
beep_flush();
}
@ -8370,6 +8371,7 @@ ex_redir(eap)
if (ASCII_ISALPHA(*arg)
# ifdef FEAT_CLIPBOARD
|| *arg == '*'
|| *arg == '+'
# endif
|| *arg == '"')
{
@ -8380,6 +8382,7 @@ ex_redir(eap)
(islower(redir_reg)
# ifdef FEAT_CLIPBOARD
|| redir_reg == '*'
|| redir_reg == '+'
# endif
|| redir_reg == '"'))
{

View File

@ -34,7 +34,7 @@ struct cmdline_info
int xp_context; /* type of expansion */
# ifdef FEAT_EVAL
char_u *xp_arg; /* user-defined expansion arg */
int input_fn; /* Invoked for input() function */
int input_fn; /* when TRUE Invoked for input() function */
# endif
};
@ -1390,7 +1390,17 @@ getcmdline(firstc, count, indent)
{
c = gchar_cursor();
if (c != NUL)
{
if (c == firstc || vim_strchr((char_u *)(
p_magic ? "\\^$.*[" : "\\^$"), c)
!= NULL)
{
/* put a backslash before special characters */
stuffcharReadbuff(c);
c = '\\';
}
break;
}
}
goto cmdline_not_changed;
}

View File

@ -1133,7 +1133,7 @@
/*
* +ARP Amiga only. Use arp.library, DOS 2.0 is not required.
*/
#ifndef NO_ARP
#if !defined(NO_ARP) && !defined(__amigaos4__)
# define FEAT_ARP
#endif

View File

@ -2216,11 +2216,55 @@ gui_mch_show_toolbar(int showit)
#endif
#if defined(FEAT_GUI_TABLINE) || defined(PROTO)
static void
add_tabline_popup_menu_entry(HMENU pmenu, UINT item_id, char_u *item_text)
{
#ifdef FEAT_MBYTE
WCHAR *wn = NULL;
int n;
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
/* 'encoding' differs from active codepage: convert menu name
* and use wide function */
wn = enc_to_ucs2(item_text, NULL);
if (wn != NULL)
{
MENUITEMINFOW infow;
infow.cbSize = sizeof(infow);
infow.fMask = MIIM_TYPE | MIIM_ID;
infow.wID = item_id;
infow.fType = MFT_STRING;
infow.dwTypeData = wn;
infow.cch = (UINT)wcslen(wn);
n = InsertMenuItemW(pmenu, item_id, FALSE, &infow);
vim_free(wn);
if (n == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
/* Failed, try using non-wide function. */
wn = NULL;
}
}
if (wn == NULL)
#endif
{
MENUITEMINFO info;
info.cbSize = sizeof(info);
info.fMask = MIIM_TYPE | MIIM_ID;
info.wID = item_id;
info.fType = MFT_STRING;
info.dwTypeData = item_text;
info.cch = (UINT)STRLEN(item_text);
InsertMenuItem(pmenu, item_id, FALSE, &info);
}
}
static void
show_tabline_popup_menu(void)
{
HMENU tab_pmenu;
MENUITEMINFO minfo;
long rval;
POINT pt;
@ -2236,21 +2280,10 @@ show_tabline_popup_menu(void)
if (tab_pmenu == NULL)
return;
minfo.cbSize = sizeof(MENUITEMINFO);
minfo.fMask = MIIM_TYPE|MIIM_ID;
minfo.fType = MFT_STRING;
minfo.dwTypeData = _("Close tab");
minfo.wID = TABLINE_MENU_CLOSE;
InsertMenuItem(tab_pmenu, TABLINE_MENU_CLOSE, FALSE, &minfo);
minfo.dwTypeData = _("New tab");
minfo.wID = TABLINE_MENU_NEW;
InsertMenuItem(tab_pmenu, TABLINE_MENU_NEW, FALSE, &minfo);
minfo.dwTypeData = _("Open tab...");
minfo.wID = TABLINE_MENU_OPEN;
InsertMenuItem(tab_pmenu, TABLINE_MENU_OPEN, FALSE, &minfo);
add_tabline_popup_menu_entry(tab_pmenu, TABLINE_MENU_CLOSE, _("Close tab"));
add_tabline_popup_menu_entry(tab_pmenu, TABLINE_MENU_NEW, _("New tab"));
add_tabline_popup_menu_entry(tab_pmenu, TABLINE_MENU_OPEN,
_("Open tab..."));
GetCursorPos(&pt);
rval = TrackPopupMenuEx(tab_pmenu, TPM_RETURNCMD, pt.x, pt.y, s_tabhwnd,
@ -2455,6 +2488,30 @@ initialise_findrep(char_u *initial_string)
}
#endif
static void
set_window_title(HWND hwnd, char *title)
{
#ifdef FEAT_MBYTE
if (title != NULL && enc_codepage >= 0 && enc_codepage != (int)GetACP())
{
WCHAR *wbuf;
int n;
/* Convert the title from 'encoding' to ucs2. */
wbuf = (WCHAR *)enc_to_ucs2((char_u *)title, NULL);
if (wbuf != NULL)
{
n = SetWindowTextW(hwnd, wbuf);
vim_free(wbuf);
if (n != 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
return;
/* Retry with non-wide function (for Windows 98). */
}
}
#endif
(void)SetWindowText(hwnd, (LPCSTR)title);
}
void
gui_mch_find_dialog(exarg_T *eap)
{
@ -2470,8 +2527,8 @@ gui_mch_find_dialog(exarg_T *eap)
s_findrep_hwnd = FindText((LPFINDREPLACE) &s_findrep_struct);
}
(void)SetWindowText(s_findrep_hwnd,
(LPCSTR)_("Find string (use '\\\\' to find a '\\')"));
set_window_title(s_findrep_hwnd,
_("Find string (use '\\\\' to find a '\\')"));
(void)SetFocus(s_findrep_hwnd);
s_findrep_is_find = TRUE;
@ -2495,8 +2552,8 @@ gui_mch_replace_dialog(exarg_T *eap)
s_findrep_hwnd = ReplaceText((LPFINDREPLACE) &s_findrep_struct);
}
(void)SetWindowText(s_findrep_hwnd,
(LPCSTR)_("Find & Replace (use '\\\\' to find a '\\')"));
set_window_title(s_findrep_hwnd,
_("Find & Replace (use '\\\\' to find a '\\')"));
(void)SetFocus(s_findrep_hwnd);
s_findrep_is_find = FALSE;
@ -3015,25 +3072,7 @@ gui_mch_settitle(
char_u *title,
char_u *icon)
{
#ifdef FEAT_MBYTE
if (title != NULL && enc_codepage >= 0 && enc_codepage != (int)GetACP())
{
WCHAR *wbuf;
int n;
/* Convert the title from 'encoding' to ucs2. */
wbuf = (WCHAR *)enc_to_ucs2(title, NULL);
if (wbuf != NULL)
{
n = SetWindowTextW(s_hwnd, wbuf);
vim_free(wbuf);
if (n != 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
return;
/* Retry with non-wide function (for Windows 98). */
}
}
#endif
SetWindowText(s_hwnd, (LPCSTR)(title == NULL ? "VIM" : (char *)title));
set_window_title(s_hwnd, (title == NULL ? "VIM" : (char *)title));
}
#ifdef FEAT_MOUSESHAPE

View File

@ -1008,7 +1008,7 @@ cs_find_common(opt, pat, forceit, verbose, use_ll)
totmatches = 0;
for (i = 0; i < CSCOPE_MAX_CONNECTIONS; i++)
{
if (csinfo[i].fname == NULL)
if (csinfo[i].fname == NULL || csinfo[i].to_fp == NULL)
continue;
/* send cmd to cscope */

View File

@ -2392,7 +2392,23 @@ create_windows(parmp)
(void)open_buffer(FALSE, NULL); /* create memfile, read file */
#if defined(HAS_SWAP_EXISTS_ACTION)
check_swap_exists_action();
if (swap_exists_action == SEA_QUIT)
{
if (got_int || only_one_window())
{
/* abort selected or quit and only one window */
did_emsg = FALSE; /* avoid hit-enter prompt */
getout(1);
}
/* We can't close the window, it would disturb what
* happens next. Clear the file name and set the arg
* index to -1 to delete it later. */
setfname(curbuf, NULL, NULL, FALSE);
curwin->w_arg_idx = -1;
swap_exists_action = SEA_NONE;
}
else
handle_swap_exists(NULL);
#endif
#ifdef FEAT_AUTOCMD
dorewind = TRUE; /* start again */
@ -2432,6 +2448,8 @@ edit_buffers(parmp)
{
int arg_idx; /* index in argument list */
int i;
int advance = TRUE;
buf_T *old_curbuf;
# ifdef FEAT_AUTOCMD
/*
@ -2440,31 +2458,65 @@ edit_buffers(parmp)
++autocmd_no_enter;
++autocmd_no_leave;
# endif
/* When w_arg_idx is -1 remove the window (see create_windows()). */
if (curwin->w_arg_idx == -1)
{
win_close(curwin, TRUE);
advance = FALSE;
}
arg_idx = 1;
for (i = 1; i < parmp->window_count; ++i)
{
if (parmp->window_layout == WIN_TABS)
/* When w_arg_idx is -1 remove the window (see create_windows()). */
if (curwin->w_arg_idx == -1)
{
if (curtab->tp_next == NULL) /* just checking */
break;
goto_tabpage(0);
}
else
{
if (curwin->w_next == NULL) /* just checking */
break;
win_enter(curwin->w_next, FALSE);
++arg_idx;
win_close(curwin, TRUE);
advance = FALSE;
continue;
}
if (advance)
{
if (parmp->window_layout == WIN_TABS)
{
if (curtab->tp_next == NULL) /* just checking */
break;
goto_tabpage(0);
}
else
{
if (curwin->w_next == NULL) /* just checking */
break;
win_enter(curwin->w_next, FALSE);
}
}
advance = TRUE;
/* Only open the file if there is no file in this window yet (that can
* happen when .vimrc contains ":sall") */
* happen when .vimrc contains ":sall"). */
if (curbuf == firstwin->w_buffer || curbuf->b_ffname == NULL)
{
curwin->w_arg_idx = arg_idx;
/* edit file from arg list, if there is one */
/* Edit file from arg list, if there is one. When "Quit" selected
* at the ATTENTION prompt close the window. */
old_curbuf = curbuf;
(void)do_ecmd(0, arg_idx < GARGCOUNT
? alist_name(&GARGLIST[arg_idx]) : NULL,
NULL, NULL, ECMD_LASTL, ECMD_HIDE);
if (curbuf == old_curbuf)
{
if (got_int || only_one_window())
{
/* abort selected or quit and only one window */
did_emsg = FALSE; /* avoid hit-enter prompt */
getout(1);
}
win_close(curwin, TRUE);
advance = FALSE;
}
if (arg_idx == GARGCOUNT - 1)
arg_had_last = TRUE;
++arg_idx;

View File

@ -667,7 +667,7 @@ codepage_invalid:
* API */
n = IsDBCSLeadByteEx(enc_dbcs, (BYTE)i) ? 2 : 1;
#else
# ifdef MACOS
# if defined(MACOS) || defined(__amigaos4__)
/*
* if mblen() is not available, character which MSB is turned on
* are treated as leading byte character. (note : This assumption

View File

@ -655,7 +655,7 @@ mf_sync(mfp, flags)
# endif
#endif
#ifdef AMIGA
# ifdef __AROS__
# if defined(__AROS__) || defined(__amigaos4__)
if (fsync(mfp->mf_fd) != 0)
status = FAIL;
# else
@ -1028,12 +1028,12 @@ mf_read(mfp, hp)
size = page_size * hp->bh_page_count;
if (lseek(mfp->mf_fd, offset, SEEK_SET) != offset)
{
EMSG(_("E294: Seek error in swap file read"));
PERROR(_("E294: Seek error in swap file read"));
return FAIL;
}
if ((unsigned)vim_read(mfp->mf_fd, hp->bh_data, size) != size)
{
EMSG(_("E295: Read error in swap file"));
PERROR(_("E295: Read error in swap file"));
return FAIL;
}
return OK;
@ -1085,7 +1085,7 @@ mf_write(mfp, hp)
offset = (off_t)page_size * nr;
if (lseek(mfp->mf_fd, offset, SEEK_SET) != offset)
{
EMSG(_("E296: Seek error in swap file write"));
PERROR(_("E296: Seek error in swap file write"));
return FAIL;
}
if (hp2 == NULL) /* freed block, fill with dummy data */

View File

@ -55,10 +55,14 @@
# include <time.h>
#endif
#ifdef SASC
#if defined(SASC) || defined(__amigaos4__)
# include <proto/dos.h> /* for Open() and Close() */
#endif
#ifdef HAVE_ERRNO_H
# include <errno.h>
#endif
typedef struct block0 ZERO_BL; /* contents of the first block */
typedef struct pointer_block PTR_BL; /* contents of a pointer block */
typedef struct data_block DATA_BL; /* contents of a data block */
@ -1325,6 +1329,7 @@ theend:
mf_put(mfp, hp, FALSE, FALSE);
mf_close(mfp, FALSE); /* will also vim_free(mfp->mf_fname) */
}
vim_free(buf->b_ml.ml_stack);
vim_free(buf);
if (serious_error && called_from_main)
ml_close(curbuf, TRUE);
@ -4481,7 +4486,7 @@ ml_updatechunk(buf, line, len, updtype)
curchnk = buf->b_ml.ml_chunksize + curix;
if (updtype == ML_CHNK_DELLINE)
len *= -1;
len = -len;
curchnk->mlcs_totalsize += len;
if (updtype == ML_CHNK_ADDLINE)
{

View File

@ -61,7 +61,7 @@
/* The first implementation (working only with Netbeans) returned "1.1". The
* protocol implemented here also supports A-A-P. */
static char *ExtEdProtocolVersion = "2.3";
static char *ExtEdProtocolVersion = "2.4";
static long pos2off __ARGS((buf_T *, pos_T *));
static pos_T *off2pos __ARGS((buf_T *, long));
@ -1269,6 +1269,29 @@ nb_do_cmd(
(int)curwin->w_cursor.col,
pos2off(curbuf, &curwin->w_cursor));
nb_reply_text(cmdno, text);
/* =====================================================================*/
}
else if (streq((char *)cmd, "getAnno"))
{
long linenum = 0;
#ifdef FEAT_SIGNS
if (buf == NULL || buf->bufp == NULL)
{
nbdebug((" null bufp in getAnno"));
EMSG("E652: null bufp in getAnno");
retval = FAIL;
}
else
{
int serNum;
cp = (char *)args;
serNum = strtol(cp, &cp, 10);
/* If the sign isn't found linenum will be zero. */
linenum = (long)buf_findsign(buf->bufp, serNum);
}
#endif
nb_reply_nr(cmdno, linenum);
/* =====================================================================*/
}
else if (streq((char *)cmd, "getLength"))

View File

@ -8860,7 +8860,7 @@ nv_at(cap)
#endif
while (cap->count1-- && !got_int)
{
if (do_execreg(cap->nchar, FALSE, FALSE) == FAIL)
if (do_execreg(cap->nchar, FALSE, FALSE, FALSE) == FAIL)
{
clearopbeep(cap->oap);
break;

View File

@ -95,8 +95,8 @@ static void shift_block __ARGS((oparg_T *oap, int amount));
static void block_insert __ARGS((oparg_T *oap, char_u *s, int b_insert, struct block_def*bdp));
#endif
static int stuff_yank __ARGS((int, char_u *));
static void put_reedit_in_typebuf __ARGS((void));
static int put_in_typebuf __ARGS((char_u *s, int colon));
static void put_reedit_in_typebuf __ARGS((int silent));
static int put_in_typebuf __ARGS((char_u *s, int colon, int silent));
static void stuffescaped __ARGS((char_u *arg, int literally));
#ifdef FEAT_MBYTE
static void mb_adjust_opend __ARGS((oparg_T *oap));
@ -1120,10 +1120,11 @@ stuff_yank(regname, p)
* return FAIL for failure, OK otherwise
*/
int
do_execreg(regname, colon, addcr)
do_execreg(regname, colon, addcr, silent)
int regname;
int colon; /* insert ':' before each line */
int addcr; /* always add '\n' to end of line */
int silent; /* set "silent" flag in typeahead buffer */
{
static int lastc = NUL;
long i;
@ -1173,9 +1174,9 @@ do_execreg(regname, colon, addcr)
/* When in Visual mode "'<,'>" will be prepended to the command.
* Remove it when it's already there. */
if (VIsual_active && STRNCMP(p, "'<,'>", 5) == 0)
retval = put_in_typebuf(p + 5, TRUE);
retval = put_in_typebuf(p + 5, TRUE, silent);
else
retval = put_in_typebuf(p, TRUE);
retval = put_in_typebuf(p, TRUE, silent);
}
vim_free(p);
}
@ -1186,7 +1187,7 @@ do_execreg(regname, colon, addcr)
p = get_expr_line();
if (p == NULL)
return FAIL;
retval = put_in_typebuf(p, colon);
retval = put_in_typebuf(p, colon, silent);
vim_free(p);
}
#endif
@ -1198,7 +1199,7 @@ do_execreg(regname, colon, addcr)
EMSG(_(e_noinstext));
return FAIL;
}
retval = put_in_typebuf(p, colon);
retval = put_in_typebuf(p, colon, silent);
vim_free(p);
}
else
@ -1213,20 +1214,20 @@ do_execreg(regname, colon, addcr)
/*
* Insert lines into typeahead buffer, from last one to first one.
*/
put_reedit_in_typebuf();
put_reedit_in_typebuf(silent);
for (i = y_current->y_size; --i >= 0; )
{
/* insert NL between lines and after last line if type is MLINE */
if (y_current->y_type == MLINE || i < y_current->y_size - 1
|| addcr)
{
if (ins_typebuf((char_u *)"\n", remap, 0, TRUE, FALSE) == FAIL)
if (ins_typebuf((char_u *)"\n", remap, 0, TRUE, silent) == FAIL)
return FAIL;
}
if (ins_typebuf(y_current->y_array[i], remap, 0, TRUE, FALSE)
if (ins_typebuf(y_current->y_array[i], remap, 0, TRUE, silent)
== FAIL)
return FAIL;
if (colon && ins_typebuf((char_u *)":", remap, 0, TRUE, FALSE)
if (colon && ins_typebuf((char_u *)":", remap, 0, TRUE, silent)
== FAIL)
return FAIL;
}
@ -1240,7 +1241,8 @@ do_execreg(regname, colon, addcr)
* used only after other typeahead has been processed.
*/
static void
put_reedit_in_typebuf()
put_reedit_in_typebuf(silent)
int silent;
{
char_u buf[3];
@ -1257,25 +1259,26 @@ put_reedit_in_typebuf()
buf[0] = restart_edit == 'I' ? 'i' : restart_edit;
buf[1] = NUL;
}
if (ins_typebuf(buf, REMAP_NONE, 0, TRUE, FALSE) == OK)
if (ins_typebuf(buf, REMAP_NONE, 0, TRUE, silent) == OK)
restart_edit = NUL;
}
}
static int
put_in_typebuf(s, colon)
put_in_typebuf(s, colon, silent)
char_u *s;
int colon; /* add ':' before the line */
int silent;
{
int retval = OK;
put_reedit_in_typebuf();
put_reedit_in_typebuf(silent);
if (colon)
retval = ins_typebuf((char_u *)"\n", REMAP_YES, 0, TRUE, FALSE);
retval = ins_typebuf((char_u *)"\n", REMAP_YES, 0, TRUE, silent);
if (retval == OK)
retval = ins_typebuf(s, REMAP_YES, 0, TRUE, FALSE);
retval = ins_typebuf(s, REMAP_YES, 0, TRUE, silent);
if (colon && retval == OK)
retval = ins_typebuf((char_u *)":", REMAP_YES, 0, TRUE, FALSE);
retval = ins_typebuf((char_u *)":", REMAP_YES, 0, TRUE, silent);
return retval;
}

View File

@ -30,20 +30,31 @@
# include <exec/types.h>
# include <exec/exec.h>
# include <libraries/dos.h>
# include <libraries/dosextens.h>
# include <intuition/intuition.h>
#else
# include <proto/dos.h>
# include <libraries/dosextens.h>
# include <proto/intuition.h>
# include <proto/exec.h>
#endif
/* XXX These are included from os_amiga.h
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
*/
#include <exec/memory.h>
#include <libraries/dosextens.h>
#include <dos/dostags.h> /* for 2.0 functions */
#include <dos/dosasl.h>
/* From version 4 of AmigaOS, several system structures must be allocated
* and freed using system functions. "struct AnchorPath" is one.
*/
#ifdef __amigaos4__
# include <dos/anchorpath.h>
# define free_fib(x) FreeDosObject(DOS_FIB, x)
#else
# define free_fib(x) vim_free(fib)
#endif
#if defined(LATTICE) && !defined(SASC) && defined(FEAT_ARP)
# include <libraries/arp_pragmas.h>
#endif
@ -56,7 +67,9 @@
#undef FALSE
#define FALSE (0)
#if !defined(AZTEC_C) && !defined(__AROS__)
#ifdef __amigaos4__
# define dos_packet(a, b, c) DoPkt(a, b, c, 0, 0, 0, 0)
#elif !defined(AZTEC_C) && !defined(__AROS__)
static long dos_packet __ARGS((struct MsgPort *, long, long));
#endif
static int lock2name __ARGS((BPTR lock, char_u *buf, long len));
@ -68,7 +81,9 @@ static BPTR raw_in = (BPTR)NULL;
static BPTR raw_out = (BPTR)NULL;
static int close_win = FALSE; /* set if Vim opened the window */
#ifndef __amigaos4__ /* Use autoopen for AmigaOS4 */
struct IntuitionBase *IntuitionBase = NULL;
#endif
#ifdef FEAT_ARP
struct ArpBase *ArpBase = NULL;
#endif
@ -186,9 +201,17 @@ mch_char_avail()
mch_avail_mem(special)
int special;
{
#ifdef __amigaos4__
return (long_u)AvailMem(MEMF_ANY);
#else
return (long_u)AvailMem(special ? (long)MEMF_CHIP : (long)MEMF_ANY);
#endif
}
/*
* Waits a specified amount of time, or until input arrives if
* ignoreinput is FALSE.
*/
void
mch_delay(msec, ignoreinput)
long msec;
@ -252,6 +275,7 @@ mch_init()
out_flush();
wb_window = NULL;
#ifndef __amigaos4__
if ((IntuitionBase = (struct IntuitionBase *)
OpenLibrary((UBYTE *)intlibname, 0L)) == NULL)
{
@ -260,6 +284,7 @@ mch_init()
mch_errmsg("!?\n");
mch_exit(3);
}
#endif
}
#include <workbench/startup.h>
@ -284,7 +309,7 @@ mch_check_win(argc, argv)
{
int i;
BPTR nilfh, fh;
char_u buf1[20];
char_u buf1[24];
char_u buf2[BUF2SIZE];
static char_u *(constrings[3]) = {(char_u *)"con:0/0/662/210/",
(char_u *)"con:0/0/640/200/",
@ -295,35 +320,39 @@ mch_check_win(argc, argv)
char *av;
char_u *device = NULL;
int exitval = 4;
#ifndef __amigaos4__
struct Library *DosBase;
#endif
int usewin = FALSE;
/*
* check if we are running under DOS 2.0x or higher
*/
#ifndef __amigaos4__
DosBase = OpenLibrary(DOS_LIBRARY, 37L);
if (DosBase != NULL)
/* if (((struct Library *)DOSBase)->lib_Version >= 37) */
{
CloseLibrary(DosBase);
#ifdef FEAT_ARP
# ifdef FEAT_ARP
dos2 = TRUE;
#endif
# endif
}
else /* without arp functions we NEED 2.0 */
{
#ifndef FEAT_ARP
# ifndef FEAT_ARP
mch_errmsg(_("Need Amigados version 2.04 or later\n"));
exit(3);
#else
# else
/* need arp functions for dos 1.x */
if (!(ArpBase = (struct ArpBase *) OpenLibrary((UBYTE *)ArpName, ArpVersion)))
{
fprintf(stderr, _("Need %s version %ld\n"), ArpName, ArpVersion);
exit(3);
}
#endif
# endif
}
#endif /* __amigaos4__ */
/*
* scan argv[] for the "-f" and "-d" arguments
@ -398,8 +427,15 @@ mch_check_win(argc, argv)
/*
* Make a unique name for the temp file (which we will not delete!).
* Use a pointer on the stack (nobody else will be using it).
* Under AmigaOS4, this assumption might change in the future, so
* we use a pointer to the current task instead. This should be a
* shared structure and thus globally unique.
*/
#ifdef __amigaos4__
sprintf((char *)buf1, "t:nc%p", FindTask(0));
#else
sprintf((char *)buf1, "t:nc%ld", (long)buf1);
#endif
if ((fh = Open((UBYTE *)buf1, (long)MODE_NEWFILE)) == (BPTR)NULL)
{
mch_errmsg(_("Cannot create "));
@ -513,7 +549,8 @@ mch_input_isatty()
/*
* fname_case(): Set the case of the file name, if it already exists.
* This will cause the file name to remain exactly the same.
* This will cause the file name to remain exactly the same
* if the file system ignores, but preserves case.
*/
/*ARGSUSED*/
void
@ -528,9 +565,14 @@ fname_case(name, len)
if (fib != NULL)
{
flen = STRLEN(name);
/* TODO: Check if this fix applies to AmigaOS < 4 too.*/
#ifdef __amigaos4__
if (fib->fib_DirEntryType == ST_ROOT)
strcat(fib->fib_FileName, ":");
#endif
if (flen == strlen(fib->fib_FileName)) /* safety check */
mch_memmove(name, fib->fib_FileName, flen);
vim_free(fib);
free_fib(fib);
}
}
@ -548,13 +590,17 @@ get_fib(fname)
if (fname == NULL) /* safety check */
return NULL;
fib = (struct FileInfoBlock *)malloc(sizeof(struct FileInfoBlock));
#ifdef __amigaos4__
fib = AllocDosObject(DOS_FIB,0);
#else
fib = (struct FileInfoBlock *)alloc(sizeof(struct FileInfoBlock));
#endif
if (fib != NULL)
{
flock = Lock((UBYTE *)fname, (long)ACCESS_READ);
if (flock == (BPTR)NULL || !Examine(flock, fib))
{
vim_free(fib); /* in case of an error the memory is freed here */
free_fib(fib); /* in case of an error the memory is freed here */
fib = NULL;
}
if (flock)
@ -613,6 +659,7 @@ mch_get_user_name(s, len)
char_u *s;
int len;
{
/* TODO: Implement this. */
*s = NUL;
return FAIL;
}
@ -625,7 +672,11 @@ mch_get_host_name(s, len)
char_u *s;
int len;
{
#if defined(__amigaos4__) && defined(__CLIB2__)
gethostname(s, len);
#else
vim_strncpy(s, "Amiga", len - 1);
#endif
}
/*
@ -634,7 +685,14 @@ mch_get_host_name(s, len)
long
mch_get_pid()
{
#ifdef __amigaos4__
/* This is as close to a pid as we can come. We could use CLI numbers also,
* but then we would have two different types of process identifiers.
*/
return((long)FindTask(0));
#else
return (long)0;
#endif
}
/*
@ -746,7 +804,7 @@ mch_getperm(name)
if (fib != NULL)
{
retval = fib->fib_Protection;
vim_free(fib);
free_fib(fib);
}
return retval;
}
@ -790,8 +848,12 @@ mch_isdir(name)
fib = get_fib(name);
if (fib != NULL)
{
#ifdef __amigaos4__
retval = (FIB_IS_DRAWER(fib)) ? TRUE : FALSE;
#else
retval = ((fib->fib_DirEntryType >= 0) ? TRUE : FALSE);
vim_free(fib);
#endif
free_fib(fib);
}
return retval;
}
@ -912,7 +974,7 @@ mch_exit(r)
mch_settmode(tmode)
int tmode;
{
#ifdef __AROS__
#if defined(__AROS__) || defined(__amigaos4__)
if (!SetMode(raw_in, tmode == TMODE_RAW ? 1 : 0))
#else
if (dos_packet(MP(raw_in), (long)ACTION_SCREEN_MODE,
@ -954,14 +1016,21 @@ mch_screenmode(arg)
mch_get_shellsize()
{
struct ConUnit *conUnit;
#ifndef __amigaos4__
char id_a[sizeof(struct InfoData) + 3];
struct InfoData *id;
#endif
struct InfoData *id=0;
if (!term_console) /* not an amiga window */
return FAIL;
goto out;
/* insure longword alignment */
#ifdef __amigaos4__
if(!(id = AllocDosObject(DOS_INFODATA, 0)))
goto out;
#else
id = (struct InfoData *)(((long)id_a + 3L) & ~3L);
#endif
/*
* Should make console aware of real window size, not the one we set.
@ -983,7 +1052,7 @@ mch_get_shellsize()
/* it's not an amiga window, maybe aux device */
/* terminal type should be set */
term_console = FALSE;
return FAIL;
goto out;
}
if (oldwindowtitle == NULL)
oldwindowtitle = (char_u *)wb_window->Title;
@ -1006,6 +1075,12 @@ mch_get_shellsize()
}
return OK;
out:
#ifdef __amigaos4__
FreeDosObject(DOS_INFODATA, id); /* Safe to pass NULL */
#endif
return FAIL;
}
/*
@ -1046,7 +1121,7 @@ out_num(n)
OUT_STR_NF(tltoa((unsigned long)n));
}
#if !defined(AZTEC_C) && !defined(__AROS__)
#if !defined(AZTEC_C) && !defined(__AROS__) && !defined(__amigaos4__)
/*
* Sendpacket.c
*
@ -1371,8 +1446,12 @@ Chk_Abort(void)
* Use and abuse as you please.
*/
#define ANCHOR_BUF_SIZE (512)
#define ANCHOR_SIZE (sizeof(struct AnchorPath) + ANCHOR_BUF_SIZE)
#ifdef __amigaos4__
# define ANCHOR_BUF_SIZE 1024
#else
# define ANCHOR_BUF_SIZE (512)
# define ANCHOR_SIZE (sizeof(struct AnchorPath) + ANCHOR_BUF_SIZE)
#endif
int
mch_expandpath(gap, pat, flags)
@ -1385,19 +1464,32 @@ mch_expandpath(gap, pat, flags)
char_u *starbuf, *sp, *dp;
int start_len;
int matches;
#ifdef __amigaos4__
struct TagItem AnchorTags[] = {
{ADO_Strlen, ANCHOR_BUF_SIZE},
{ADO_Flags, APF_DODOT|APF_DOWILD|APF_MultiAssigns},
{TAG_DONE, 0L}
};
#endif
start_len = gap->ga_len;
/* Get our AnchorBase */
#ifdef __amigaos4__
Anchor = AllocDosObject(DOS_ANCHORPATH, AnchorTags);
#else
Anchor = (struct AnchorPath *)alloc_clear((unsigned)ANCHOR_SIZE);
#endif
if (Anchor == NULL)
return 0;
#ifndef __amigaos4__
Anchor->ap_Strlen = ANCHOR_BUF_SIZE; /* ap_Length not supported anymore */
#ifdef APF_DODOT
# ifdef APF_DODOT
Anchor->ap_Flags = APF_DODOT | APF_DOWILD; /* allow '.' for current dir */
#else
# else
Anchor->ap_Flags = APF_DoDot | APF_DoWild; /* allow '.' for current dir */
# endif
#endif
#ifdef FEAT_ARP
@ -1432,7 +1524,11 @@ mch_expandpath(gap, pat, flags)
*/
while (Result == 0)
{
#ifdef __amigaos4__
addfile(gap, (char_u *)Anchor->ap_Buffer, flags);
#else
addfile(gap, (char_u *)Anchor->ap_Buf, flags);
#endif
#ifdef FEAT_ARP
if (dos2)
#endif
@ -1469,7 +1565,11 @@ mch_expandpath(gap, pat, flags)
#endif
Return:
#ifdef __amigaos4__
FreeDosObject(DOS_ANCHORPATH, Anchor);
#else
vim_free(Anchor);
#endif
return matches;
}

View File

@ -17,9 +17,12 @@
#define HAVE_AVAIL_MEM
#ifndef HAVE_CONFIG_H
# ifdef AZTEC_C
# if defined(AZTEC_C) || defined(__amigaos4__)
# define HAVE_STAT_H
# endif
# ifdef __amigaos4__
# define HAVE_STDARG_H
# endif
# define HAVE_STDLIB_H
# define HAVE_STRING_H
# define HAVE_FCNTL_H
@ -34,16 +37,25 @@
# define HAVE_DATE_TIME
# endif
#define DFLT_ERRORFILE "AztecC.Err"
#define DFLT_RUNTIMEPATH "home:vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,home:vimfiles/after"
#define BASENAMELEN 26 /* Amiga */
#define TEMPNAME "t:v?XXXXXX"
#define TEMPNAMELEN 12
#endif /* HAVE_CONFIG_H */
#ifndef DFLT_ERRORFILE
# define DFLT_ERRORFILE "AztecC.Err" /* Should this change? */
#endif
#ifndef DFLT_RUNTIMEPATH
# define DFLT_RUNTIMEPATH "home:vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,home:vimfiles/after"
#endif
#ifndef BASENAMELEN
# define BASENAMELEN 26 /* Amiga */
#endif
#ifndef TEMPNAME
# define TEMPNAME "t:v?XXXXXX"
# define TEMPNAMELEN 12
#endif
#include <exec/types.h>
#include <libraries/dos.h>
#include <libraries/dosextens.h>
@ -155,9 +167,9 @@ typedef long off_t;
#endif
#ifdef FEAT_VIMINFO
#ifndef VIMINFO_FILE
# define VIMINFO_FILE "s:.viminfo"
#endif
# ifndef VIMINFO_FILE
# define VIMINFO_FILE "s:.viminfo"
# endif
#endif /* FEAT_VIMINFO */
#ifndef EXRC_FILE

View File

@ -17,7 +17,7 @@ extern void *get_register __ARGS((int name, int copy));
extern void put_register __ARGS((int name, void *reg));
extern int yank_register_mline __ARGS((int regname));
extern int do_record __ARGS((int c));
extern int do_execreg __ARGS((int regname, int colon, int addcr));
extern int do_execreg __ARGS((int regname, int colon, int addcr, int silent));
extern int insert_reg __ARGS((int regname, int literally));
extern int get_spec_reg __ARGS((int regname, char_u **argp, int *allocated, int errmsg));
extern int cmdline_paste_reg __ARGS((int regname, int literally, int remcr));

View File

@ -51,7 +51,7 @@
# include <sys/termios.h>
#endif
#if HAVE_SYS_IOCTL_H
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
@ -69,14 +69,14 @@
# endif
#endif
#if HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#if HAVE_TERMIO_H
# include <termio.h>
#else
# if HAVE_TERMIOS_H
# ifdef HAVE_TERMIOS_H
# include <termios.h>
# endif
#endif

View File

@ -455,6 +455,7 @@ update_screen(type)
&& curwin->w_topline == curwin->w_lines[0].wl_lnum)
#ifdef FEAT_VISUAL
|| (type == INVERTED
&& VIsual_active
&& curwin->w_old_cursor_lnum == curwin->w_cursor.lnum
&& curwin->w_old_visual_mode == VIsual_mode
&& (curwin->w_valid & VALID_VIRTCOL)

View File

@ -666,6 +666,34 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
169,
/**/
168,
/**/
167,
/**/
166,
/**/
165,
/**/
164,
/**/
163,
/**/
162,
/**/
161,
/**/
160,
/**/
159,
/**/
158,
/**/
157,
/**/
156,
/**/
155,
/**/

View File

@ -4273,7 +4273,7 @@ win_alloc_lines(wp)
win_T *wp;
{
wp->w_lines_valid = 0;
wp->w_lines = (wline_T *)alloc((unsigned)(Rows * sizeof(wline_T)));
wp->w_lines = (wline_T *)alloc_clear((unsigned)(Rows * sizeof(wline_T)));
if (wp->w_lines == NULL)
return FAIL;
return OK;