1
0
forked from aniani/vim

updated for version 7.0060

This commit is contained in:
Bram Moolenaar 2005-03-15 22:34:55 +00:00
parent 28a37ffcf7
commit 3918c950c9
14 changed files with 1289 additions and 1261 deletions

View File

@ -1,9 +1,8 @@
" Vim syntax file
" Language: PROLOG
" Maintainers: Ralph Becket <rwab1@cam.sri.co.uk>,
" Thomas Koehler <jean-luc@picard.franken.de>
" Last Change: 2003 May 11
" URL: http://jeanluc-picard.de/vim/syntax/prolog.vim
" Maintainers: Thomas Koehler <jean-luc@picard.franken.de>
" Last Change: 2005 Mar 14
" URL: http://gott-gehabt/800_wer_wir_sind/thomas/Homepage/Computer/vim/syntax/prolog.vim
" There are two sets of highlighting in here:
" If the "prolog_highlighting_clean" variable exists, it is rather sparse.
@ -73,7 +72,7 @@ if !exists("prolog_highlighting_clean")
endif
syn sync ccomment maxlines=50
syn sync maxlines=50
" Define the default highlighting.

View File

@ -930,6 +930,7 @@ EXTERN char_u *new_last_cmdline INIT(= NULL); /* new value for last_cmdline */
EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */
EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */
EXTERN char_u *autocmd_match INIT(= NULL); /* name for <amatch> on cmdline */
EXTERN int did_cursorhold INIT(= FALSE); /* set when CursorHold triggered */
#endif
EXTERN linenr_T write_no_eol_lnum INIT(= 0); /* non-zero lnum when last line

111
src/gui.c
View File

@ -29,6 +29,8 @@ static void fill_mouse_coord __ARGS((char_u *p, int col, int row));
static void gui_do_scrollbar __ARGS((win_T *wp, int which, int enable));
static colnr_T scroll_line_len __ARGS((linenr_T lnum));
static void gui_update_horiz_scrollbar __ARGS((int));
static void gui_set_fg_color __ARGS((char_u *name));
static void gui_set_bg_color __ARGS((char_u *name));
static win_T *xy2win __ARGS((int x, int y));
static int can_update_cursor = TRUE; /* can display the cursor */
@ -1941,6 +1943,7 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
long_u hl_mask_todo;
guicolor_T fg_color;
guicolor_T bg_color;
guicolor_T sp_color;
#if !defined(MSWIN16_FASTTEXT) && !defined(HAVE_GTK2) && !defined(FEAT_GUI_KDE)
GuiFont font = NOFONT;
# ifdef FEAT_XFONTSET
@ -2050,6 +2053,7 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
draw_flags |= DRAW_CURSOR;
fg_color = fg;
bg_color = bg;
sp_color = fg;
}
else if (aep != NULL)
{
@ -2059,9 +2063,15 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
bg_color = aep->ae_u.gui.bg_color;
if (bg_color == INVALCOLOR)
bg_color = gui.back_pixel;
sp_color = aep->ae_u.gui.sp_color;
if (sp_color == INVALCOLOR)
sp_color = fg_color;
}
else
{
fg_color = gui.norm_pixel;
sp_color = fg_color;
}
if (highlight_mask & (HL_INVERSE | HL_STANDOUT))
{
@ -2081,6 +2091,7 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
gui_mch_set_bg_color(bg_color);
#endif
}
gui_mch_set_sp_color(sp_color);
/* Clear the selection if we are about to write over it */
if (!(flags & GUI_MON_NOCLEAR))
@ -2119,6 +2130,9 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
)
draw_flags |= DRAW_UNDERL;
#endif
/* Do we undercurl the text? */
if (hl_mask_todo & HL_UNDERCURL)
draw_flags |= DRAW_UNDERC;
/* Do we draw transparantly? */
if (flags & GUI_MON_TRS_CURSOR)
@ -2364,7 +2378,7 @@ gui_redraw_block(row1, col1, row2, col2, flags)
int old_row, old_col;
long_u old_hl_mask;
int off;
char_u first_attr;
sattr_T first_attr;
int idx, len;
int back, nback;
int retval = FALSE;
@ -2588,9 +2602,6 @@ gui_wait_for_chars(wtime)
long wtime;
{
int retval;
#ifdef FEAT_AUTOCMD
static int once_already = 0;
#endif
/*
* If we're going to wait a bit, update the menus and mouse shape for the
@ -2605,19 +2616,9 @@ gui_wait_for_chars(wtime)
gui_mch_update();
if (input_available()) /* Got char, return immediately */
{
#ifdef FEAT_AUTOCMD
once_already = 0;
#endif
return OK;
}
if (wtime == 0) /* Don't wait for char */
{
#ifdef FEAT_AUTOCMD
once_already = 0;
#endif
return FAIL;
}
/* Before waiting, flush any output to the screen. */
gui_mch_flush();
@ -2629,9 +2630,6 @@ gui_wait_for_chars(wtime)
gui_mch_start_blink();
retval = gui_mch_wait_for_chars(wtime);
gui_mch_stop_blink();
#ifdef FEAT_AUTOCMD
once_already = 0;
#endif
return retval;
}
@ -2640,53 +2638,36 @@ gui_wait_for_chars(wtime)
*/
gui_mch_start_blink();
#ifdef FEAT_AUTOCMD
/* If there is no character available within 2 seconds (default),
* write the autoscript file to disk */
if (once_already == 2)
{
updatescript(0);
retval = gui_mch_wait_for_chars(-1L);
once_already = 0;
}
else if (once_already == 1)
{
setcursor();
once_already = 2;
retval = 0;
}
else
#endif
if (gui_mch_wait_for_chars(p_ut) != OK)
{
#ifdef FEAT_AUTOCMD
if (has_cursorhold() && get_real_state() == NORMAL_BUSY)
{
apply_autocmds(EVENT_CURSORHOLD, NULL, NULL, FALSE, curbuf);
update_screen(VALID);
showruler(FALSE);
setcursor();
/* In case the commands moved the focus to another window
* (temporarily). */
if (need_mouse_correct)
gui_mouse_correct();
once_already = 1;
retval = 0;
}
else
#endif
{
updatescript(0);
retval = gui_mch_wait_for_chars(-1L);
#ifdef FEAT_AUTOCMD
once_already = 0;
#endif
}
}
else
retval = FAIL;
/*
* We may want to trigger the CursorHold event. First wait for
* 'updatetime' and if nothing is typed within that time put the
* K_CURSORHOLD key in the input buffer.
*/
if (gui_mch_wait_for_chars(p_ut) == OK)
retval = OK;
#ifdef FEAT_AUTOCMD
else if (!did_cursorhold && has_cursorhold()
&& get_real_state() == NORMAL_BUSY)
{
char_u buf[3];
/* Put K_CURSORHOLD in the input buffer. */
buf[0] = CSI;
buf[1] = KS_EXTRA;
buf[2] = (int)KE_CURSORHOLD;
add_to_input_buf(buf, 3);
retval = OK;
}
#endif
if (retval == FAIL)
{
/* Blocking wait. */
updatescript(0);
retval = gui_mch_wait_for_chars(-1L);
}
gui_mch_stop_blink();
return retval;
@ -4067,7 +4048,7 @@ gui_check_colors()
}
}
void
static void
gui_set_fg_color(name)
char_u *name;
{
@ -4075,7 +4056,7 @@ gui_set_fg_color(name)
hl_set_fg_color_name(vim_strsave(name));
}
void
static void
gui_set_bg_color(name)
char_u *name;
{

View File

@ -161,10 +161,11 @@ class VimWidget;
#define DRAW_TRANSP 0x01 /* draw with transparant bg */
#define DRAW_BOLD 0x02 /* draw bold text */
#define DRAW_UNDERL 0x04 /* draw underline text */
#define DRAW_UNDERC 0x08 /* draw undercurl text */
#if defined(RISCOS) || defined(HAVE_GTK2) || defined (FEAT_GUI_KDE)
# define DRAW_ITALIC 0x08 /* draw italic text */
# define DRAW_ITALIC 0x10 /* draw italic text */
#endif
#define DRAW_CURSOR 0x10 /* drawing block cursor (win32) */
#define DRAW_CURSOR 0x20 /* drawing block cursor (win32) */
/* For our own tearoff menu item */
#define TEAR_STRING "-->Detach"
@ -421,6 +422,7 @@ typedef struct Gui
# endif
GdkColor *fgcolor; /* GDK-styled foreground color */
GdkColor *bgcolor; /* GDK-styled background color */
GdkColor *spcolor; /* GDK-styled special color */
# ifndef HAVE_GTK2
GuiFont current_font;
# endif
@ -463,6 +465,7 @@ typedef struct Gui
GuiFont currFont; /* Current font */
guicolor_T currFgColor; /* Current foreground text color */
guicolor_T currBgColor; /* Current background text color */
guicolor_T currSpColor; /* Current special text color */
#endif
#ifdef FEAT_GUI_MAC

View File

@ -584,9 +584,6 @@ gui_mch_set_font(GuiFont font)
SelectFont(s_hdc, gui.currFont);
}
/*
* Set the current text foreground color.
*/
@ -610,6 +607,15 @@ gui_mch_set_bg_color(guicolor_T color)
SetBkColor(s_hdc, gui.currBgColor);
}
/*
* Set the current text special color.
*/
void
gui_mch_set_sp_color(guicolor_T color)
{
/* TODO */
}
void

