Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.0.129
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.0.129
Problem:    GTK GUI: the GTK file dialog can't handle a relative path.
Solution:   Make the initial directory a full path before passing it to GTK.
	    (James Vega)  Also postpone adding the default file name until
	    after setting the directory.
Files:	    src/gui_gtk.c


*** ../vim-7.0.128/src/gui_gtk.c	Tue Aug 29 17:28:56 2006
--- src/gui_gtk.c	Tue Oct 10 18:16:00 2006
***************
*** 1275,1292 ****
      title = CONVERT_TO_UTF8(title);
  # endif
  
!     /* Concatenate "initdir" and "dflt". */
      if (initdir == NULL || *initdir == NUL)
  	mch_dirname(dirbuf, MAXPATHL);
!     else if (STRLEN(initdir) + 2 < MAXPATHL)
! 	STRCPY(dirbuf, initdir);
!     else
  	dirbuf[0] = NUL;
      /* Always need a trailing slash for a directory. */
      add_pathsep(dirbuf);
-     if (dflt != NULL && *dflt != NUL
- 			      && STRLEN(dirbuf) + 2 + STRLEN(dflt) < MAXPATHL)
- 	STRCAT(dirbuf, dflt);
  
      /* If our pointer is currently hidden, then we should show it. */
      gui_mch_mousehide(FALSE);
--- 1275,1287 ----
      title = CONVERT_TO_UTF8(title);
  # endif
  
!     /* GTK has a bug, it only works with an absolute path. */
      if (initdir == NULL || *initdir == NUL)
  	mch_dirname(dirbuf, MAXPATHL);
!     else if (vim_FullName(initdir, dirbuf, MAXPATHL - 2, FALSE) == FAIL)
  	dirbuf[0] = NUL;
      /* Always need a trailing slash for a directory. */
      add_pathsep(dirbuf);
  
      /* If our pointer is currently hidden, then we should show it. */
      gui_mch_mousehide(FALSE);
***************
*** 1340,1345 ****
--- 1335,1345 ----
      }
      else
  	gtk_window_set_title(GTK_WINDOW(gui.filedlg), (const gchar *)title);
+ 
+     /* Concatenate "initdir" and "dflt". */
+     if (dflt != NULL && *dflt != NUL
+ 			      && STRLEN(dirbuf) + 2 + STRLEN(dflt) < MAXPATHL)
+ 	STRCAT(dirbuf, dflt);
  
      gtk_file_selection_set_filename(GTK_FILE_SELECTION(gui.filedlg),
  						      (const gchar *)dirbuf);
*** ../vim-7.0.128/src/version.c	Tue Oct 10 17:36:50 2006
--- src/version.c	Tue Oct 10 18:25:11 2006
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     129,
  /**/

-- 
I'm not familiar with this proof, but I'm aware of a significant
following of toddlers who believe that peanut butter is the solution
to all of life's problems... 		-- Tim Hammerquist

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///