<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>Rakefile</filename>
    </added>
    <added>
      <filename>spec/el_mixin.rb</filename>
    </added>
    <added>
      <filename>spec/line_spec.rb</filename>
    </added>
    <added>
      <filename>spec/remote_spec.rb</filename>
    </added>
    <added>
      <filename>spec/view_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -38,7 +38,7 @@ class Clipboard
   end
 
 
-  def self.get key, options={}
+  def self.get key='0', options={}
     val = @@hash[key.to_s]
     if options[:add_linebreak]
       val = &quot;#{val}\n&quot; unless val[/\n$/]</diff>
      <filename>clipboard.rb</filename>
    </modified>
    <modified>
      <diff>@@ -168,10 +168,10 @@ class Code
     end
 
     if View.file =~ /\/xiki\//   # If in xiki project
-      if View.file =~ /\/tests\//   # If in spec, open corresponding file
-        View.open View.file.sub('/tests/', '/').sub(/_test\.rb/, '.rb')
-      else   # Otherwise, open file corresponding test
-        View.open View.file.sub(/(.+)\/(.+)/, &quot;\\1/tests/\\2&quot;).sub(/\.rb/, '_test.rb')
+      if View.file =~ /\/spec\//   # If in spec, open corresponding file
+        View.open View.file.sub('/spec/', '/').sub(/_spec\.rb/, '.rb')
+      else   # Otherwise, open file corresponding spec
+        View.open View.file.sub(/(.+)\/(.+)/, &quot;\\1/spec/\\2&quot;).sub(/\.rb/, '_spec.rb')
       end
       return
     end</diff>
      <filename>code.rb</filename>
    </modified>
    <modified>
      <diff>@@ -68,12 +68,12 @@ class Color
 
     if Styles.inverse
 
-      Styles.define :color_rb_red, :bg =&gt; &quot;550000&quot;
-      Styles.define :color_rb_orange, :bg =&gt; &quot;661a00&quot;
-      Styles.define :color_rb_yellow, :bg =&gt; &quot;4a4a00&quot;
-      Styles.define :color_rb_green, :bg =&gt; &quot;003300&quot;
-      Styles.define :color_rb_blue, :bg =&gt; &quot;000077&quot;
-      Styles.define :color_rb_purple, :bg =&gt; &quot;330044&quot;
+      Styles.define :color_rb_red, :bg =&gt; &quot;390000&quot;
+      Styles.define :color_rb_orange, :bg =&gt; &quot;441500&quot;
+      Styles.define :color_rb_yellow, :bg =&gt; &quot;333300&quot;
+      Styles.define :color_rb_green, :bg =&gt; &quot;002200&quot;
+      Styles.define :color_rb_blue, :bg =&gt; &quot;000055&quot;
+      Styles.define :color_rb_purple, :bg =&gt; &quot;220033&quot;
 
     end
 </diff>
      <filename>color.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1187,9 +1187,9 @@ class FileTree
     end
 
     indent += &quot; &quot; * Keys.prefix_or_0   # If numeric prefix, add to indent
-
-    clip.sub! /\n+$/, ''
-    View.insert &quot;#{indent}\|#{clip}\n&quot;
+    clip = clip.sub /\n+$/, ''
+    clip.gsub! /^/, &quot;#{indent}\|&quot;
+    View.insert &quot;#{clip}\n&quot;
   end
 
   def self.enter_as_search
@@ -1527,6 +1527,7 @@ class FileTree
   end
 
   def self.copy_path
+    Effects.blink(:what=&gt;:line)
     # If no space at left, grab dir of file
     return Clipboard[&quot;0&quot;] = View.file unless Line.matches(/^ /)
 </diff>
      <filename>file_tree.rb</filename>
    </modified>
    <modified>
      <diff>@@ -406,6 +406,7 @@ class KeyBindings
     Keys.isearch_just_select { Search.just_select }   # select match
     Keys.isearch_just_tag { Search.isearch_just_tag }   # select match
     Keys.isearch_just_underscores { Search.isearch_just_underscores }   # make match be snake case