View File

@ -244,6 +244,7 @@ enum key_extra
, KE_X2RELEASE
, KE_DROP /* DnD data is available */
, KE_CURSORHOLD /* CursorHold event */
};
/*
@ -463,6 +464,8 @@ enum key_extra
#define K_DROP TERMCAP2KEY(KS_EXTRA, KE_DROP)
#define K_CURSORHOLD TERMCAP2KEY(KS_EXTRA, KE_CURSORHOLD)
/* Bits for modifier mask */
/* 0x01 cannot be used, because the modifier must be 0x02 or higher */
#define MOD_MASK_SHIFT 0x02

View File

@ -172,6 +172,9 @@ static void nv_nbcmd __ARGS((cmdarg_T *cap));
#ifdef FEAT_DND
static void nv_drop __ARGS((cmdarg_T *cap));
#endif
#ifdef FEAT_AUTOCMD
static void nv_cursorhold __ARGS((cmdarg_T *cap));
#endif
/*
* Function to be called for a Normal or Visual mode command.
@ -434,6 +437,9 @@ static const struct nv_cmd
#ifdef FEAT_DND
{K_DROP, nv_drop, NV_STS, 0},
#endif
#ifdef FEAT_AUTOCMD
{K_CURSORHOLD, nv_cursorhold, 0, 0},
#endif
};
/* Number of commands in nv_cmds[]. */
@ -1077,6 +1083,9 @@ getcount:
if (need_flushbuf)
out_flush();
#endif
#ifdef FEAT_AUTOCMD
did_cursorhold = FALSE;
#endif
State = NORMAL;
@ -8652,3 +8661,20 @@ nv_drop(cap)
do_put('~', BACKWARD, 1L, PUT_CURSEND);
}
#endif
#ifdef FEAT_AUTOCMD
/*
* Trigger CursorHold event.
* When waiting for a character for 'updatetime' K_CURSORHOLD is put in the
* input buffer. "did_cursorhold" is set to avoid retriggering.
*/
/*ARGSUSED*/
static void
nv_cursorhold(cap)
cmdarg_T *cap;
{
apply_autocmds(EVENT_CURSORHOLD, NULL, NULL, FALSE, curbuf);
did_cursorhold = TRUE;
}
#endif

