8e1c1dc358de

Merge pull request #21 from killphi/fix_spliceinit_crash

Fixes several crash issues with the latest VIm versions
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 05 Nov 2013 08:29:36 -0800
parents 01e68795c7a1 (current diff) ad486b938451 (diff)
children 136a9256bec2
branches/tags (none)
files

Changes

--- a/autoload/splicelib/util/bufferlib.py	Wed Feb 06 11:16:24 2013 -0500
+++ b/autoload/splicelib/util/bufferlib.py	Tue Nov 05 08:29:36 2013 -0800
@@ -6,8 +6,11 @@
 
 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):
@@ -34,23 +37,23 @@
 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