+    Keys.isearch_just_wrap { Search.isearch_just_wrap }   # make match be snake case
     Keys.isearch_kill { Search.cut; Location.as_spot('deleted') }   # cut
     Keys.isearch_look { Search.uncover }   # Look: show results for search string in all open files
     # M: leave unmapped for stop</diff>
      <filename>key_bindings.rb</filename>
    </modified>
    <modified>
      <diff>@@ -368,7 +368,7 @@ class LineLauncher
       Console.launch :sync=&gt;true
     end
 
-    self.add(/^[^\|@]+[\/\w\-]+\.\w+:\d+/) do |line|  # Stack traces, etc
+    self.add(/^[^\|@:]+[\/\w\-]+\.\w+:\d+/) do |line|  # Stack traces, etc
       # Match again (necessary)
       line =~ /([\/.\w\-]+):(\d+)/
       path, line = $1, $2</diff>
      <filename>line_launcher.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,7 +7,8 @@ class Move
   # Go to last line having indent
   def self.to_indent
     direction_down = true   # Assume down
-    if Keys.prefix_u   # If U, reverse
+    prefix = Keys.prefix_u
+    if prefix == :u   # If U, reverse
       direction_down = false
     else
       column = Keys.prefix   # If numeric, make that be the indent</diff>
      <filename>move.rb</filename>
    </modified>
    <modified>
      <diff>@@ -210,7 +210,7 @@ class Notes
       :notes_h1e =&gt; &quot;336633&quot;,
       :notes_h1g =&gt; &quot;336633&quot;,
       :notes_h1p =&gt; &quot;663366&quot;,
-      :notes_h1m =&gt; &quot;270000&quot;,
+      :notes_h1m =&gt; &quot;662222&quot;,
       :notes_h1x =&gt; &quot;333333&quot;,
       :notes_h1t =&gt; &quot;005555&quot;,
       }
@@ -281,14 +281,14 @@ class Notes
     if Styles.inverse
 
       Styles.define :notes_h1,
-        :fg =&gt; 'ffffff', :bg =&gt; &quot;333355&quot;
+        :fg =&gt; 'ffffff', :bg =&gt; &quot;444466&quot;
       Styles.define :notes_h1_pipe,
-        :fg =&gt; '7777aa', :bg =&gt; &quot;333355&quot;
+        :fg =&gt; '7777aa', :bg =&gt; &quot;444466&quot;
 
       Styles.define :notes_h2,
         :fg =&gt; '555588', :bg =&gt; &quot;111122&quot;
       Styles.define :notes_h2_pipe,
-        :fg =&gt; '333355', :bg =&gt; &quot;111122&quot;
+        :fg =&gt; '444466', :bg =&gt; &quot;111122&quot;
 
     end
   end</diff>
      <filename>notes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,6 +3,7 @@ require 'net/ssh'
 require 'net/sftp'
 require 'timeout'
 require 'ol'
+require 'keys'
 
 class Remote
   extend ElMixin
@@ -23,9 +24,11 @@ class Remote
   def self.default_dirs= to;  @@default_dirs = to;  end
   def self.default_dirs;  @@default_dirs;  end
 
+  # Called when dir or file is launched
   def self.dir root, *path_append
-   user, server, port, path = self.split_root(root)
-    @@connections[&quot;#{user}@#{server}:#{port}&quot;] ||= self.create_connection(user, server, port.to_i)
+    connection = self.connection root
+
+    user, server, port, path = self.split_root(root)
 
     # Add slash to path if none there
     path &lt;&lt; &quot;/&quot; unless path =~ /\/$/
@@ -39,7 +42,7 @@ class Remote
 
     timeout(6) do
       if path =~ /\/$/   # If a dir
-        out = @@connections[&quot;#{user}@#{server}:#{port}&quot;].exec!(&quot;ls -p #{path}&quot;)
+        out = connection.exec!(&quot;ls -p #{path}&quot;)
         out ||= &quot;&quot;
         out = out.grep(/^[^#]+$/).join(&quot;&quot;)   # Weed out #...#
         out.gsub!(/@/, '/')   # Change @ to /
@@ -56,13 +59,19 @@ class Remote
 
         # Download if not open already
         unless was_open
-          ftp = @@connections[&quot;#{user}@#{server}:#{port}&quot;].sftp.connect
-          ftp.download!(path, local_path)
+          begin
+            connection.sftp.download!(path, local_path)
+          rescue Exception=&gt;e
+          end
         end
 
         View.to_after_bar
         View.open local_path
-        return &quot;- save - todo: make key shortcut instead!&quot; unless was_open
+
+        # TODO: save root path as var in buffer
+        $el.make_local_variable :remote_rb_server_root
+        server_root = &quot;/#{user}@#{server}#{port ? &quot;:#{port}&quot; : &quot;&quot;}/&quot;
+        $el.elvar.remote_rb_server_root = server_root
 
         # TODO save timestamp in buffer var
         # - Use it to determine whether file changed when saving
@@ -71,7 +80,14 @@ class Remote
     end
   end
 
-  def self.create_connection(user, server, port)
+  def self.connection root
+    user, server, port, path = self.split_root root
+    address = &quot;#{user}@#{server}:#{port}&quot;
+    @@connections[address] ||= self.new_connection user, server, port.to_i
+    @@connections[address]
+  end
+
+  def self.new_connection user, server, port
     begin
       timeout(6) do
         Net::SSH.start(server, user, :port =&gt; port.to_i, :paranoid =&gt; false)
@@ -81,6 +97,7 @@ class Remote
     end
   end
 
+
   def self.split_root root   # Splits name@server:port/path
     root = root.dup   # Append / at end if no / exists
     root &lt;&lt; '/' unless root =~ /\/$/
@@ -107,18 +124,28 @@ class Remote
     &quot;*remote #{file} (#{server}:#{dir})&quot;
   end
 
-  def self.save_file path, connection
-    local_path = self.calculate_local_path path
-    # If not open, print error
-    return puts(&quot;- File no longer open!&quot;) unless Files.open? local_path
+  def self.save_file
+    local_path = View.file
+    # Error out if not in right place
+    if local_path !~ /^#{@@temp_dir}/
+      View.beep
+      return View.message(&quot;This isn't a file the Remote code_tree retrieved&quot;)
+    end
+
+    # Save if modified
+    $el.save_buffer if $el.buffer_modified_p
 
-    begin   # Do save
-      sftp = connection.sftp.connect
+    remote_path = $el.elvar.remote_rb_server_root
 
-      sftp.upload!(local_path, path)
-      puts &quot;- success!&quot;
+
+    # Convert to path
+    remote_path = self.calculate_remote_path local_path
+    begin   # Do save
+      connection = self.connection $el.elvar.remote_rb_server_root
+      connection.sftp.upload!(local_path, remote_path)
+      View.message &quot;- success!&quot;
     rescue Exception =&gt; e
-      puts &quot;- error: #{e.message}&quot;
+      View.message &quot;- error: #{e.message}&quot;
     end
 
   end
@@ -127,4 +154,16 @@ class Remote
     &quot;#{@@temp_dir}/#{path.gsub('/', '-')[1..-1]}&quot;
   end
 
+  def self.calculate_remote_path path
+    path.gsub(/^#{@@temp_dir}/, '').gsub('-', '/')
+  end
+
+  def self.init
+    Keys.do_as_remote do
+      Remote.save_file
+    end
+  end
+
 end
+
+# Remote.init</diff>
      <filename>remote.rb</filename>
    </modified>
    <modified>
      <diff>@@ -81,7 +81,7 @@ class Search
   def self.paste_here
     self.clear
     View.delete(Search.left, Search.right)
-    insert Clipboard.get(&quot;0&quot;)
+    insert Clipboard.get
   end
 
   def self.copy_and_comment
@@ -159,7 +159,7 @@ class Search
         Keys.input(:prompt=&gt;&quot;With: &quot;))
     # If they typed 'c', use clipboard and prompt for 2nd arg
     elsif first == &quot;c&quot;
-      query_replace_regexp(Clipboard.get(&quot;0&quot;), Keys.input(:prompt=&gt;&quot;Replace with (pause when done): &quot;, :timed=&gt;true))
+      query_replace_regexp(Clipboard.get, Keys.input(:prompt=&gt;&quot;Replace with (pause when done): &quot;, :timed=&gt;true))
     # If they typed 'c', use clipboard and prompt for 2nd arg
     elsif first == &quot;l&quot;
       query_replace_regexp(@@query_from, @@query_to)
@@ -188,7 +188,7 @@ class Search
   def self.tree_grep
     dir = Keys.bookmark_as_path   # Get path (from bookmark)
     input = case Keys.prefix
-      when :u;  Clipboard.get(&quot;0&quot;)
+      when :u;  Clipboard.get
       when 1;  Clipboard.get(&quot;1&quot;)
       when 2;  Clipboard.get(&quot;2&quot;)
       else;  Keys.input(:prompt=&gt;&quot;Text to search for: &quot;)
@@ -562,7 +562,7 @@ class Search
   def self.enter_search bm=nil, input=nil
     # If line already has something, assume we'll add - ##foo/ to it
     if ! Line.matches(/^ *$/)
-      input = Keys.input(:prompt=&gt;&quot;Text to search for: &quot;)
+      input = Keys.prefix_u ? Clipboard.get : Keys.input(:prompt=&gt;&quot;Text to search for: &quot;)
       indent = Line.indent
       Line.to_right
       View.insert &quot;\n#{indent}  - ###{input}/&quot;
@@ -573,7 +573,7 @@ class Search
     bm ||= Keys.input(:timed=&gt;true, :prompt=&gt;&quot;Enter bookmark in which to search: &quot;)
     return unless bm
     input ||= Keys.prefix_u? ?   # Do search
-      Clipboard.get(&quot;0&quot;) :
+      Clipboard.get :
       Keys.input(:prompt=&gt;&quot;Text to search for: &quot;)
 
     if bm == &quot;.&quot;   # Do tree in dir from bookmark
@@ -664,6 +664,22 @@ class Search
     View.to right + left_tag.length
   end
 
+
+  def self.isearch_just_wrap
+    Search.clear
+    left, right = Search.left, Search.right
+
+    wrap_with = Keys.input :timed=&gt;true, :prompt=&gt;&quot;Enter string to wrap match with: &quot;
+
+    View.to(right)
+    View.insert wrap_with
+    View.to(left)
+    View.insert wrap_with
+    View.to right + wrap_with.length
+  end
+
+
+
   def self.just_orange
     Search.clear
     Overlay.face(:notes_label, :left=&gt;Search.left, :right=&gt;Search.right)</diff>
      <filename>search.rb</filename>
    </modified>
    <modified>
      <diff>@@ -677,7 +677,8 @@ class View
 
   def self.expand_path path
     # Expand .
-    path = path.gsub /^\.\//, View.dir.sub(/[^\/]$/, '')+'/'
+    path = path.gsub /^\.\//, View.dir.sub(/\/$/, '')+'/'
+
     # Expand ~
     slash = path =~ /\/$/   # Check whether / at end
     path = File.expand_path path</diff>
      <filename>view.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,6 +13,7 @@ classes = Dir[&quot;**/*.rb&quot;]
 classes = classes.select{|i| i !~ /xiki.rb$/}   # Remove self
 classes = classes.select{|i| i !~ /key_bindings.rb$/}   # Remove key_bindings
 classes = classes.select{|i| i !~ /tests\//}   # Remove tests
+classes = classes.select{|i| i !~ /spec\//}   # Remove tests
 
 classes.map!{|i| i.sub(/\.rb$/, '')}.sort!
 </diff>
      <filename>xiki.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>162446e7265379e32dcef83a66b5e0fc240ee813</id>
    </parent>
  </parents>
  <author>
    <name>trogdoro</name>
    <email>craig.muth@gmail.com</email>
  </author>
  <url>http://github.com/trogdoro/xiki/commit/9a0fee29f78660c0180a1f55561328d47932e62c</url>
  <id>9a0fee29f78660c0180a1f55561328d47932e62c</id>
  <committed-date>2009-02-15T19:50:39-08:00</committed-date>
  <authored-date>2009-02-15T19:50:39-08:00</authored-date>
  <message>Remote tree: Keys.do_as_remote saves remote files.  Rspec: added RakeFile to run specs.</message>
  <tree>6b53b0a9f31746b4a71542ca2ec0590da5d83f56</tree>
  <committer>
    <name>trogdoro</name>
    <email>craig.muth@gmail.com</email>
  </committer>
</commit>