View File

@ -1323,9 +1323,6 @@ mch_inchar(
int len;
int c;
#ifdef FEAT_AUTOCMD
static int once_already = 0;
#endif
#define TYPEAHEADLEN 20
static char_u typeahead[TYPEAHEADLEN]; /* previously typed bytes. */
static int typeaheadlen = 0;
@ -1358,40 +1355,29 @@ mch_inchar(
if (time >= 0)
{
if (!WaitForChar(time)) /* no character available */
{
#ifdef FEAT_AUTOCMD
once_already = 0;
#endif
return 0;
}
}
else /* time == -1, wait forever */
{
mch_set_winsize_now(); /* Allow winsize changes from now on */
#ifdef FEAT_AUTOCMD
/* If there is no character available within 2 seconds (default),
* write the autoscript file to disk */
if (once_already == 2)
updatescript(0);
else if (once_already == 1)
{
setcursor();
once_already = 2;
return 0;
}
else
#endif
/*
* If there is no character available within 2 seconds (default)
* write the autoscript file to disk. Or cause the CursorHold event
* to be triggered.
*/
if (!WaitForChar(p_ut))
{
#ifdef FEAT_AUTOCMD
if (has_cursorhold() && get_real_state() == NORMAL_BUSY)
if (!did_cursorhold && has_cursorhold()
&& get_real_state() == NORMAL_BUSY && maxlen >= 3)
{
apply_autocmds(EVENT_CURSORHOLD, NULL, NULL, FALSE, curbuf);
update_screen(VALID);
once_already = 1;
return 0;
buf[0] = K_SPECIAL;
buf[1] = KS_EXTRA;
buf[2] = (int)KE_CURSORHOLD;
return 3;
}
else
#endif
updatescript(0);
}
@ -1528,10 +1514,6 @@ mch_inchar(
}
#endif
#ifdef FEAT_AUTOCMD
once_already = 0;
#endif
theend:
/* Move typeahead to "buf", as much as fits. */
len = 0;

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@ void gui_mch_free_fontset __ARGS((GuiFontset fontset));
guicolor_T gui_mch_get_color __ARGS((char_u *name));
void gui_mch_set_fg_color __ARGS((guicolor_T color));
void gui_mch_set_bg_color __ARGS((guicolor_T color));
void gui_mch_set_sp_color __ARGS((guicolor_T color));
void gui_mch_draw_string __ARGS((int row, int col, char_u *s, int len, int flags));
int gui_mch_haskey __ARGS((char_u *name));
int gui_get_x11_windis __ARGS((Window *win, Display **dis));

View File

@ -30,6 +30,7 @@ void gui_mch_new_colors __ARGS((void));
guicolor_T gui_mch_get_color __ARGS((char_u *name));
void gui_mch_set_fg_color __ARGS((guicolor_T color));
void gui_mch_set_bg_color __ARGS((guicolor_T color));
void gui_mch_set_sp_color __ARGS((guicolor_T color));
void gui_mch_invert_rectangle __ARGS((int row, int col, int nr, int nc));
void gui_mch_clear_block __ARGS((int row1, int col1, int row2, int col2));
void gui_mch_clear_all __ARGS((void));

View File

@ -61,6 +61,7 @@ void gui_mch_set_scrollbar_thumb __ARGS((scrollbar_T *sb, long val, long size, l
void gui_mch_set_font __ARGS((GuiFont font));
void gui_mch_set_fg_color __ARGS((guicolor_T color));
void gui_mch_set_bg_color __ARGS((guicolor_T color));
void gui_mch_set_sp_color __ARGS((guicolor_T color));
void gui_mch_draw_string __ARGS((int row, int col, char_u *text, int len, int flags));
void gui_mch_flush __ARGS((void));
void gui_mch_add_menu __ARGS((vimmenu_T *menu, int pos));

View File

@ -63,6 +63,7 @@ void gui_mch_set_scrollbar_thumb __ARGS((scrollbar_T *sb, long val, long size, l
void gui_mch_set_font __ARGS((GuiFont font));
void gui_mch_set_fg_color __ARGS((guicolor_T color));
void gui_mch_set_bg_color __ARGS((guicolor_T color));
void gui_mch_set_sp_color __ARGS((guicolor_T color));
void im_set_font __ARGS((LOGFONT *lf));
void im_set_position __ARGS((int row, int col));
void im_set_active __ARGS((int active));

View File

@ -346,10 +346,15 @@ typedef unsigned long long_u;
/*
* The characters and attributes cached for the screen.
* Currently a single byte. The attributes may become larger some day.
*/
#define schar_T char_u
#define sattr_T char_u
#ifdef FEAT_SYN_HL
typedef unsigned short sattr_T;
# define MAX_TYPENR 65535
#else
typedef unsigned char sattr_T;
# define MAX_TYPENR 255
#endif
/*
* The u8char_T can hold one decoded UTF-8 character.
@ -535,8 +540,9 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
#define HL_BOLD 0x02
#define HL_ITALIC 0x04
#define HL_UNDERLINE 0x08
#define HL_STANDOUT 0x10
#define HL_ALL 0x1f
#define HL_UNDERCURL 0x10
#define HL_STANDOUT 0x20
#define HL_ALL 0x3f
/* special attribute addition: Put message in history */
#define MSG_HIST 0x1000