diff options
author | Bram Moolenaar <Bram@vim.org> | 2004-07-26 12:53:41 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2004-07-26 12:53:41 +0000 |
commit | 5eb86f91992f5291b8b472d3e1be1888508777e6 (patch) | |
tree | 15dcd4c748c38e99951e79d02eb1b93f3a6d3db9 /src | |
parent | 89cb5e0f646970371359c70927bf3a0cdaf47f27 (diff) | |
download | vim-git-5eb86f91992f5291b8b472d3e1be1888508777e6.tar.gz |
updated for version 7.0012v7.0012
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 30 | ||||
-rw-r--r-- | src/buffer.c | 59 | ||||
-rw-r--r-- | src/edit.c | 8 | ||||
-rw-r--r-- | src/eval.c | 225 | ||||
-rw-r--r-- | src/ex_cmds2.c | 74 | ||||
-rw-r--r-- | src/gui_kde.cc | 2 | ||||
-rw-r--r-- | src/gui_kde_wid.cc (renamed from src/gui_kde_widget.cc) | 254 | ||||
-rw-r--r-- | src/gui_kde_wid.h (renamed from src/gui_kde_widget.h) | 6 | ||||
-rw-r--r-- | src/gui_kde_x11.cc | 2 | ||||
-rw-r--r-- | src/if_python.c | 17 | ||||
-rw-r--r-- | src/main.aap | 16 | ||||
-rw-r--r-- | src/memline.c | 13 | ||||
-rw-r--r-- | src/misc2.c | 5 | ||||
-rw-r--r-- | src/ops.c | 2 | ||||
-rw-r--r-- | src/os_mac.h | 14 | ||||
-rw-r--r-- | src/os_mac_conv.c | 3 | ||||
-rw-r--r-- | src/po/ru.cp1251.po | 6 | ||||
-rw-r--r-- | src/po/ru.po | 6 | ||||
-rw-r--r-- | src/search.c | 3 |
19 files changed, 503 insertions, 242 deletions
diff --git a/src/Makefile b/src/Makefile index e080477d6..fade47f35 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1055,9 +1055,9 @@ LINKIT = @echo >/dev/null NONE_INSTALL = install_normal ### KDE GUI interface. -KDE_SRC = gui.c pty.c gui_kde.cc gui_kde_x11.cc gui_kde_widget.cc gui_kde_widget_moc.cc kvim_iface_skel.cc +KDE_SRC = gui.c pty.c gui_kde.cc gui_kde_x11.cc gui_kde_wid.cc gui_kde_wid_moc.cc kvim_iface_skel.cc KDE_OBJ = objects/gui.o objects/pty.o objects/gui_kde.o objects/gui_kde_x11.o \ - objects/gui_kde_widget.o objects/gui_kde_widget_moc.o \ + objects/gui_kde_wid.o objects/gui_kde_wid_moc.o \ objects/kvim_iface_skel.o KDE_DEFS = -DFEAT_GUI_KDE $(NARROW_PROTO) KDE_IPATH = $(GUI_INC_LOC) @@ -1201,7 +1201,7 @@ CARBONGUI_BUNDLE = $(VIMNAME).app CARBONGUI_TESTARG = VIMPROG=../$(CARBONGUI_BUNDLE)/Contents/MacOS/$(VIMTARGET) # All GUI files -ALL_GUI_SRC = gui.c gui_gtk.c gui_gtk_f.c gui_motif.c gui_athena.c gui_gtk_x11.c gui_x11.c gui_at_sb.c gui_at_fs.c pty.c gui_kde.cc gui_kde_widget.cc gui_kde_x11.cc gui_kde_widget_moc.cc +ALL_GUI_SRC = gui.c gui_gtk.c gui_gtk_f.c gui_motif.c gui_athena.c gui_gtk_x11.c gui_x11.c gui_at_sb.c gui_at_fs.c pty.c gui_kde.cc gui_kde_wid.cc gui_kde_x11.cc gui_kde_wid_moc.cc ALL_GUI_PRO = gui.pro gui_gtk.pro gui_motif.pro gui_athena.pro gui_gtk_x11.pro gui_x11.pro gui_w16.pro gui_w32.pro gui_amiga.pro gui_photon.pro gui_kde.pro gui_kde_x11.pro # }}} @@ -2038,7 +2038,7 @@ clean celan: testclean -rm -f $(TOOLS) auto/osdef.h auto/pathdef.c auto/if_perl.c -rm -f conftest* *~ auto/link.sed -rm -rf $(GUI_BUNDLE) - -rm -f gui_kde_widget_moc.cc kvim_iface_skel.cc *.kidl + -rm -f gui_kde_wid_moc.cc kvim_iface_skel.cc *.kidl if test -d $(PODIR); then \ cd $(PODIR); $(MAKE) prefix=$(DESTDIR)$(prefix) clean; \ fi @@ -2393,17 +2393,17 @@ objects/gui_kde.o: gui_kde.cc objects/gui_kde_x11.o: gui_kde_x11.cc $(CCC) -o $@ gui_kde_x11.cc -objects/gui_kde_widget.o: gui_kde_widget.cc - $(MOC) -o gui_kde_widget_moc.cc gui_kde_widget.h +objects/gui_kde_wid.o: gui_kde_wid.cc + $(MOC) -o gui_kde_wid_moc.cc gui_kde_wid.h $(KDE_DIR)/bin/dcopidl kvim_iface.h > kvim_iface.kidl || ( rm -f kvim_iface.kidl ; /bin/false ) $(KDE_DIR)/bin/dcopidl2cpp --c++-suffix cc --no-stub kvim_iface.kidl - $(CCC) -o $@ gui_kde_widget.cc + $(CCC) -o $@ gui_kde_wid.cc -gui_kde_widget_moc.cc: objects/gui_kde_widget.o -objects/gui_kde_widget_moc.o: gui_kde_widget_moc.cc - $(CCC) -o $@ gui_kde_widget_moc.cc +gui_kde_wid_moc.cc: objects/gui_kde_wid.o +objects/gui_kde_wid_moc.o: gui_kde_wid_moc.cc + $(CCC) -o $@ gui_kde_wid_moc.cc -kvim_iface_skel.cc: objects/gui_kde_widget.o +kvim_iface_skel.cc: objects/gui_kde_wid.o objects/kvim_iface_skel.o: kvim_iface_skel.cc $(CCC) -o $@ kvim_iface_skel.cc @@ -2716,21 +2716,21 @@ objects/pty.o: pty.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h gui_beval.h \ proto/gui_beval.pro option.h ex_cmds.h proto.h globals.h farsi.h \ arabic.h -objects/gui_kde.o: gui_kde.cc gui_kde_widget.h kvim_iface.h vim.h \ +objects/gui_kde.o: gui_kde.cc gui_kde_wid.h kvim_iface.h vim.h \ auto/config.h feature.h os_unix.h auto/osdef.h ascii.h keymap.h \ term.h macros.h structs.h regexp.h gui.h option.h ex_cmds.h proto.h \ globals.h farsi.h -objects/gui_kde_widget.o: gui_kde_widget.cc gui_kde_widget.h kvim_iface.h \ +objects/gui_kde_wid.o: gui_kde_wid.cc gui_kde_wid.h kvim_iface.h \ vim.h auto/config.h feature.h os_unix.h auto/osdef.h ascii.h keymap.h \ term.h macros.h structs.h regexp.h gui.h option.h ex_cmds.h proto.h \ globals.h farsi.h proto/../../pixmaps/alert.xpm proto/../../pixmaps/error.xpm \ proto/../../pixmaps/generic.xpm proto/../../pixmaps/info.xpm \ proto/../../pixmaps/quest.xpm -objects/gui_kde_x11.o: gui_kde_x11.cc gui_kde_widget.h kvim_iface.h vim.h \ +objects/gui_kde_x11.o: gui_kde_x11.cc gui_kde_wid.h kvim_iface.h vim.h \ auto/config.h feature.h os_unix.h auto/osdef.h ascii.h keymap.h \ term.h macros.h structs.h regexp.h gui.h option.h ex_cmds.h proto.h \ globals.h farsi.h version.h ../runtime/vim32x32.xpm -objects/gui_kde_widget_moc.o: gui_kde_widget_moc.cc gui_kde_widget.h \ +objects/gui_kde_wid_moc.o: gui_kde_wid_moc.cc gui_kde_wid.h \ kvim_iface.h vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h option.h \ ex_cmds.h proto.h globals.h diff --git a/src/buffer.c b/src/buffer.c index 4d07eb63e..c2bc09473 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -216,6 +216,12 @@ open_buffer(read_stdin, eap) #endif curbuf->b_flags |= BF_READERR; +#ifdef FEAT_FOLDING + /* Need to update automatic folding. Do this before the autocommands, + * they may use the fold info. */ + foldUpdateAll(curwin); +#endif + #ifdef FEAT_AUTOCMD /* need to set w_topline, unless some autocommand already did that. */ if (!(curwin->w_valid & VALID_TOPLINE)) @@ -263,11 +269,6 @@ open_buffer(read_stdin, eap) #endif } -#ifdef FEAT_FOLDING - /* Need to update automatic folding. */ - foldUpdateAll(curwin); -#endif - return retval; } @@ -408,8 +409,7 @@ close_buffer(win, buf, action) if (!buf_valid(buf)) return; # ifdef FEAT_EVAL - /* Autocommands may abort script processing. */ - if (aborting()) + if (aborting()) /* autocmds may abort script processing */ return; # endif @@ -538,7 +538,8 @@ buf_freeall(buf, del_buf, wipe_buf) return; } # ifdef FEAT_EVAL - if (aborting()) /* autocmds may abort script processing */ + /* autocmds may abort script processing */ + if (aborting()) return; # endif @@ -669,8 +670,16 @@ goto_buffer(eap, start, dir, count) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)) if (swap_exists_action == SEA_QUIT && *eap->cmd == 's') { - /* Quitting means closing the split window, nothing else. */ + int old_got_int = got_int; + + /* Quitting means closing the split window, nothing else. + * Reset got_int here, because it causes aborting() to return TRUE + * which breaks closing a window. */ + got_int = FALSE; + win_close(curwin, TRUE); + + got_int |= old_got_int; swap_exists_action = SEA_NONE; } else @@ -688,6 +697,12 @@ goto_buffer(eap, start, dir, count) handle_swap_exists(old_curbuf) buf_T *old_curbuf; { + int old_got_int = got_int; + + /* Reset got_int here, because it causes aborting() to return TRUE which + * breaks closing a buffer. */ + got_int = FALSE; + if (swap_exists_action == SEA_QUIT) { /* User selected Quit at ATTENTION prompt. Go back to previous @@ -712,6 +727,7 @@ handle_swap_exists(old_curbuf) do_modelines(); } swap_exists_action = SEA_NONE; + got_int |= old_got_int; } #endif @@ -4226,26 +4242,28 @@ ex_buffer_all(eap) #endif set_curbuf(buf, DOBUF_GOTO); #ifdef FEAT_AUTOCMD -# ifdef FEAT_EVAL - /* Autocommands deleted the buffer or aborted script - * processing!!! */ - if (!buf_valid(buf) || aborting()) -# else if (!buf_valid(buf)) /* autocommands deleted the buffer!!! */ -# endif { -#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) +# if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) swap_exists_action = SEA_NONE; -#endif +# endif break; } #endif #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if (swap_exists_action == SEA_QUIT) { - /* User selected Quit at ATTENTION prompt; close this window. */ + int old_got_int = got_int; + + /* User selected Quit at ATTENTION prompt; close this window. + * Reset got_int here, because it causes aborting() to return + * TRUE which breaks closing a window. */ + got_int = FALSE; + win_close(curwin, TRUE); --open_wins; + + got_int |= old_got_int; swap_exists_action = SEA_NONE; } else @@ -4259,6 +4277,11 @@ ex_buffer_all(eap) (void)vgetc(); /* only break the file loading, not the rest */ break; } +#ifdef FEAT_EVAL + /* Autocommands deleted the buffer or aborted script processing!!! */ + if (aborting()) + break; +#endif } #ifdef FEAT_AUTOCMD --autocmd_no_enter; diff --git a/src/edit.c b/src/edit.c index 0ca698c3f..1e2aded13 100644 --- a/src/edit.c +++ b/src/edit.c @@ -2641,7 +2641,7 @@ ins_compl_next_buf(buf, flag) #ifdef FEAT_COMPL_FUNC static char_u *call_completefunc __ARGS((char_u *line, char_u *base, int col, int preproc)); -static int expand_by_function __ARGS((int lnum, int col, char_u *base, char_u ***matches)); +static int expand_by_function __ARGS((linenr_T lnum, int col, char_u *base, char_u ***matches)); /* * Execute user defined complete function 'completefunc'. @@ -2665,7 +2665,7 @@ call_completefunc(line, base, col, preproc) args[0] = line; args[1] = base; args[2] = colbuf; - args[3] = preproc ? "1" : "0"; + args[3] = (char_u *)(preproc ? "1" : "0"); return call_vim_function(curbuf->b_p_cfu, 4, args, FALSE); } @@ -2676,7 +2676,7 @@ call_completefunc(line, base, col, preproc) */ static int expand_by_function(lnum, col, base, matches) - int lnum; + linenr_T lnum; int col; char_u *base; char_u ***matches; @@ -3528,7 +3528,7 @@ ins_complete(c) lenstr = call_completefunc(line, NULL, complete_col, 1); if (lenstr == NULL) return FAIL; - keeplen = atoi(lenstr); + keeplen = atoi((char *)lenstr); vim_free(lenstr); if (keeplen < 0) return FAIL; diff --git a/src/eval.c b/src/eval.c index b2955ff11..78513a230 100644 --- a/src/eval.c +++ b/src/eval.c @@ -295,8 +295,10 @@ static void f_getcharmod __ARGS((VAR argvars, VAR retvar)); static void f_getcmdline __ARGS((VAR argvars, VAR retvar)); static void f_getcmdpos __ARGS((VAR argvars, VAR retvar)); static void f_getcwd __ARGS((VAR argvars, VAR retvar)); +static void f_getfperm __ARGS((VAR argvars, VAR retvar)); static void f_getfsize __ARGS((VAR argvars, VAR retvar)); static void f_getftime __ARGS((VAR argvars, VAR retvar)); +static void f_getftype __ARGS((VAR argvars, VAR retvar)); static void f_getline __ARGS((VAR argvars, VAR retvar)); static void f_getreg __ARGS((VAR argvars, VAR retvar)); static void f_getregtype __ARGS((VAR argvars, VAR retvar)); @@ -751,7 +753,7 @@ call_vim_function(func, argc, argv, safe) if (argv[i] == NULL || *argv[i] == NUL) { argvars[i].var_type = VAR_STRING; - argvars[i].var_val.var_string = ""; + argvars[i].var_val.var_string = (char_u *)""; continue; } @@ -2853,8 +2855,10 @@ static struct fst {"getcmdline", 0, 0, f_getcmdline}, {"getcmdpos", 0, 0, f_getcmdpos}, {"getcwd", 0, 0, f_getcwd}, + {"getfperm", 1, 1, f_getfperm}, {"getfsize", 1, 1, f_getfsize}, {"getftime", 1, 1, f_getftime}, + {"getftype", 1, 1, f_getftype}, {"getline", 1, 1, f_getline}, {"getreg", 0, 1, f_getreg}, {"getregtype", 0, 1, f_getregtype}, @@ -2941,7 +2945,7 @@ static struct fst {"wincol", 0, 0, f_wincol}, {"winheight", 1, 1, f_winheight}, {"winline", 0, 0, f_winline}, - {"winnr", 0, 0, f_winnr}, + {"winnr", 0, 1, f_winnr}, {"winrestcmd", 0, 0, f_winrestcmd}, {"winwidth", 1, 1, f_winwidth}, }; @@ -4578,6 +4582,38 @@ f_getcwd(argvars, retvar) } /* + * "getfperm({fname})" function + */ + static void +f_getfperm(argvars, retvar) + VAR argvars; + VAR retvar; +{ + char_u *fname; + struct stat st; + char_u *perm = NULL; + char_u flags[] = "rwx"; + int i; + + fname = get_var_string(&argvars[0]); + + retvar->var_type = VAR_STRING; + if (mch_stat((char *)fname, &st) >= 0) + { + perm = vim_strsave((char_u *)"---------"); + if (perm != NULL) + { + for (i = 0; i < 9; i++) + { + if (st.st_mode & (1 << (8 - i))) + perm[i] = flags[i % 3]; + } + } + } + retvar->var_val.var_string = perm; +} + +/* * "getfsize({fname})" function */ static void @@ -4623,6 +4659,86 @@ f_getftime(argvars, retvar) } /* + * "getftype({fname})" function + */ + static void +f_getftype(argvars, retvar) + VAR argvars; + VAR retvar; +{ + char_u *fname; + struct stat st; + char_u *type = NULL; + char *t; + + fname = get_var_string(&argvars[0]); + + retvar->var_type = VAR_STRING; + if (mch_lstat((char *)fname, &st) >= 0) + { +#ifdef S_ISREG + if (S_ISREG(st.st_mode)) + t = "file"; + else if (S_ISDIR(st.st_mode)) + t = "dir"; +# ifdef S_ISLNK + else if (S_ISLNK(st.st_mode)) + t = "link"; +# endif +# ifdef S_ISBLK + else if (S_ISBLK(st.st_mode)) + t = "bdev"; +# endif +# ifdef S_ISCHR + else if (S_ISCHR(st.st_mode)) + t = "cdev"; +# endif +# ifdef S_ISFIFO + else if (S_ISFIFO(st.st_mode)) + t = "fifo"; +# endif +# ifdef S_ISSOCK + else if (S_ISSOCK(st.st_mode)) + t = "fifo"; +# endif + else + t = "other"; +#else +# ifdef S_IFMT + switch (st.st_mode & S_IFMT) + { + case S_IFREG: t = "file"; break; + case S_IFDIR: t = "dir"; break; +# ifdef S_IFLNK + case S_IFLNK: t = "link"; break; +# endif +# ifdef S_IFBLK + case S_IFBLK: t = "bdev"; break; +# endif +# ifdef S_IFCHR + case S_IFCHR: t = "cdev"; break; +# endif +# ifdef S_IFIFO + case S_IFIFO: t = "fifo"; break; +# endif +# ifdef S_IFSOCK + case S_IFSOCK: t = "socket"; break; +# endif + default: t = "other"; + } +# else + if (mch_isdir(fname)) + t = "dir"; + else + t = "file"; +# endif +#endif + type = vim_strsave((char_u *)t); + } + retvar->var_val.var_string = type; +} + +/* * "getreg()" function */ static void @@ -6305,6 +6421,10 @@ f_simplify(argvars, retvar) retvar->var_type = VAR_STRING; } +#define SP_NOMOVE 1 /* don't move cursor */ +#define SP_REPEAT 2 /* repeat to find outer pair */ +#define SP_RETCOUNT 4 /* return matchcount */ + /* * "search()" function */ @@ -6315,13 +6435,24 @@ f_search(argvars, retvar) { char_u *pat; pos_T pos; + pos_T save_cursor; int save_p_ws = p_ws; int dir; + int flags = 0; + + retvar->var_val.var_number = 0; /* default: FAIL */ pat = get_var_string(&argvars[0]); - dir = get_search_arg(&argvars[1], NULL); /* may set p_ws */ + dir = get_search_arg(&argvars[1], &flags); /* may set p_ws */ + if (dir == 0) + goto theend; + if ((flags & ~SP_NOMOVE) != 0) + { + EMSG2(_(e_invarg2), get_var_string(&argvars[1])); + goto theend; + } - pos = curwin->w_cursor; + pos = save_cursor = curwin->w_cursor; if (searchit(curwin, curbuf, &pos, dir, pat, 1L, SEARCH_KEEP, RE_SEARCH) != FAIL) { @@ -6331,15 +6462,14 @@ f_search(argvars, retvar) * correct that here */ check_cursor(); } - else - retvar->var_val.var_number = 0; + + /* If 'n' flag is used: restore cursor position. */ + if (flags & SP_NOMOVE) + curwin->w_cursor = save_cursor; +theend: p_ws = save_p_ws; } -#define SP_NOMOVE 1 /* don't move cursor */ -#define SP_REPEAT 2 /* repeat to find outer pair */ -#define SP_RETCOUNT 4 /* return matchcount */ - /* * "searchpair()" function */ @@ -6393,6 +6523,8 @@ f_searchpair(argvars, retvar) /* Handle the optional fourth argument: flags */ dir = get_search_arg(&argvars[3], &flags); /* may set p_ws */ + if (dir == 0) + goto theend; /* Optional fifth argument: skip expresion */ if (argvars[3].var_type == VAR_UNKNOWN @@ -6474,6 +6606,11 @@ theend: p_cpo = save_cpo; } +/* + * Get flags for a search function. + * Possibly sets "p_ws". + * Returns BACKWARD, FORWARD or zero (for an error). + */ static int get_search_arg(varp, flagsp) VAR varp; @@ -6482,24 +6619,37 @@ get_search_arg(varp, flagsp) int dir = FORWARD; char_u *flags; char_u nbuf[NUMBUFLEN]; + int mask; if (varp->var_type != VAR_UNKNOWN) { flags = get_var_string_buf(varp, nbuf); - if (vim_strchr(flags, 'b') != NULL) - dir = BACKWARD; - if (vim_strchr(flags, 'w') != NULL) - p_ws = TRUE; - if (vim_strchr(flags, 'W') != NULL) - p_ws = FALSE; - if (flagsp != NULL) - { - if (vim_strchr(flags, 'n') != NULL) - *flagsp |= SP_NOMOVE; - if (vim_strchr(flags, 'r') != NULL) - *flagsp |= SP_REPEAT; - if (vim_strchr(flags, 'm') != NULL) - *flagsp |= SP_RETCOUNT; + while (*flags != NUL) + { + switch (*flags) + { + case 'b': dir = BACKWARD; break; + case 'w': p_ws = TRUE; break; + case 'W': p_ws = FALSE; break; + default: mask = 0; + if (flagsp != NULL) + switch (*flags) + { + case 'n': mask = SP_NOMOVE; break; + case 'r': mask = SP_REPEAT; break; + case 'm': mask = SP_RETCOUNT; break; + } + if (mask == 0) + { + EMSG2(_(e_invarg2), flags); + dir = 0; + } + else + *flagsp |= mask; + } + if (dir == 0) + break; + ++flags; } } return dir; @@ -7648,7 +7798,9 @@ f_tr(argvars, retvar) /* not multi-byte: fromstr and tostr must be the same length */ if (STRLEN(fromstr) != STRLEN(tostr)) { +#ifdef FEAT_MBYTE error: +#endif EMSG2(_(e_invarg2), fromstr); ga_clear(&ga); return; @@ -7859,9 +8011,30 @@ f_winnr(argvars, retvar) int nr = 1; #ifdef FEAT_WINDOWS win_T *wp; + win_T *twin = curwin; + char_u *arg; + + if (argvars[0].var_type != VAR_UNKNOWN) + { + arg = get_var_string(&argvars[0]); + if (STRCMP(arg, "$") == 0) + twin = lastwin; + else if (STRCMP(arg, "#") == 0) + { + twin = prevwin; + if (prevwin == NULL) + nr = 0; + } + else + { + EMSG2(_(e_invexpr2), arg); + nr = 0; + } + } - for (wp = firstwin; wp != curwin; wp = wp->w_next) - ++nr; + if (nr > 0) + for (wp = firstwin; wp != twin; wp = wp->w_next) + ++nr; #endif retvar->var_val.var_number = nr; } diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index d4cf86b82..b651f34a7 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -3806,6 +3806,7 @@ static struct prt_ps_font_S prt_ps_courier_font = {"Courier", "Courier-Bold", "Courier-Oblique", "Courier-BoldOblique"} }; +#ifdef FEAT_MBYTE /* Generic font metrics for multi-byte fonts */ static struct prt_ps_font_S prt_ps_mb_font = { @@ -3814,6 +3815,7 @@ static struct prt_ps_font_S prt_ps_mb_font = -250, 805, {NULL, NULL, NULL, NULL} }; +#endif /* Pointer to current font set being used */ static struct prt_ps_font_S* prt_ps_font; @@ -3822,8 +3824,8 @@ static struct prt_ps_font_S* prt_ps_font; * building CID font name */ struct prt_ps_encoding_S { - char_u *encoding; - char_u *cmap_encoding; + char *encoding; + char *cmap_encoding; int needs_charset; }; @@ -3834,6 +3836,8 @@ struct prt_ps_charset_S int has_charset; }; +#ifdef FEAT_MBYTE + #define CS_JIS_C_1978 (0x01) #define CS_JIS_X_1983 (0x02) #define CS_JIS_X_1990 (0x04) @@ -4017,6 +4021,7 @@ static struct prt_ps_mbfont_S prt_ps_mbfonts[] = "KS_X_1992" } }; +#endif /* FEAT_MBYTE */ struct prt_ps_resource_S { @@ -4076,7 +4081,7 @@ static char *prt_resource_types[] = struct prt_dsc_comment_S { - char_u *string; + char *string; int len; int type; }; @@ -4092,11 +4097,11 @@ struct prt_dsc_line_S #define SIZEOF_CSTR(s) (sizeof(s) - 1) struct prt_dsc_comment_S prt_dsc_table[] = { - {PRT_DSC_TITLE, SIZEOF_CSTR(PRT_DSC_TITLE), PRT_DSC_TITLE_TYPE}, + {PRT_DSC_TITLE, SIZEOF_CSTR(PRT_DSC_TITLE), PRT_DSC_TITLE_TYPE}, {PRT_DSC_VERSION, SIZEOF_CSTR(PRT_DSC_VERSION), - PRT_DSC_VERSION_TYPE}, + PRT_DSC_VERSION_TYPE}, {PRT_DSC_ENDCOMMENTS, SIZEOF_CSTR(PRT_DSC_ENDCOMMENTS), - PRT_DSC_ENDCOMMENTS_TYPE} + PRT_DSC_ENDCOMMENTS_TYPE} }; static void prt_write_file_raw_len __ARGS((char_u *buffer, int bytes)); @@ -4135,6 +4140,7 @@ static int prt_resfile_skip_nonws __ARGS((int offset)); static int prt_resfile_skip_ws __ARGS((int offset)); static int prt_next_dsc __ARGS((struct prt_dsc_line_S *p_dsc_line)); #ifdef FEAT_MBYTE +static int prt_build_cid_fontname __ARGS((int font, char_u *name, int name_len)); static void prt_def_cidfont __ARGS((char *new_name, int height, char *cidfont)); static int prt_match_encoding __ARGS((char *p_encoding, struct prt_ps_mbfont_S *p_cmap, struct prt_ps_encoding_S **pp_mbenc)); static int prt_match_charset __ARGS((char *p_charset, struct prt_ps_mbfont_S *p_cmap, struct prt_ps_charset_S **pp_mbchar)); @@ -5097,15 +5103,16 @@ prt_get_cpl() return (int)((prt_right_margin - prt_left_margin) / prt_char_width); } +#ifdef FEAT_MBYTE static int prt_build_cid_fontname(font, name, name_len) int font; - char *name; + char_u *name; int name_len; { char *fontname; - fontname = alloc(name_len + 1); + fontname = (char *)alloc(name_len + 1); if (fontname == NULL) return FALSE; STRNCPY(fontname, name, name_len); @@ -5114,6 +5121,7 @@ prt_build_cid_fontname(font, name, name_len) return TRUE; } +#endif /* * Get number of lines of text that fit on a page (excluding the header). @@ -5152,13 +5160,13 @@ prt_get_lpp() #ifdef FEAT_MBYTE static int prt_match_encoding(p_encoding, p_cmap, pp_mbenc) - char *p_encoding; - struct prt_ps_mbfont_S *p_cmap; - struct prt_ps_encoding_S **pp_mbenc; + char *p_encoding; + struct prt_ps_mbfont_S *p_cmap; + struct prt_ps_encoding_S **pp_mbenc; { - int mbenc; - int enc_len; - struct prt_ps_encoding_S *p_mbenc; + int mbenc; + int enc_len; + struct prt_ps_encoding_S *p_mbenc; *pp_mbenc = NULL; /* Look for recognised encoding */ @@ -5178,12 +5186,12 @@ prt_match_encoding(p_encoding, p_cmap, pp_mbenc) static int prt_match_charset(p_charset, p_cmap, pp_mbchar) - char *p_charset; - struct prt_ps_mbfont_S *p_cmap; + char *p_charset; + struct prt_ps_mbfont_S *p_cmap; struct prt_ps_charset_S **pp_mbchar; { - int mbchar; - int char_len; + int mbchar; + int char_len; struct prt_ps_charset_S *p_mbchar; /* Look for recognised character set, using default if one is not given */ @@ -5226,7 +5234,7 @@ mch_print_init(psettings, jobname, forceit) char_u *p_encoding; struct prt_ps_encoding_S *p_mbenc; struct prt_ps_encoding_S *p_mbenc_first; - struct prt_ps_charset_S *p_mbchar; + struct prt_ps_charset_S *p_mbchar; #endif #if 0 @@ -5262,11 +5270,13 @@ mch_print_init(psettings, jobname, forceit) p_mbenc_first = NULL; p_mbchar = NULL; for (cmap = 0; cmap < NUM_ELEMENTS(prt_ps_mbfonts); cmap++) - if (prt_match_encoding(p_encoding, &prt_ps_mbfonts[cmap], &p_mbenc)) + if (prt_match_encoding((char *)p_encoding, &prt_ps_mbfonts[cmap], + &p_mbenc)) { if (p_mbenc_first == NULL) p_mbenc_first = p_mbenc; - if (prt_match_charset(p_pmcs, &prt_ps_mbfonts[cmap], &p_mbchar)) + if (prt_match_charset((char *)p_pmcs, &prt_ps_mbfonts[cmap], + &p_mbchar)) break; } @@ -5343,8 +5353,8 @@ mch_print_init(psettings, jobname, forceit) return FALSE; if (mbfont_opts[OPT_MBFONT_BOLDOBLIQUE].present) if (!prt_build_cid_fontname(PRT_PS_FONT_BOLDOBLIQUE, - mbfont_opts[OPT_MBFONT_BOLDOBLIQUE].string, - mbfont_opts[OPT_MBFONT_BOLDOBLIQUE].strlen)) + mbfont_opts[OPT_MBFONT_BOLDOBLIQUE].string, + mbfont_opts[OPT_MBFONT_BOLDOBLIQUE].strlen)) return FALSE; /* Check if need to use Courier for ASCII code range, and if so pick up @@ -5555,8 +5565,8 @@ prt_add_resource(resource) EMSG2(_("E456: Can't open file \"%s\""), resource->filename); return FALSE; } - prt_dsc_resources("BeginResource", - prt_resource_types[resource->type], resource->title); + prt_dsc_resources("BeginResource", prt_resource_types[resource->type], + (char *)resource->title); prt_dsc_textline("BeginDocument", (char *)resource->filename); @@ -5602,7 +5612,7 @@ mch_print_begin(psettings) double bottom; struct prt_ps_resource_S res_prolog; struct prt_ps_resource_S res_encoding; - char_u buffer[256]; + char buffer[256]; char_u *p_encoding; #ifdef FEAT_MBYTE struct prt_ps_resource_S res_cidfont; @@ -5614,7 +5624,7 @@ mch_print_begin(psettings) */ prt_dsc_start(); prt_dsc_textline("Title", (char *)psettings->jobname); - if (!get_user_name(buffer, 256)) + if (!get_user_name((char_u *)buffer, 256)) STRCPY(buffer, "Unknown"); prt_dsc_textline("For", buffer); prt_dsc_textline("Creator", VIM_VERSION_LONG); @@ -5757,7 +5767,7 @@ mch_print_begin(psettings) if (!prt_find_resource(prt_ascii_encoding, &res_encoding)) { EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), - prt_ascii_encoding); + prt_ascii_encoding); return FALSE; } if (!prt_open_resource(&res_encoding)) @@ -5786,7 +5796,7 @@ mch_print_begin(psettings) if (!prt_find_resource(prt_cmap, &res_cmap)) { EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), - prt_cmap); + prt_cmap); return FALSE; } if (!prt_open_resource(&res_cmap)) @@ -5911,7 +5921,7 @@ mch_print_begin(psettings) /* When using Courier for ASCII range when printing multi-byte, need to * pick up ASCII encoding to use with it. */ if (prt_use_courier) - p_encoding = prt_ascii_encoding; + p_encoding = (char_u *)prt_ascii_encoding; #endif prt_dsc_resources("IncludeResource", "font", prt_ps_courier_font.ps_fontname[PRT_PS_FONT_ROMAN]); @@ -6015,7 +6025,7 @@ mch_print_end(psettings) /* Write CTRL-D to close serial communication link if used. * NOTHING MUST BE WRITTEN AFTER THIS! */ - prt_write_file(IF_EB("\004", "\067")); + prt_write_file((char_u *)IF_EB("\004", "\067")); if (!prt_file_error && psettings->outfile == NULL && !got_int && !psettings->user_abort) @@ -6274,7 +6284,7 @@ mch_print_text_out(p, len) */ do { - ch = prt_hexchar[(*p) >> 4]; + ch = prt_hexchar[(unsigned)(*p) >> 4]; ga_append(&prt_ps_buffer, ch); ch = prt_hexchar[(*p) & 0xf]; ga_append(&prt_ps_buffer, ch); diff --git a/src/gui_kde.cc b/src/gui_kde.cc index 772e45792..2be18b9b7 100644 --- a/src/gui_kde.cc +++ b/src/gui_kde.cc @@ -29,7 +29,7 @@ #include <qmessagebox.h> #include <qiconset.h> #include <qtextcodec.h> -#include "gui_kde_widget.h" +#include "gui_kde_wid.h" extern "C" { #include "vim.h" diff --git a/src/gui_kde_widget.cc b/src/gui_kde_wid.cc index ae48abfe0..91ea10be1 100644 --- a/src/gui_kde_widget.cc +++ b/src/gui_kde_wid.cc @@ -43,10 +43,11 @@ #include <kmenubar.h> #include <ktoolbar.h> #include <kstandarddirs.h> -#include "gui_kde_widget.h" +#include "gui_kde_wid.h" #include <qxembed.h> -extern "C" { +extern "C" +{ #include "version.h" } @@ -187,25 +188,19 @@ void VimWidget::mousePressEvent(QMouseEvent *event)//{{{ ButtonState buttons = event->button(); //Look at button states - if(buttons & QMouseEvent::LeftButton) { - button|=MOUSE_LEFT; - } - if(buttons & QMouseEvent::RightButton) { - button|=MOUSE_RIGHT; - } - if(buttons & QMouseEvent::MidButton) { - button|=MOUSE_MIDDLE; - } + if (buttons & QMouseEvent::LeftButton) + button |= MOUSE_LEFT; + if (buttons & QMouseEvent::RightButton) + button |= MOUSE_RIGHT; + if (buttons & QMouseEvent::MidButton) + button |= MOUSE_MIDDLE; //Look for keyboard modifiers - if(state & QMouseEvent::ShiftButton) { - modifiers|=MOUSE_SHIFT; - } - if(state & QMouseEvent::ControlButton){ - modifiers|=MOUSE_CTRL; - } - if(state & QMouseEvent::AltButton){ - modifiers|=MOUSE_ALT; - } + if (state & QMouseEvent::ShiftButton) + modifiers |= MOUSE_SHIFT; + if (state & QMouseEvent::ControlButton) + modifiers |= MOUSE_CTRL; + if (state & QMouseEvent::AltButton) + modifiers |= MOUSE_ALT; gui_send_mouse_event(button,event->x(),event->y(),FALSE,modifiers); #if QT_VERSION>=300 QByteArray params; @@ -254,11 +249,11 @@ void VimMainWindow::wheelEvent (QWheelEvent *event)//{{{ button|=MOUSE_4; else button|=MOUSE_5; - if(state & ShiftButton) + if (state & ShiftButton) modifiers|=MOUSE_SHIFT; - if(state & ControlButton) + if (state & ControlButton) modifiers|=MOUSE_CTRL; - if(state & AltButton) + if (state & AltButton) modifiers|=MOUSE_ALT; gui_send_mouse_event(button,event->x(),event->y(),FALSE,modifiers); @@ -279,19 +274,19 @@ void VimWidget::mouseDoubleClickEvent(QMouseEvent *event)//{{{ int button=0; //Look at button states - if(buttons & LeftButton) + if (buttons & LeftButton) button|=MOUSE_LEFT; - if(buttons & RightButton) + if (buttons & RightButton) button|=MOUSE_RIGHT; - if(buttons & MidButton) + if (buttons & MidButton) button|=MOUSE_MIDDLE; //Look for keyboard modifiers - if(state & ShiftButton) + if (state & ShiftButton) modifiers|=MOUSE_SHIFT; - if(state & ControlButton) + if (state & ControlButton) modifiers|=MOUSE_CTRL; - if(state & AltButton) + if (state & AltButton) modifiers|=MOUSE_ALT; gui_send_mouse_event(button,event->x(),event->y(),TRUE,modifiers); @@ -313,15 +308,15 @@ void VimWidget::mouseMoveEvent(QMouseEvent *event){//{{{ //Look at button states //warning: we use state here, this is important ! - if(state & QMouseEvent::LeftButton || state & QMouseEvent::RightButton || state & QMouseEvent::MidButton) + if (state & QMouseEvent::LeftButton || state & QMouseEvent::RightButton || state & QMouseEvent::MidButton) button|=MOUSE_DRAG; //Look for keyboard modifiers - if(state & ShiftButton) + if (state & ShiftButton) modifiers|=MOUSE_SHIFT; - if(state & ControlButton) + if (state & ControlButton) modifiers|=MOUSE_CTRL; - if(state & AltButton) + if (state & AltButton) modifiers|=MOUSE_ALT; if (button!=MOUSE_DRAG) gui_mouse_moved(event->x(),event->y()); @@ -335,11 +330,11 @@ void VimWidget::mouseReleaseEvent(QMouseEvent *event)//{{{ int modifiers=0; //Look for keyboard modifiers - if(state & ShiftButton) + if (state & ShiftButton) modifiers|=MOUSE_SHIFT; - if(state & ControlButton) + if (state & ControlButton) modifiers|=MOUSE_CTRL; - if(state & AltButton) + if (state & AltButton) modifiers|=MOUSE_ALT; gui_send_mouse_event(MOUSE_RELEASE,event->x(),event->y(),FALSE,modifiers); @@ -454,21 +449,25 @@ void VimWidget::dropEvent (QDropEvent *e) // {{{ /* Count how many items there may be and normalize delimiters. */ - if (QUriDrag::decode(e, urls)) { + if (QUriDrag::decode(e, urls)) + { n = urls.count(); fnames = (char_u **)lalloc((n+1) * sizeof(char_u *), TRUE); nfiles = 0; #if QT_VERSION>=300 QPtrListIterator<char> it(urls); - for( ; it.current(); ++it ) { + for (; it.current(); ++it ) + { KURL u(*it); #else - for (i=0;i<urls.count();++i) { + for (i=0;i<urls.count();++i) + { KURL u(urls.at(i)); #endif if ( !u.isLocalFile() ) url = TRUE; - else { + else + { fnames[nfiles] = (char_u *)strdup((const char *)u.path()); ++nfiles; } @@ -488,7 +487,9 @@ void VimWidget::dropEvent (QDropEvent *e) // {{{ redo_dirs = TRUE; } } - } else { + } + else + { /* Ignore any directories */ for (i = 0; i < nfiles; ++i) { @@ -505,7 +506,9 @@ void VimWidget::dropEvent (QDropEvent *e) // {{{ /* Shift held down, change to first file's directory */ if (fnames[0] != NULL && vim_chdirfile(fnames[0]) == OK) redo_dirs = TRUE; - } else { + } + else + { char_u dirname[MAXPATHL]; char_u *s; if (mch_dirname(dirname, MAXPATHL) == OK) @@ -561,7 +564,8 @@ void gui_keypress(QKeyEvent *e) { // {{{ // ignore certain keys if (key == Qt::Key_Shift || key == Qt::Key_Alt || key == Qt::Key_Control || key == Qt::Key_Meta - || key == Qt::Key_CapsLock || key == Qt::Key_NumLock || key == Qt::Key_ScrollLock ) { + || key == Qt::Key_CapsLock || key == Qt::Key_NumLock || key == Qt::Key_ScrollLock ) + { e->ignore(); return; } @@ -591,13 +595,13 @@ void gui_keypress(QKeyEvent *e) { // {{{ // change shift-tab (backtab) into S_TAB - if ( key == Qt::Key_BackTab && state & Qt::ShiftButton) { + if ( key == Qt::Key_BackTab && state & Qt::ShiftButton) key = Qt::Key_Tab; - } // Change C-@ and C-2 in NUL ? Gtk does this if ( (key == Qt::Key_2 || key == Qt::Key_At) - && state & Qt::ControlButton ) { + && state & Qt::ControlButton ) + { string[0] = NUL; len = 1; } @@ -639,7 +643,8 @@ void gui_keypress(QKeyEvent *e) { // {{{ if (len == 0 || key == Qt::Key_BackSpace || key == Qt::Key_Delete) { while (special_keys[i].qtkey != 0 && special_keys[i].qtkey != key ) i++; - if (special_keys[i].qtkey != 0) { + if (special_keys[i].qtkey != 0) + { string[0] = CSI; string[1] = special_keys[i].code0; string[2] = special_keys[i].code1; @@ -648,7 +653,8 @@ void gui_keypress(QKeyEvent *e) { // {{{ /* for (i = 0; special_keys[i].qtkey != 0 ; i++) { - if (special_keys[i].qtkey == key ) { + if (special_keys[i].qtkey == key ) + { string[0] = CSI; string[1] = special_keys[i].code0; string[2] = special_keys[i].code1; @@ -658,7 +664,8 @@ void gui_keypress(QKeyEvent *e) { // {{{ }*/ } - if (len == 0) { + if (len == 0) + { //no need to dump that, that's a QT problem, we can't do anything //dbf("Unrecognised Key : %X %s", key, e->text().latin1()); e->ignore(); @@ -669,7 +676,8 @@ void gui_keypress(QKeyEvent *e) { // {{{ /* Special keys (and a few others) may have modifiers */ if (len == -3 || key == Qt::Key_Space || key == Qt::Key_Tab || key == Qt::Key_Return || key == Qt::Key_Enter || - key == Qt::Key_Escape) { + key == Qt::Key_Escape) + { modifiers = 0; if (state & Qt::ShiftButton) modifiers |= MOD_MASK_SHIFT; @@ -689,18 +697,22 @@ void gui_keypress(QKeyEvent *e) { // {{{ key = simplify_key(key, &modifiers); if (key == CSI) key=K_CSI; - if (IS_SPECIAL(key)) { + if (IS_SPECIAL(key)) + { string[0] = CSI; string[1] = K_SECOND(key); string[2] = K_THIRD(key); len = 3; - } else { + } + else + { string[0] = key; len = 1; } - if (modifiers!=0) { + if (modifiers!=0) + { uchar string2[10]; string2[0] = CSI; string2[1] = KS_MODIFIER; @@ -718,9 +730,9 @@ void gui_keypress(QKeyEvent *e) { // {{{ } add_to_input_buf(string, len); - if (p_mh) { + if (p_mh) gui_mch_mousehide(TRUE); - } + //DCOP Embedding stuff //if we are here then the user has type something in the window, thus we can easily imagine that : // 1 - text has changed (emit textChanged()) @@ -744,21 +756,24 @@ void gui_keypress(QKeyEvent *e) { // {{{ #ifdef FEAT_CLIENTSERVER void VimWidget::serverActivate(WId id) //{{{ { - if (serverName == NULL && serverDelayedStartName != NULL) { + if (serverName == NULL && serverDelayedStartName != NULL) + { commWindow = id; (void)serverRegisterName(qt_xdisplay(), serverDelayedStartName); - } else { - serverChangeRegisteredWindow( qt_xdisplay(), id ); } + else + serverChangeRegisteredWindow( qt_xdisplay(), id); }//}}} #endif #ifdef FEAT_XIM -void VimWidget::imStartEvent(QIMEvent *e) { +void VimWidget::imStartEvent(QIMEvent *e) +{ e->accept(); } -void VimWidget::imEndEvent(QIMEvent *e) { +void VimWidget::imEndEvent(QIMEvent *e) +{ uchar string[256]; QCString unistring = vmw->codec->fromUnicode(e->text()); @@ -771,7 +786,8 @@ void VimWidget::imEndEvent(QIMEvent *e) { e->accept(); } -void VimWidget::imComposeEvent(QIMEvent *e) { +void VimWidget::imComposeEvent(QIMEvent *e) +{ //i should do something here, displaying the text somewhere ... (status area ?) e->accept(); } @@ -851,7 +867,8 @@ void VimWidget::start_cursor_blinking()//{{{ if (blink_timer.isActive()) blink_timer.stop(); /* Only switch blinking on if none of the times is zero */ - if (blink_wait_time && blink_on_time && blink_off_time && gui.in_focus) { + if (blink_wait_time && blink_on_time && blink_off_time && gui.in_focus) + { blink_state = BLINK_ON; gui_update_cursor(TRUE, FALSE); // The first blink appears after wait_time @@ -861,12 +878,15 @@ void VimWidget::start_cursor_blinking()//{{{ void VimWidget::blink_cursor()//{{{ { - if (blink_state == BLINK_ON) { + if (blink_state == BLINK_ON) + { // set cursor off gui_undraw_cursor(); blink_state = BLINK_OFF; blink_timer.start( blink_off_time, true); - } else { + } + else + { // set cursor on gui_update_cursor(TRUE, FALSE); blink_state = BLINK_ON; @@ -926,7 +946,8 @@ void VimWidget::flash()//{{{ #ifdef FEAT_CLIENTSERVER oldFilter = qt_set_x11_event_filter( kvim_x11_event_filter ); #endif - if (echo_wid_arg== 1) { + if (echo_wid_arg== 1) + { fprintf(stderr, "WID: %ld\n", (long)winId()); fflush(stderr); } @@ -988,26 +1009,23 @@ void VimMainWindow::menu_activated(int dx)//{{{ void VimMainWindow::clipboard_selection_update(){//{{{ - if(kapp->clipboard()->ownsSelection()) { + if (kapp->clipboard()->ownsSelection()) clip_own_selection(&clip_star); - } else { + else clip_lose_selection(&clip_star); - } }//}}} void VimMainWindow::clipboard_data_update(){//{{{ #if QT_VERSION>=300 - if (kapp->clipboard()->ownsClipboard()) { + if (kapp->clipboard()->ownsClipboard()) clip_own_selection(&clip_plus); - } else { + else clip_lose_selection(&clip_plus); - } #else - if (kapp->clipboard()->ownsSelection()) { + if (kapp->clipboard()->ownsSelection()) clip_own_selection(&clip_star); - } else { + else clip_lose_selection(&clip_star); - } #endif }//}}} @@ -1182,17 +1200,20 @@ Vim releases instead of the text that was included with it."); about->show(); }//}}} -void VimMainWindow::showTipOfTheDay() { +void VimMainWindow::showTipOfTheDay() +{ #if QT_VERSION>=300 KTipDialog::showTip (vmw,QString::null,true); #endif } -void VimMainWindow::buffersToolbar() { +void VimMainWindow::buffersToolbar() +{ } -void VimMainWindow::showBugReport() { +void VimMainWindow::showBugReport() +{ KBugReport *bug= new KBugReport(this,true); bug->show(); } @@ -1217,7 +1238,8 @@ VimDialog::VimDialog (int type, /* type of dialog *///{{{ * Create Icon */ char ** icon_data; - switch (type) { + switch (type) + { case VIM_GENERIC: icon_data = generic_xpm; break; @@ -1255,25 +1277,29 @@ VimDialog::VimDialog (int type, /* type of dialog *///{{{ hly1->addWidget( icon ); hly1->addWidget( text ); QHBoxLayout * hly3 = new QHBoxLayout ( vly , 5); - if (textfield!=NULL) { + if (textfield!=NULL) + { entry = new QLineEdit((const char *)textfield,this); entry->setText((const char *)textfield); hly3->addWidget( entry ); ret=textfield; - } else entry=NULL; + } + else + entry=NULL; QHBoxLayout * hly2 = new QHBoxLayout( vly, 15); QString s; QPushButton * pushButton = 0L; - for( int i=0; i<butNb; i++) { + for (int i=0; i<butNb; i++) + { s = buttonText[i]; pushButton = new QPushButton(s, this ); - if (s.find('&') != -1) { - pushButton->setAccel( s.at(s.find('&')+1).latin1() ); - } + if (s.find('&') != -1) + pushButton->setAccel(s.at(s.find('&')+1).latin1()); hly2->addWidget( pushButton ); - if (i == def_but-1) { + if (i == def_but-1) + { pushButton->setDefault( true ); pushButton->setAutoDefault( true ); setResult( i+1 ); @@ -1288,12 +1314,16 @@ VimDialog::VimDialog (int type, /* type of dialog *///{{{ vly->activate(); }//}}} -void VimDialog::done(int r) { - if (entry!=NULL) { - if (r) { +void VimDialog::done(int r) +{ + if (entry!=NULL) + { + if (r) + { QCString unistring=vmw->codec->fromUnicode(entry->text()); STRCPY(ret,(const char*)unistring); - } else + } + else *ret=NUL; } QDialog::done(r); @@ -1311,7 +1341,8 @@ SBPool::SBPool(void)//{{{ void SBPool::create(GuiScrollbar * sb, int orient)//{{{ { - switch(orient) { + switch(orient) + { case SBAR_HORIZ: sb->w = new QScrollBar(QScrollBar::Horizontal, vmw); break; @@ -1349,9 +1380,8 @@ static int kvim_x11_event_filter( XEvent* e)//{{{ if (e->xproperty.type == PropertyNotify && e->xproperty.atom == commProperty && e->xproperty.window == commWindow - && e->xproperty.state == PropertyNewValue ) { + && e->xproperty.state == PropertyNewValue) serverEventProc(qt_xdisplay(), e); - } if (oldFilter) return oldFilter( e ); return FALSE; @@ -1381,29 +1411,31 @@ bool KVimUtils::fromString(QFont *f, QString descrip) QStringList l(QStringList::split(',', descrip)); int count = l.count(); - if (count != 10 && count != 9) { + if (count != 10 && count != 9) return FALSE; - } f->setFamily(l[0]); f->setPointSize(l[1].toInt()); - if ( count == 9 ) { - f->setStyleHint((QFont::StyleHint) l[2].toInt()); - f->setWeight(l[3].toInt()); - f->setItalic(l[4].toInt()); - f->setUnderline(l[5].toInt()); - f->setStrikeOut(l[6].toInt()); - f->setFixedPitch(l[7].toInt()); - f->setRawMode(l[8].toInt()); - } else { - f->setPixelSize(l[2].toInt()); - f->setStyleHint((QFont::StyleHint) l[3].toInt()); - f->setWeight(l[4].toInt()); - f->setItalic(l[5].toInt()); - f->setUnderline(l[6].toInt()); - f->setStrikeOut(l[7].toInt()); - f->setFixedPitch(l[8].toInt()); - f->setRawMode(l[9].toInt()); + if ( count == 9 ) + { + f->setStyleHint((QFont::StyleHint) l[2].toInt()); + f->setWeight(l[3].toInt()); + f->setItalic(l[4].toInt()); + f->setUnderline(l[5].toInt()); + f->setStrikeOut(l[6].toInt()); + f->setFixedPitch(l[7].toInt()); + f->setRawMode(l[8].toInt()); + } + else + { + f->setPixelSize(l[2].toInt()); + f->setStyleHint((QFont::StyleHint) l[3].toInt()); + f->setWeight(l[4].toInt()); + f->setItalic(l[5].toInt()); + f->setUnderline(l[6].toInt()); + f->setStrikeOut(l[7].toInt()); + f->setFixedPitch(l[8].toInt()); + f->setRawMode(l[9].toInt()); } return TRUE; } diff --git a/src/gui_kde_widget.h b/src/gui_kde_wid.h index d84544656..39102daa5 100644 --- a/src/gui_kde_widget.h +++ b/src/gui_kde_wid.h @@ -96,14 +96,14 @@ public: void disable_mzscheme_threads(); #endif void flash(); - + /** DCOP */ void execNormal(QString command); void execInsert(QString command); void execRaw(QString command); void execCmd(QString command); QString eval(QString expr); - + bool wait_done; BlinkState blink_state; QPainter *painter; @@ -134,7 +134,7 @@ protected: /* wait for input */ QTimer wait_timer; - + #ifdef FEAT_MZSCHEME int mzscheme_timer_id; #endif diff --git a/src/gui_kde_x11.cc b/src/gui_kde_x11.cc index c0aec8909..6517cd2f8 100644 --- a/src/gui_kde_x11.cc +++ b/src/gui_kde_x11.cc @@ -45,7 +45,7 @@ #include <qfont.h> -#include "gui_kde_widget.h" +#include "gui_kde_wid.h" extern "C" { diff --git a/src/if_python.c b/src/if_python.c index 21c436520..8f4fdfd19 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -2731,6 +2731,7 @@ StringToLine(PyObject *obj) char *save; int len; int i; + char *p; if (obj == NULL || !PyString_Check(obj)) { @@ -2741,14 +2742,22 @@ StringToLine(PyObject *obj) str = PyString_AsString(obj); len = PyString_Size(obj); - /* Error checking: String must not contain newlines, as we + /* + * Error checking: String must not contain newlines, as we * are replacing a single line, and we must replace it with * a single line. + * A trailing newline is removed, so that append(f.readlines()) works. */ - if (memchr(str, '\n', len)) + p = memchr(str, '\n', len); + if (p != NULL) { - PyErr_SetVim(_("string cannot contain newlines")); - return NULL; + if (p == str + len - 1) + --len; + else + { + PyErr_SetVim(_("string cannot contain newlines")); + return NULL; + } } /* Create a copy of the string, with internal nulls replaced by diff --git a/src/main.aap b/src/main.aap index 8c243cad1..3b785795e 100644 --- a/src/main.aap +++ b/src/main.aap @@ -100,9 +100,9 @@ prefix = `os.path.expanduser(prefix)` GUI_TESTTARGET = gui KDE GUI_SRC = gui.c pty.c gui_kde.cc gui_kde_x11.cc - gui_kde_widget_moc.cc + gui_kde_wid_moc.cc kvim_iface_skel.cc - GUI_OBJ = $BDIR/gui_kde_widget.o + GUI_OBJ = $BDIR/gui_kde_wid.o GUI_DEFS = -DFEAT_GUI_KDE $NARROW_PROTO GUI_IPATH = $GUI_INC_LOC GUI_LIBS_DIR = $GUI_LIB_LOC @@ -218,7 +218,7 @@ test check: testclean {virtual}: :del {force} testdir/*.out testdir/test.log -CLEANFILES += gui_kde_widget_moc.cc kvim_iface_skel.cc *.kidl +CLEANFILES += gui_kde_wid_moc.cc kvim_iface_skel.cc *.kidl # When no fetch target exists we are not a child of the ../main.aap recipe, # Use ../main.aap to do the fetching. @@ -356,18 +356,18 @@ auto/if_perl.c: if_perl.xs :sys $PERL $PERLLIB/ExtUtils/xsubpp -prototypes -typemap \ $PERLLIB/ExtUtils/typemap if_perl.xs >> $target -$BDIR/gui_kde_widget.o: gui_kde_widget.cc - :sys $MOC -o gui_kde_widget_moc.cc gui_kde_widget.h +$BDIR/gui_kde_wid.o: gui_kde_wid.cc + :sys $MOC -o gui_kde_wid_moc.cc gui_kde_wid.h @try: :sys $KDE_PREFIX/bin/dcopidl kvim_iface.h > kvim_iface.kidl @except: :del {f} kvim_iface.kidl :sys $KDE_PREFIX/bin/dcopidl2cpp --c++-suffix cc --no-stub kvim_iface.kidl - :do compile gui_kde_widget.cc + :do compile gui_kde_wid.cc -gui_kde_widget_moc.cc: $BDIR/gui_kde_widget.o +gui_kde_wid_moc.cc: $BDIR/gui_kde_wid.o -kvim_iface_skel.cc: $BDIR/gui_kde_widget.o +kvim_iface_skel.cc: $BDIR/gui_kde_wid.o auto/osdef.h: auto/config.h osdef.sh osdef1.h.in osdef2.h.in diff --git a/src/memline.c b/src/memline.c index 176705392..67d233b9e 100644 --- a/src/memline.c +++ b/src/memline.c @@ -4338,8 +4338,17 @@ ml_find_line_or_offset(buf, line, offp) curline = buf->b_ml.ml_locked_high + 1; } - if (ffdos) - size += line - 1; + if (line != 0) + { + /* Count extra CR characters. */ + if (ffdos) + size += line - 1; + + /* Don't count the last line break if 'bin' and 'noeol'. */ + if (buf->b_p_bin && !buf->b_p_eol) + size -= ffdos + 1; + } + return size; } diff --git a/src/misc2.c b/src/misc2.c index dbc5166c8..82b88876a 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -3606,8 +3606,7 @@ vim_findfile_init(path, filename, stopdirs, level, free_visited, need_dir, } /* Store information on starting dir now if path is relative. - * If path is absolute, we do that later. - */ + * If path is absolute, we do that later. */ if (path[0] == '.' && (vim_ispathsep(path[1]) || path[1] == NUL) && (!tagfile || vim_strchr(p_cpo, CPO_DOTTAG) == NULL) @@ -3886,7 +3885,7 @@ vim_findfile_cleanup(ctx) * Return a pointer to an allocated file name or NULL if nothing found. * To get all matching files call this function until you get NULL. * - * If the passed search_context is NULL, it the returns NULL. + * If the passed search_context is NULL, NULL is returned. * * The search algorithm is depth first. To change this replace the * stack with a list (don't forget to leave partly searched directories on the @@ -1129,7 +1129,7 @@ do_execreg(regname, colon, addcr) new_last_cmdline = NULL; /* Escape all control characters with a CTRL-V */ p = vim_strsave_escaped_ext(last_cmdline, - "\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037", Ctrl_V, FALSE); + (char_u *)"\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037", Ctrl_V, FALSE); if (p != NULL) retval = put_in_typebuf(p, TRUE); vim_free(p); diff --git a/src/os_mac.h b/src/os_mac.h index 940e267b9..5ef7310b5 100644 --- a/src/os_mac.h +++ b/src/os_mac.h @@ -119,8 +119,8 @@ * ~/Library/Vim or ~/Library/Preferences/org.vim.vim/ ? (Dany) */ /* When compiled under MacOS X (including CARBON version) - * we use the Unix File path style */ -#if defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX + * we use the Unix File path style. Also when UNIX is defined. */ +#if defined(UNIX) || (defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX) # undef COLON_AS_PATHSEP # define USE_UNIXFILENAME #else @@ -140,14 +140,16 @@ #define CASE_INSENSITIVE_FILENAME /* ignore case when comparing file names */ #define SPACE_IN_FILENAME #define BREAKCHECK_SKIP 32 /* call mch_breakcheck() each time, it's - quite fast. Did I forgot to update the comment */ + quite fast. Did I forgot to update the + comment */ -#undef USE_FNAME_CASE /* So that :e os_Mac.c, :w, save back the file as os_mac.c */ +#undef USE_FNAME_CASE /* So that :e os_Mac.c, :w, save back the file + as os_mac.c */ #define BINARY_FILE_IO #define EOL_DEFAULT EOL_MAC -#ifndef MACOS_X_UNIX /* I hope that switching these two lines */ -# define USE_CR /* does what I want -- BNF */ +#ifndef MACOS_X_UNIX /* I hope that switching these two lines */ +# define USE_CR /* does what I want -- BNF */ # define NO_CONSOLE /* don't include console mode */ #endif #define HAVE_AVAIL_MEM diff --git a/src/os_mac_conv.c b/src/os_mac_conv.c index 3dfacfe68..3f64e3da4 100644 --- a/src/os_mac_conv.c +++ b/src/os_mac_conv.c @@ -16,6 +16,7 @@ #define NO_X11_INCLUDES #include "vim.h" +#ifdef FEAT_MBYTE extern char_u *mac_string_convert __ARGS((char_u *ptr, int len, int *lenp, int fail_on_error, int from, int to, int *unconvlenp)); extern int macroman2enc __ARGS((char_u *ptr, long *sizep, long real_size)); extern int enc2macroman __ARGS((char_u *from, size_t fromlen, char_u *to, int *tolenp, int maxtolen, char_u *rest, int *restlenp)); @@ -228,3 +229,5 @@ enc2macroman(from, fromlen, to, tolenp, maxtolen, rest, restlenp) *tolenp = l; return OK; } + +#endif /* FEAT_MBYTE */ diff --git a/src/po/ru.cp1251.po b/src/po/ru.cp1251.po index 85b1d6835..7ae34cb25 100644 --- a/src/po/ru.cp1251.po +++ b/src/po/ru.cp1251.po @@ -1239,7 +1239,7 @@ msgstr "E173: 1 файл ожидает редактирования." #: ex_docmd.c:4584 #, c-format msgid "E173: %ld more files to edit" -msgstr "E173: Есть неотредактированные файлы (%d)." +msgstr "E173: Есть неотредактированные файлы (%ld)." #: ex_docmd.c:4679 msgid "E174: Command already exists: add ! to replace it" @@ -2446,7 +2446,7 @@ msgstr "Добавлена база данных cscope %s" #: if_cscope.c:589 #, c-format msgid "E262: error reading cscope connection %ld" -msgstr "E262: ошибка получения информации от соединения cscope %d" +msgstr "E262: ошибка получения информации от соединения cscope %ld" #: if_cscope.c:694 msgid "E561: unknown cscope search type" @@ -2524,7 +2524,7 @@ msgstr "E261: соединение с cscope %s не обнаружено" #: if_cscope.c:1458 #, c-format msgid "cscope connection %s closed" -msgstr "соединение с cscope закрыто" +msgstr "соединение с cscope %s закрыто" #. should not reach here #: if_cscope.c:1598 diff --git a/src/po/ru.po b/src/po/ru.po index 7bd9d72f3..1d1c5d5a9 100644 --- a/src/po/ru.po +++ b/src/po/ru.po @@ -1239,7 +1239,7 @@ msgstr "E173: 1 файл ожидает редактирования." #: ex_docmd.c:4584 #, c-format msgid "E173: %ld more files to edit" -msgstr "E173: Есть неотредактированные файлы (%d)." +msgstr "E173: Есть неотредактированные файлы (%ld)." #: ex_docmd.c:4679 msgid "E174: Command already exists: add ! to replace it" @@ -2446,7 +2446,7 @@ msgstr "Добавлена база данных cscope %s" #: if_cscope.c:589 #, c-format msgid "E262: error reading cscope connection %ld" -msgstr "E262: ошибка получения информации РѕС‚ соединения cscope %d" +msgstr "E262: ошибка получения информации РѕС‚ соединения cscope %ld" #: if_cscope.c:694 msgid "E561: unknown cscope search type" @@ -2524,7 +2524,7 @@ msgstr "E261: соединение СЃ cscope %s РЅРµ обнаружено" #: if_cscope.c:1458 #, c-format msgid "cscope connection %s closed" -msgstr "соединение СЃ cscope закрыто" +msgstr "соединение СЃ cscope %s закрыто" #. should not reach here #: if_cscope.c:1598 diff --git a/src/search.c b/src/search.c index 227b25468..4513ea110 100644 --- a/src/search.c +++ b/src/search.c @@ -3760,10 +3760,11 @@ find_prev_quote(line, col_start, quotechar, escape) * Find quote under the cursor, cursor at end. * Returns TRUE if found, else FALSE. */ +/*ARGSUSED*/ int current_quote(oap, count, include, quotechar) oparg_T *oap; - long count; + long count; /* not used */ int include; /* TRUE == include quote char */ int quotechar; /* Quote character */ { |