To: vim-dev@vim.org Subject: Patch 6.1.198 (extra) Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.198 (extra) (depends on 6.1.076) Problem: Mac OS X: Dialogues don't work. Solution: Fix a crashing problem for some GUI dialogues. Fix a problem when saving to a new file from the GUI. (Peter Cucka) Files: src/feature.h, src/gui_mac.c *** ../vim61.197/src/feature.h Fri May 17 19:29:08 2002 --- src/feature.h Fri Sep 27 19:23:35 2002 *************** *** 710,716 **** && defined(HAVE_X11_XPM_H)) \ || defined(FEAT_GUI_GTK) \ || defined(FEAT_GUI_PHOTON) \ ! || (defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON) # define FEAT_CON_DIALOG # define FEAT_GUI_DIALOG # else --- 710,716 ---- && defined(HAVE_X11_XPM_H)) \ || defined(FEAT_GUI_GTK) \ || defined(FEAT_GUI_PHOTON) \ ! || defined(FEAT_GUI_MAC) # define FEAT_CON_DIALOG # define FEAT_GUI_DIALOG # else *** ../vim61.197/src/gui_mac.c Sun Jun 9 20:34:00 2002 --- src/gui_mac.c Fri Sep 27 19:29:53 2002 *************** *** 4441,4447 **** if (saving) { /* Change first parm AEDesc (typeFSS) *defaultLocation to match dflt */ ! NavPutFile (NULL, &reply, &navOptions, NULL, 'VIM!', 'TEXT', NULL); if (!reply.validRecord) return NULL; } --- 4441,4447 ---- if (saving) { /* Change first parm AEDesc (typeFSS) *defaultLocation to match dflt */ ! NavPutFile (NULL, &reply, &navOptions, NULL, 'TEXT', 'VIM!', NULL); if (!reply.validRecord) return NULL; } *************** *** 4829,4834 **** --- 4829,4835 ---- * For some reason this change need to be done last (Dany) */ GetDialogItem (theDialog, inputItm.idx, &itemType, &itemHandle, &inputItm.box); SetDialogItem (theDialog, inputItm.idx, kEditTextDialogItem, itemHandle, &inputItm.box); + SelectDialogItemText(theDialog, inputItm.idx, 0, 32767); } /* Place Button */ *************** *** 5247,5262 **** * The function used here are available in Carbon, but * do nothing une MacOS 8 and 9 */ ! error=FSpMakeFSRef (&file, &refFile); ! if (error) ! return NULL; ! status=FSRefMakePath (&refFile, (UInt8 *) path, pathSize); ! if (status) ! return NULL; ! /* Add the the slash at the end if needed */ if (folder) STRCAT (path, "/"); --- 5248,5294 ---- * The function used here are available in Carbon, but * do nothing une MacOS 8 and 9 */ + if (error == fnfErr) + { + /* If the file to be saved does not already exist, it isn't possible + to convert its FSSpec into an FSRef. But we can construct an + FSSpec for the file's parent folder (since we have its volume and + directory IDs), and since that folder does exist, we can convert + that FSSpec into an FSRef, convert the FSRef in turn into a path, + and, finally, append the filename. */ + FSSpec dirSpec; + FSRef dirRef; + Str255 emptyFilename = "\p"; + error = FSMakeFSSpec(theCPB.dirInfo.ioVRefNum, + theCPB.dirInfo.ioDrDirID, emptyFilename, &dirSpec); + if (error) + return NULL; ! error = FSpMakeFSRef(&dirSpec, &dirRef); ! if (error) ! return NULL; ! status = FSRefMakePath(&dirRef, (UInt8*)path, pathSize); ! if (status) ! return NULL; ! ! STRCAT(path, "/"); ! STRCAT(path, filenamePtr); ! } ! else ! { ! /* If the file to be saved already exists, we can get its full path ! by converting its FSSpec into an FSRef. */ ! error=FSpMakeFSRef (&file, &refFile); ! if (error) ! return NULL; ! ! status=FSRefMakePath (&refFile, (UInt8 *) path, pathSize); ! if (status) ! return NULL; ! } ! /* Add a slash at the end if needed */ if (folder) STRCAT (path, "/"); *** ../vim61.197/src/version.c Wed Sep 25 22:21:44 2002 --- src/version.c Fri Sep 27 19:27:39 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 198, /**/ -- hundred-and-one symptoms of being an internet addict: 71. You wonder how people walk /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.vim.org \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///