From 9147256a8a85379c9a0586693f8f64da630126e5 Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Thu, 19 Aug 2010 00:01:50 +0200 Subject: Fix: vim.buffer -> vim.current.buffer --- ftplugin/rst_tables.vim | 8 ++++---- src/rst_tables.py | 8 ++++---- tests/test_rst_tables.py | 14 +++++++------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ftplugin/rst_tables.vim b/ftplugin/rst_tables.vim index 43e6daf..ed451e1 100644 --- a/ftplugin/rst_tables.vim +++ b/ftplugin/rst_tables.vim @@ -23,7 +23,7 @@ def get_table_bounds(): row, col = vim.current.window.cursor upper = lower = row try: - while vim.buffer[upper - 1].strip(): + while vim.current.buffer[upper - 1].strip(): upper -= 1 except IndexError: pass @@ -31,7 +31,7 @@ def get_table_bounds(): upper += 1 try: - while vim.buffer[lower - 1].strip(): + while vim.current.buffer[lower - 1].strip(): lower += 1 except IndexError: pass @@ -136,7 +136,7 @@ def draw_table(table): def create_table(): upper, lower = get_table_bounds() - slice = vim.buffer[upper - 1:lower] + slice = vim.current.buffer[upper - 1:lower] slice = """\ +==========+================================================================================================+ | Column 1 | Column 2 | @@ -151,7 +151,7 @@ def create_table(): #table = parse_table(slice) #slice = draw_table(table) - vim.buffer[upper - 1:lower] = slice + vim.current.buffer[upper - 1:lower] = slice endpython diff --git a/src/rst_tables.py b/src/rst_tables.py index 7a0bf99..0a93ea9 100644 --- a/src/rst_tables.py +++ b/src/rst_tables.py @@ -8,7 +8,7 @@ def get_table_bounds(): row, col = vim.current.window.cursor upper = lower = row try: - while vim.buffer[upper - 1].strip(): + while vim.current.buffer[upper - 1].strip(): upper -= 1 except IndexError: pass @@ -16,7 +16,7 @@ def get_table_bounds(): upper += 1 try: - while vim.buffer[lower - 1].strip(): + while vim.current.buffer[lower - 1].strip(): lower += 1 except IndexError: pass @@ -121,7 +121,7 @@ def draw_table(table): def create_table(): upper, lower = get_table_bounds() - slice = vim.buffer[upper - 1:lower] + slice = vim.current.buffer[upper - 1:lower] slice = """\ +==========+================================================================================================+ | Column 1 | Column 2 | @@ -136,4 +136,4 @@ def create_table(): #table = parse_table(slice) #slice = draw_table(table) - vim.buffer[upper - 1:lower] = slice + vim.current.buffer[upper - 1:lower] = slice diff --git a/tests/test_rst_tables.py b/tests/test_rst_tables.py index e31cab9..d44c234 100644 --- a/tests/test_rst_tables.py +++ b/tests/test_rst_tables.py @@ -40,19 +40,19 @@ a line ending. def testGetBounds(self): input = self.plain - vim.buffer = input.split('\n') + vim.current.buffer = input.split('\n') vim.current.window.cursor = (4, 0) self.assertEquals((3, 6), get_table_bounds()) def testGetBoundsOnBeginOfFile(self): input = self.plain - vim.buffer = input.split('\n') + vim.current.buffer = input.split('\n') vim.current.window.cursor = (1, 0) self.assertEquals((1, 1), get_table_bounds()) def testGetBoundsOnEndOfFile(self): input = self.plain - vim.buffer = input.split('\n') + vim.current.buffer = input.split('\n') vim.current.window.cursor = (8, 0) self.assertEquals((8, 9), get_table_bounds()) @@ -63,14 +63,14 @@ a line ending. def testParseTable(self): input = self.plain - vim.buffer = input.split('\n') + vim.current.buffer = input.split('\n') expected = [ ['Column 1', 'Column 2'], ['Foo', 'Put two (or more) spaces as a field separator.'], ['Bar', 'Even very very long lines like these are fine, as long as you do not put in line endings here.'], ['Qux', 'This is the last line.'], ] - self.assertEquals(expected, parse_table(vim.buffer[2:6])) + self.assertEquals(expected, parse_table(vim.current.buffer[2:6])) def testParseTableUnifiesColumns(self): input = ['x y', 'a b c', 'only one'] @@ -141,7 +141,7 @@ This is paragraph text *before* the table. This is paragraph text *after* the table, with a line ending. """.split('\n') - vim.buffer = input.split('\n') + vim.current.buffer = input.split('\n') vim.current.window.cursor = (4, 10) create_table() - self.assertEquals(expect, vim.buffer) + self.assertEquals(expect, vim.current.buffer) -- cgit v1.2.3