From: Ben Armstrong, Thu, August 23, 2007 7:52 am
>
> Here is a simple, reproducible test case that I believe doesn't
> require any of my hooks and that shows Cream_touch() is broken.
>
> 1. With an empty buffer, ^O:call Cream_touch("test.tmp").  Then
> "refresh tabs".  No extra tabs appear.
> 2. Open a file. Do another ^O:call Cream_touch("test.tmp"). Then
> "refresh tabs". An extra "Untitled" tab appears.
>
> I tried just changing the bwipeout to a "call Cream_bwipeout()" in
> Cream_touch(), but that didn't help.  I don't really know what I'm
> doing here. :)

Let's try a new approach that avoids all the buffer manipulation:

  function! Cream_touch(pathfile)
  " create an empty file {pathfile}, prompting if it exists

      " test that head exists
      if !Cream_pathexists(fnamemodify(a:pathfile, ":p:h"))
          call confirm(
              \ "Error: Invalid path passed to Cream_touch().\n" .
              \ "File not created.\n" .
              \ "\n", "&Ok", 1, "Warning")
          return -1
      endif

      if Cream_has("ms")
          let pathfile = fnamemodify(a:pathfile, ":p:8")
      else
          let pathfile = fnamemodify(a:pathfile, ":p")
      endif

      execute "silent! confirm 0write " . pathfile

  endfunction

This is much simpler, although an undesirable side effect is that it
puts the first line of the current file into the touch file. Not sure
how to specify a default range of nothing.



-- 
Steve Hall  [ digitect dancingpaper com ]
:: Cream... usability for Vim
::   http://cream.sourceforge.net


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
cream-general mailing list
cream-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cream-general

Reply via email to