diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-04-22 22:33:57 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-04-22 22:33:57 +0000 |
commit | eb3593b38b7b6b658e93ad05d6caf76d58cc0c35 (patch) | |
tree | 39210f19a86e4db2914523b0fde4a5ff9d345c16 /src | |
parent | 57657d85c6c3d812e99b5e5d5161c07c66ac7dc7 (diff) |
updated for version 7.0e06v7.0e06
Diffstat (limited to 'src')
-rw-r--r-- | src/Make_mvc.mak | 44 | ||||
-rw-r--r-- | src/diff.c | 3 | ||||
-rw-r--r-- | src/edit.c | 55 | ||||
-rw-r--r-- | src/eval.c | 29 | ||||
-rw-r--r-- | src/ex_cmds.c | 1 | ||||
-rw-r--r-- | src/ex_docmd.c | 3 | ||||
-rw-r--r-- | src/ex_eval.c | 6 | ||||
-rw-r--r-- | src/fold.c | 3 | ||||
-rw-r--r-- | src/getchar.c | 19 | ||||
-rw-r--r-- | src/gui_gtk.c | 4 | ||||
-rw-r--r-- | src/gui_gtk_x11.c | 6 | ||||
-rw-r--r-- | src/gui_w32.c | 131 | ||||
-rw-r--r-- | src/hardcopy.c | 10 | ||||
-rw-r--r-- | src/mbyte.c | 2 | ||||
-rw-r--r-- | src/menu.c | 3 | ||||
-rw-r--r-- | src/message.c | 32 | ||||
-rw-r--r-- | src/misc1.c | 10 | ||||
-rw-r--r-- | src/misc2.c | 28 | ||||
-rw-r--r-- | src/netbeans.c | 38 | ||||
-rw-r--r-- | src/normal.c | 6 | ||||
-rw-r--r-- | src/ops.c | 11 | ||||
-rw-r--r-- | src/option.c | 26 | ||||
-rw-r--r-- | src/os_mswin.c | 20 | ||||
-rw-r--r-- | src/os_unix.c | 2 | ||||
-rw-r--r-- | src/os_win32.c | 2 | ||||
-rw-r--r-- | src/proto/message.pro | 137 | ||||
-rw-r--r-- | src/regexp.c | 6 | ||||
-rw-r--r-- | src/spell.c | 8 | ||||
-rw-r--r-- | src/syntax.c | 3 | ||||
-rw-r--r-- | src/testdir/test61.in | 7 | ||||
-rw-r--r-- | src/testdir/test61.ok | 2 | ||||
-rw-r--r-- | src/version.h | 6 | ||||
-rw-r--r-- | src/vim.h | 10 | ||||
-rw-r--r-- | src/window.c | 2 |
34 files changed, 448 insertions, 227 deletions
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index f9d211d347..a78f756ec2 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -1,9 +1,8 @@ -# Makefile for Vim on Win32 (Windows NT and Windows 95), using the -# Microsoft Visual C++ 2.x and MSVC 4.x compilers (or newer). -# It builds on Windows 95 and all four NT platforms: i386, Alpha, MIPS, and -# PowerPC. The NT/i386 binary and the Windows 95 binary are identical. +# Makefile for Vim on Win32 (Windows NT/2000/XP/2003 and Windows 95/98/Me) +# and Win64, using the Microsoft Visual C++ compilers. Known to work with +# VC5, VC6 (VS98), VC7.0 (VS2002), VC7.1 (VS2003), and VC8 (VS2005). # -# To build using Borland C++, use Make_bc3.mak or Make_bc5.mak. +# To build using other Windows compilers, see INSTALLpc.txt # # This makefile can build the console, GUI, OLE-enable, Perl-enabled and # Python-enabled versions of vim for Win32 platforms. @@ -172,8 +171,11 @@ OBJDIR = $(OBJDIR)d !ifdef PROCESSOR_ARCHITECTURE # We're on Windows NT or using VC 6+ -! ifndef CPU +! ifdef CPU +ASSEMBLY_ARCHITECTURE=$(CPU) +! else CPU = $(PROCESSOR_ARCHITECTURE) +ASSEMBLY_ARCHITECTURE = $(PROCESSOR_ARCHITECTURE) ! if ("$(CPU)" == "x86") || ("$(CPU)" == "X86") CPU = i386 ! endif @@ -183,6 +185,9 @@ CPU = i386 CPU = i386 !endif # !PROCESSOR_ARCHITECTURE +!if ("$(CPU)" == "AMD64") || ("$(CPU)" == "IA64") +DEFINES=$(DEFINES) /Wp64 +!endif # Build a retail version by default @@ -752,6 +757,7 @@ clean: - if exist $(VIM).pdb del $(VIM).pdb - if exist $(VIM).map del $(VIM).map - if exist $(VIM).ncb del $(VIM).ncb + - if exist gvim.exe.mnf del gvim.exe.mnf - if exist vimrun.exe del vimrun.exe - if exist install.exe del install.exe - if exist uninstal.exe del uninstal.exe @@ -933,7 +939,7 @@ $(OUTDIR)/window.obj: $(OUTDIR) window.c $(INCL) $(OUTDIR)/xpm_w32.obj: $(OUTDIR) xpm_w32.c $(CC) $(CFLAGS) $(XPM_INC) xpm_w32.c -$(OUTDIR)/vim.res: $(OUTDIR) vim.rc version.h tools.bmp tearoff.bmp \ +$(OUTDIR)/vim.res: $(OUTDIR) gvim.exe.mnf vim.rc version.h tools.bmp tearoff.bmp \ vim.ico vim_error.ico vim_alert.ico vim_info.ico vim_quest.ico $(RC) /l 0x409 /Fo$(OUTDIR)/vim.res $(RCFLAGS) vim.rc @@ -963,6 +969,30 @@ $(PATHDEF_SRC): auto @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> $(PATHDEF_SRC) @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> $(PATHDEF_SRC) +gvim.exe.mnf: auto + @echo ^<?xml version="1.0" encoding="UTF-8" standalone="yes"?^> >$@ + @echo ^<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"^> >>$@ + @echo ^<assemblyIdentity >>$@ + @echo processorArchitecture="$(ASSEMBLY_ARCHITECTURE)" >>$@ + @echo version="7.0.0.0" >>$@ + @echo type="win32" >>$@ + @echo name="Vim" >>$@ + @echo /^> >>$@ + @echo ^<description^>Vi Improved - A Text Editor^</description^> >>$@ + @echo ^<dependency^> >>$@ + @echo ^<dependentAssembly^> >>$@ + @echo ^<assemblyIdentity >>$@ + @echo type="win32" >>$@ + @echo name="Microsoft.Windows.Common-Controls" >>$@ + @echo version="6.0.0.0" >>$@ + @echo publicKeyToken="6595b64144ccf1df" >>$@ + @echo language="*" >>$@ + @echo processorArchitecture="$(ASSEMBLY_ARCHITECTURE)" >>$@ + @echo /^> >>$@ + @echo ^</dependentAssembly^> >>$@ + @echo ^</dependency^> >>$@ + @echo ^</assembly^> >>$@ + auto: if not exist auto/nul mkdir auto diff --git a/src/diff.c b/src/diff.c index 5f8a84a173..22cf5af0d2 100644 --- a/src/diff.c +++ b/src/diff.c @@ -1330,7 +1330,7 @@ diff_read(idx_orig, idx_new, fname) /* Allocate a new diffblock. */ dp = diff_alloc_new(curtab, dprev, dp); if (dp == NULL) - return; + goto done; dp->df_lnum[idx_orig] = lnum_orig; dp->df_count[idx_orig] = count_orig; @@ -1357,6 +1357,7 @@ diff_read(idx_orig, idx_new, fname) notset = TRUE; } +done: fclose(fd); } diff --git a/src/edit.c b/src/edit.c index ed416f30a1..2c97119605 100644 --- a/src/edit.c +++ b/src/edit.c @@ -178,7 +178,9 @@ static int spell_bad_len = 0; /* length of located bad word */ #endif static void stop_insert __ARGS((pos_T *end_insert_pos, int esc)); static int echeck_abbr __ARGS((int)); +#if 0 static void replace_push_off __ARGS((int c)); +#endif static int replace_pop __ARGS((void)); static void replace_join __ARGS((int off)); static void replace_pop_ins __ARGS((void)); @@ -5823,7 +5825,7 @@ redo_literal(c) */ static void start_arrow(end_insert_pos) - pos_T *end_insert_pos; + pos_T *end_insert_pos; /* can be NULL */ { if (!arrow_used) /* something has been inserted */ { @@ -5912,11 +5914,13 @@ stop_arrow() } /* - * do a few things to stop inserting + * Do a few things to stop inserting. + * "end_insert_pos" is where insert ended. It is NULL when we already jumped + * to another window/buffer. */ static void stop_insert(end_insert_pos, esc) - pos_T *end_insert_pos; /* where insert ended */ + pos_T *end_insert_pos; int esc; /* called by ins_esc() */ { int cc; @@ -5941,7 +5945,7 @@ stop_insert(end_insert_pos, esc) else vim_free(ptr); - if (!arrow_used) + if (!arrow_used && end_insert_pos != NULL) { /* Auto-format now. It may seem strange to do this when stopping an * insertion (or moving the cursor), but it's required when appending @@ -5987,7 +5991,7 @@ stop_insert(end_insert_pos, esc) * of the line, and put the cursor back. * Do this when ESC was used or moving the cursor up/down. */ if (did_ai && (esc || (vim_strchr(p_cpo, CPO_INDENT) == NULL - && curwin->w_cursor.lnum != end_insert_pos->lnum))) + && curwin->w_cursor.lnum != end_insert_pos->lnum))) { pos_T tpos = curwin->w_cursor; @@ -6030,9 +6034,13 @@ stop_insert(end_insert_pos, esc) can_si_back = FALSE; #endif - /* set '[ and '] to the inserted text */ - curbuf->b_op_start = Insstart; - curbuf->b_op_end = *end_insert_pos; + /* Set '[ and '] to the inserted text. When end_insert_pos is NULL we are + * now in a different buffer. */ + if (end_insert_pos != NULL) + { + curbuf->b_op_start = Insstart; + curbuf->b_op_end = *end_insert_pos; + } } /* @@ -6563,6 +6571,7 @@ replace_push(c) ++replace_stack_nr; } +#if 0 /* * call replace_push(c) with replace_offset set to the first NUL. */ @@ -6580,6 +6589,7 @@ replace_push_off(c) replace_push(c); replace_offset = 0; } +#endif /* * Pop one item from the replace stack. @@ -8023,7 +8033,9 @@ ins_bs(c, mode, inserted_space_p) int ts; colnr_T vcol; colnr_T want_vcol; +#if 0 int extra = 0; +#endif *inserted_space_p = FALSE; if (p_sta && in_indent) @@ -8082,15 +8094,19 @@ ins_bs(c, mode, inserted_space_p) #endif { ins_str((char_u *)" "); - if ((State & REPLACE_FLAG) && extra <= 1) + if ((State & REPLACE_FLAG) /* && extra <= 1 */) { +#if 0 if (extra) replace_push_off(NUL); else +#endif replace_push(NUL); } +#if 0 if (extra == 2) extra = 1; +#endif } getvcol(curwin, &curwin->w_cursor, &vcol, NULL, NULL); } @@ -8205,6 +8221,7 @@ ins_mouse(c) int c; { pos_T tpos; + win_T *old_curwin = curwin; # ifdef FEAT_GUI /* When GUI is active, also move/paste when 'mouse' is empty */ @@ -8217,7 +8234,25 @@ ins_mouse(c) tpos = curwin->w_cursor; if (do_mouse(NULL, c, BACKWARD, 1L, 0)) { - start_arrow(&tpos); +#ifdef FEAT_WINDOWS + win_T *new_curwin = curwin; + + if (curwin != old_curwin && win_valid(old_curwin)) + { + /* Mouse took us to another window. We need to go back to the + * previous one to stop insert there properly. */ + curwin = old_curwin; + curbuf = curwin->w_buffer; + } +#endif + start_arrow(curwin == old_curwin ? &tpos : NULL); +#ifdef FEAT_WINDOWS + if (curwin != new_curwin && win_valid(new_curwin)) + { + curwin = new_curwin; + curbuf = curwin->w_buffer; + } +#endif # ifdef FEAT_CINDENT can_cindent = TRUE; # endif diff --git a/src/eval.c b/src/eval.c index 1e75a31a3b..14460a0a9a 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1413,7 +1413,7 @@ call_vim_function(func, argc, argv, safe, rettv) void *save_funccalp = NULL; int ret; - argvars = (typval_T *)alloc((unsigned)(argc * sizeof(typval_T))); + argvars = (typval_T *)alloc((unsigned)((argc + 1) * sizeof(typval_T))); if (argvars == NULL) return FAIL; @@ -7318,7 +7318,7 @@ get_func_tv(name, len, rettv, arg, firstline, lastline, doesrange, { char_u *argp; int ret = OK; - typval_T argvars[MAX_FUNC_ARGS]; /* vars for arguments */ + typval_T argvars[MAX_FUNC_ARGS + 1]; /* vars for arguments */ int argcount = 0; /* number of arguments found */ /* @@ -7375,7 +7375,8 @@ call_func(name, len, rettv, argcount, argvars, firstline, lastline, int len; /* length of "name" */ typval_T *rettv; /* return value goes here */ int argcount; /* number of "argvars" */ - typval_T *argvars; /* vars for arguments */ + typval_T *argvars; /* vars for arguments, must have "argcount" + PLUS ONE elements! */ linenr_T firstline; /* first line of range */ linenr_T lastline; /* last line of range */ int *doesrange; /* return: function handled range */ @@ -8064,7 +8065,7 @@ f_call(argvars, rettv) typval_T *rettv; { char_u *func; - typval_T argv[MAX_FUNC_ARGS]; + typval_T argv[MAX_FUNC_ARGS + 1]; int argc = 0; listitem_T *item; int dummy; @@ -8943,7 +8944,7 @@ f_extend(argvars, rettv) break; if (i == 3) { - EMSGN(_(e_invarg2), action); + EMSG2(_(e_invarg2), action); return; } } @@ -12997,7 +12998,7 @@ remote_common(argvars, rettv, expr) char_u str[30]; char_u *idvar; - sprintf((char *)str, "0x%x", (unsigned int)w); + sprintf((char *)str, PRINTF_HEX_LONG_U, (long_u)w); v.di_tv.v_type = VAR_STRING; v.di_tv.vval.v_string = vim_strsave(str); idvar = get_tv_string_chk(&argvars[2]); @@ -13064,7 +13065,7 @@ f_remote_peek(argvars, rettv) dictitem_T v; char_u *s = NULL; # ifdef WIN32 - int n = 0; + long_u n = 0; # endif char_u *serverid; @@ -13080,7 +13081,7 @@ f_remote_peek(argvars, rettv) return; /* type error; errmsg already given */ } # ifdef WIN32 - sscanf(serverid, "%x", &n); + sscanf(serverid, SCANF_HEX_LONG_U, &n); if (n == 0) rettv->vval.v_number = -1; else @@ -13128,9 +13129,9 @@ f_remote_read(argvars, rettv) { # ifdef WIN32 /* The server's HWND is encoded in the 'id' parameter */ - int n = 0; + long_u n = 0; - sscanf(serverid, "%x", &n); + sscanf(serverid, SCANF_HEX_LONG_U, &n); if (n != 0) r = serverGetReply((HWND)n, FALSE, TRUE, TRUE); if (r == NULL) @@ -14585,7 +14586,7 @@ item_compare2(s1, s2) { int res; typval_T rettv; - typval_T argv[2]; + typval_T argv[3]; int dummy; /* shortcut after failure in previous call; compare all items equal */ @@ -15133,11 +15134,12 @@ f_strridx(argvars, rettv) needle = get_tv_string_chk(&argvars[1]); haystack = get_tv_string_buf_chk(&argvars[0], buf); - haystack_len = (int)STRLEN(haystack); rettv->vval.v_number = -1; if (needle == NULL || haystack == NULL) return; /* type error; errmsg already given */ + + haystack_len = (int)STRLEN(haystack); if (argvars[2].v_type != VAR_UNKNOWN) { /* Third argument: upper limit for index */ @@ -15398,7 +15400,10 @@ f_system(argvars, rettv) } p = get_tv_string_buf_chk(&argvars[1], buf); if (p == NULL) + { + fclose(fd); goto done; /* type error; errmsg already given */ + } if (fwrite(p, STRLEN(p), 1, fd) != 1) err = TRUE; if (fclose(fd) != 0) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index aafe31cf09..b5920c8d04 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -1778,6 +1778,7 @@ write_viminfo(file, forceit) tt = msg_didany; EMSG2(_("E137: Viminfo file is not writable: %s"), fname); msg_didany = tt; + fclose(fp_in); goto end; } #endif diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 4943bfcfb4..3e4c963c41 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -9438,7 +9438,8 @@ eval_vars(src, usedlen, lnump, errormsg, srcstart) break; #if defined(FEAT_CLIENTSERVER) case SPEC_CLIENT: /* Source of last submitted input */ - sprintf((char *)strbuf, "0x%x", (unsigned int)clientWindow); + sprintf((char *)strbuf, PRINTF_HEX_LONG_U, + (long_u)clientWindow); result = strbuf; break; #endif diff --git a/src/ex_eval.c b/src/ex_eval.c index c89cb2bd0f..8714958f05 100644 --- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -1136,7 +1136,7 @@ ex_continue(eap) * next). Therefor, inactivate all conditionals except the ":while" * itself (if reached). */ idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, FALSE); - if ((cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) + if (idx >= 0 && (cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) { rewind_conditionals(cstack, idx, CSF_TRY, &cstack->cs_trylevel); @@ -1175,7 +1175,7 @@ ex_break(eap) * executed next) is found. In the latter case, make the ":break" * pending for execution at the ":endtry". */ idx = cleanup_conditionals(cstack, CSF_WHILE | CSF_FOR, TRUE); - if (!(cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) + if (idx >= 0 && !(cstack->cs_flags[idx] & (CSF_WHILE | CSF_FOR))) { cstack->cs_pending[idx] = CSTP_BREAK; report_make_pending(CSTP_BREAK, NULL); @@ -1861,7 +1861,7 @@ ex_endtry(eap) * after errors except when this ":endtry" is not within a ":try". * Restore "emsg_silent" if it has been reset by this try conditional. */ - cleanup_conditionals(cstack, CSF_TRY | CSF_SILENT, TRUE); + (void)cleanup_conditionals(cstack, CSF_TRY | CSF_SILENT, TRUE); --cstack->cs_idx; --cstack->cs_trylevel; diff --git a/src/fold.c b/src/fold.c index 8cd51a9c22..bb7b8b7ccd 100644 --- a/src/fold.c +++ b/src/fold.c @@ -2594,8 +2594,9 @@ foldUpdateIEMSRecurse(gap, level, startlnum, flp, getlevel, bot, topflags) /* * The fold includes the line "flp->lnum" and "flp->lnum_save". + * Check "fp" for safety. */ - if (lvl > level) + if (lvl > level && fp != NULL) { /* * There is a nested fold, handle it recursively. diff --git a/src/getchar.c b/src/getchar.c index 88381b176e..782bdbee01 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -4053,14 +4053,19 @@ ExpandMappings(regmatch, num_file, file) } } /* for (round) */ - /* Sort the matches */ - sort_strings(*file, count); - - /* Remove multiple entries */ + if (count > 1) { - char_u **ptr1 = *file; - char_u **ptr2 = ptr1 + 1; - char_u **ptr3 = ptr1 + count; + char_u **ptr1; + char_u **ptr2; + char_u **ptr3; + + /* Sort the matches */ + sort_strings(*file, count); + + /* Remove multiple entries */ + ptr1 = *file; + ptr2 = ptr1 + 1; + ptr3 = ptr1 + count; while (ptr2 < ptr3) { diff --git a/src/gui_gtk.c b/src/gui_gtk.c index d9477d5b67..6c86948599 100644 --- a/src/gui_gtk.c +++ b/src/gui_gtk.c @@ -787,12 +787,12 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) # endif /* FEAT_TOOLBAR */ { /* No parent, must be a non-menubar menu */ - if (parent->submenu_id == NULL) + if (parent == NULL || parent->submenu_id == NULL) return; /* Make place for the possible tearoff handle item. Not in the popup * menu, it doesn't have a tearoff item. */ - if (parent != NULL && !menu_is_popup(parent->name)) + if (!menu_is_popup(parent->name)) ++idx; if (menu_is_separator(menu->name)) diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c index 79557a834b..3bec1f59fc 100644 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -2024,6 +2024,8 @@ drag_handle_uri_list(GdkDragContext *context, gui_handle_drop(x, y, modifiers, fnames, nfiles); } + else + vim_free(fnames); } static void @@ -4707,7 +4709,7 @@ gui_mch_font_dialog(char_u *oldval) * that, because in 'guifont' it separates names. */ p = vim_strsave_escaped((char_u *)name, (char_u *)","); g_free(name); - if (input_conv.vc_type != CONV_NONE) + if (p != NULL && input_conv.vc_type != CONV_NONE) { fontname = string_convert(&input_conv, p, NULL); vim_free(p); @@ -6870,7 +6872,7 @@ mch_set_mouse_shape(int shape) else id &= ~1; /* they are always even (why?) */ } - else + else if (shape < sizeof(mshape_ids) / sizeof(int)) id = mshape_ids[shape]; # ifdef HAVE_GTK_MULTIHEAD c = gdk_cursor_new_for_display( diff --git a/src/gui_w32.c b/src/gui_w32.c index ac05ee9a18..a700ac0c49 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -181,13 +181,14 @@ # define ID_BEVAL_TOOLTIP 200 # define BEVAL_TEXT_LEN MAXPATHL -static void make_tooltip __ARGS((BalloonEval *beval, char *text, POINT pt)); -static void delete_tooltip __ARGS((BalloonEval *beval)); -static VOID CALLBACK BevalTimerProc __ARGS((HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime)); - #ifndef UINT_PTR # define UINT_PTR UINT #endif + +static void make_tooltip __ARGS((BalloonEval *beval, char *text, POINT pt)); +static void delete_tooltip __ARGS((BalloonEval *beval)); +static VOID CALLBACK BevalTimerProc __ARGS((HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)); + static BalloonEval *cur_beval = NULL; static UINT_PTR BevalTimerId = 0; static DWORD LastActivity = 0; @@ -811,9 +812,102 @@ _WndProc( case WM_NOTIFY: switch (((LPNMHDR) lParam)->code) { -# ifdef FEAT_TOOLBAR +# ifdef FEAT_MBYTE + case TTN_GETDISPINFOW: +# endif case TTN_NEEDTEXT: +# ifdef FEAT_GUI_TABLINE + if (gui_mch_showing_tabline() + && ((LPNMHDR)lParam)->hwndFrom == + TabCtrl_GetToolTips(s_tabhwnd)) { + LPNMTTDISPINFO lpdi; + POINT pt; + static char *tt_text = NULL; + static int tt_text_len = 0; + + /* + * Mouse is over the GUI tabline. Display the tooltip + * for the tab under the cursor + */ + lpdi = (LPNMTTDISPINFO)lParam; + lpdi->hinst = NULL; + lpdi->szText[0] = '\0'; + + /* + * Get the cursor position within the tab control + */ + GetCursorPos(&pt); + if (ScreenToClient(s_tabhwnd, &pt) != 0) + { + TCHITTESTINFO htinfo; + int idx; + + /* + * Get the tab under the cursor + */ + htinfo.pt.x = pt.x; + htinfo.pt.y = pt.y; + idx = TabCtrl_HitTest(s_tabhwnd, &htinfo); + if (idx != -1) + { + tabpage_T *tp; + + tp = find_tabpage(idx + 1); + if (tp != NULL) + { +# ifdef FEAT_MBYTE + WCHAR *wstr = NULL; +# endif + get_tabline_label(tp, TRUE); +# ifdef FEAT_MBYTE + if (enc_codepage >= 0 + && (int)GetACP() != enc_codepage) + { + wstr = enc_to_ucs2(NameBuff, NULL); + if (wstr != NULL) + { + int wlen; + + wlen = (wcslen(wstr) + 1) + * sizeof(WCHAR); + if (tt_text_len < wlen) + { + tt_text = vim_realloc(tt_text, + wlen); + if (tt_text != NULL) + tt_text_len = wlen; + } + if (tt_text != NULL) + wcscpy((WCHAR *)tt_text, wstr); + lpdi->lpszText = tt_text; + vim_free(wstr); + } + } + if (wstr == NULL) +# endif + { + int len; + + len = STRLEN(NameBuff) + 1; + if (tt_text_len < len) + { + tt_text = vim_realloc(tt_text, len); + if (tt_text != NULL) + tt_text_len = len; + } + if (tt_text != NULL) + STRCPY(tt_text, NameBuff); + lpdi->lpszText = tt_text; + } + } + } + } + } + else +# endif + { +# ifdef FEAT_TOOLBAR LPTOOLTIPTEXT lpttt; UINT idButton; int idx; @@ -831,9 +925,9 @@ _WndProc( lpttt->lpszText = pMenu->strings[idx]; } } +# endif } break; -# endif # ifdef FEAT_GUI_TABLINE case TCN_SELCHANGE: if (gui_mch_showing_tabline() @@ -2341,7 +2435,7 @@ gui_mch_add_menu( { InsertMenu((parent == NULL) ? s_menuBar : parent->submenu_id, (UINT)pos, MF_POPUP | MF_STRING | MF_BYPOSITION, - (UINT)menu->submenu_id, (LPCTSTR) menu->name); + (long_u)menu->submenu_id, (LPCTSTR) menu->name); } else { @@ -2361,7 +2455,7 @@ gui_mch_add_menu( infow.cbSize = sizeof(infow); infow.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID | MIIM_SUBMENU; - infow.dwItemData = (DWORD)menu; + infow.dwItemData = (long_u)menu; infow.wID = menu->id; infow.fType = MFT_STRING; infow.dwTypeData = wn; @@ -2384,7 +2478,7 @@ gui_mch_add_menu( info.cbSize = sizeof(info); info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID | MIIM_SUBMENU; - info.dwItemData = (DWORD)menu; + info.dwItemData = (long_u)menu; info.wID = menu->id; info.fType = MFT_STRING; info.dwTypeData = (LPTSTR)menu->name; @@ -2661,7 +2755,7 @@ gui_mch_menu_grey( if (menu->children == NULL) menuID = (WORD)(menu->id); else - menuID = (WORD)((DWORD)(menu->submenu_id) | (DWORD)0x8000); + menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); menuHandle = GetDlgItem(menu->parent->tearoff_handle, menuID); if (menuHandle) EnableWindow(menuHandle, !grey); @@ -2860,7 +2954,7 @@ gui_mch_dialog( /* allocate some memory for dialog template */ /* TODO should compute this really */ pdlgtemplate = p = (PWORD)LocalAlloc(LPTR, - DLG_ALLOC_SIZE + STRLEN(message)); + DLG_ALLOC_SIZE + STRLEN(message) * 2); if (p == NULL) return -1; @@ -3281,6 +3375,7 @@ gui_mch_dialog( } #endif /* FEAT_GUI_DIALOG */ + /* * Put a simple element (basic class) onto a dialog template in memory. * return a pointer to where the next item should be added. @@ -3344,9 +3439,9 @@ add_dialog_element( lpwAlign( LPWORD lpIn) { - ULONG ul; + long_u ul; - ul = (ULONG)lpIn; + ul = (long_u)lpIn; ul += 3; ul >>= 2; ul <<= 2; @@ -3435,7 +3530,7 @@ tearoff_callback( if (GetCursorPos(&mp) && GetWindowRect(hwnd, &rect)) { (void)TrackPopupMenu( - (HMENU)(LOWORD(wParam) ^ 0x8000), + (HMENU)(long_u)(LOWORD(wParam) ^ 0x8000), TPM_LEFTALIGN | TPM_LEFTBUTTON, (int)rect.right - 8, (int)mp.y, @@ -3794,7 +3889,7 @@ gui_mch_tearoff( else { len += (int)STRLEN(TEAROFF_SUBMENU_LABEL); - menuID = (WORD)((DWORD)(menu->submenu_id) | (DWORD)0x8000); + menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); } /* Allocate menu label and fill it in */ @@ -3953,7 +4048,7 @@ get_toolbar_bitmap(vimmenu_T *menu) TBADDBITMAP tbAddBitmap; tbAddBitmap.hInst = NULL; - tbAddBitmap.nID = (UINT)hbitmap; + tbAddBitmap.nID = (long_u)hbitmap; i = (int)SendMessage(s_toolbarhwnd, TB_ADDBITMAP, (WPARAM)1, (LPARAM)&tbAddBitmap); @@ -3978,7 +4073,7 @@ initialise_tabline(void) InitCommonControls(); s_tabhwnd = CreateWindow(WC_TABCONTROL, "Vim tabline", - WS_CHILD|TCS_FOCUSNEVER, + WS_CHILD|TCS_FOCUSNEVER|TCS_TOOLTIPS, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, s_hwnd, NULL, s_hinst, NULL); @@ -4404,7 +4499,7 @@ delete_tooltip(beval) BevalTimerProc(hwnd, uMsg, idEvent, dwTime) HWND hwnd; UINT uMsg; - UINT idEvent; + UINT_PTR idEvent; DWORD dwTime; { POINT pt; diff --git a/src/hardcopy.c b/src/hardcopy.c index 62567a3dbb..bc5a219fc6 100644 --- a/src/hardcopy.c +++ b/src/hardcopy.c @@ -2538,12 +2538,11 @@ mch_print_init(psettings, jobname, forceit) /* Build CMap name - will be same for all multi-byte fonts used */ prt_cmap[0] = NUL; - prt_custom_cmap = prt_out_mbyte && p_mbchar == NULL; - + prt_custom_cmap = (p_mbchar == NULL); if (!prt_custom_cmap) { /* Check encoding and character set are compatible */ - if ((p_mbenc->needs_charset&p_mbchar->has_charset) == 0) + if ((p_mbenc->needs_charset & p_mbchar->has_charset) == 0) { EMSG(_("E673: Incompatible multi-byte encoding and character set.")); return FALSE; @@ -2862,6 +2861,7 @@ mch_print_begin(psettings) struct prt_ps_resource_S res_encoding; char buffer[256]; char_u *p_encoding; + char_u *p; #ifdef FEAT_MBYTE struct prt_ps_resource_S res_cidfont; struct prt_ps_resource_S res_cmap; @@ -2880,7 +2880,9 @@ mch_print_begin(psettings) now = time(NULL); p_time = ctime(&now); /* Note: ctime() adds a \n so we have to remove it :-( */ - *(vim_strchr((char_u *)p_time, '\n')) = '\0'; + p = vim_strchr((char_u *)p_time, '\n'); + if (p != NULL) + *p = NUL; prt_dsc_textline("CreationDate", p_time); prt_dsc_textline("DocumentData", "Clean8Bit"); prt_dsc_textline("Orientation", "Portrait"); diff --git a/src/mbyte.c b/src/mbyte.c index 98d4e0009d..2114654d5a 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ |