Steve Losh avatar Steve Losh committed 8e1c1dc Merge

Merge pull request #21 from killphi/fix_spliceinit_crash

Fixes several crash issues with the latest VIm versions

Comments (0)

Files changed (1)

autoload/splicelib/util/bufferlib.py

 
 class Buffer(object):
     def __init__(self, i):
-        self.number = i + 1
-        self._buffer = vim.buffers[i]
+        self.number = i
+        for b in vim.buffers:
+            if b.number == self.number:
+                self._buffer = b
+                break
         self.name = self._buffer.name
 
     def open(self, winnr=None):
 class _BufferList(object):
     @property
     def original(self):
-        return Buffer(0)
+        return Buffer(1)
 
     @property
     def one(self):
-        return Buffer(1)
+        return Buffer(2)
 
     @property
     def two(self):
-        return Buffer(2)
+        return Buffer(3)
 
     @property
     def result(self):
-        return Buffer(3)
+        return Buffer(4)
 
     @property
     def hud(self):
-        return Buffer(int(vim.eval("bufnr('__Splice_HUD__')")) - 1)
+        return Buffer(int(vim.eval("bufnr('__Splice_HUD__')")))
 
 
     @property
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.