aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Driessen <vincent@datafox.nl>2010-08-19 00:06:01 +0200
committerVincent Driessen <vincent@datafox.nl>2010-08-19 00:06:01 +0200
commitd60cc9ea566ccf5049faf9b3d8decee7cf1818c6 (patch)
treefbbb575943ada3a2faaebaf366fb3a0388370615
parent7e25451273cdd2dde062217a0d161674fcbba560 (diff)
downloadvim-rst-tables-d60cc9ea566ccf5049faf9b3d8decee7cf1818c6.tar.gz
vim-rst-tables-d60cc9ea566ccf5049faf9b3d8decee7cf1818c6.tar.bz2
vim-rst-tables-d60cc9ea566ccf5049faf9b3d8decee7cf1818c6.zip
Finish the CreateTable() function, now we're done with the details.
-rw-r--r--ftplugin/rst_tables.vim19
-rw-r--r--src/rst_tables.py19
2 files changed, 6 insertions, 32 deletions
diff --git a/ftplugin/rst_tables.vim b/ftplugin/rst_tables.vim
index ed451e1..d786f7c 100644
--- a/ftplugin/rst_tables.vim
+++ b/ftplugin/rst_tables.vim
@@ -18,7 +18,6 @@ import re
from vim_bridge import bridged
-@bridged # {{{
def get_table_bounds():
row, col = vim.current.window.cursor
upper = lower = row
@@ -39,7 +38,6 @@ def get_table_bounds():
lower -= 1
return (upper, lower)
- # }}}
def unify_table(table):
@@ -134,23 +132,12 @@ def draw_table(table):
return output
+@bridged
def create_table():
upper, lower = get_table_bounds()
slice = vim.current.buffer[upper - 1:lower]
- slice = """\
-+==========+================================================================================================+
-| 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. |
-+----------+------------------------------------------------------------------------------------------------+
-""".strip().split('\n')
-
- #table = parse_table(slice)
- #slice = draw_table(table)
+ table = parse_table(slice)
+ slice = draw_table(table)
vim.current.buffer[upper - 1:lower] = slice
endpython
diff --git a/src/rst_tables.py b/src/rst_tables.py
index 0a93ea9..3368a6f 100644
--- a/src/rst_tables.py
+++ b/src/rst_tables.py
@@ -3,7 +3,6 @@ import re
from vim_bridge import bridged
-@bridged # {{{
def get_table_bounds():
row, col = vim.current.window.cursor
upper = lower = row
@@ -24,7 +23,6 @@ def get_table_bounds():
lower -= 1
return (upper, lower)
- # }}}
def unify_table(table):
@@ -119,21 +117,10 @@ def draw_table(table):
return output
+@bridged
def create_table():
upper, lower = get_table_bounds()
slice = vim.current.buffer[upper - 1:lower]
- slice = """\
-+==========+================================================================================================+
-| 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. |
-+----------+------------------------------------------------------------------------------------------------+
-""".strip().split('\n')
-
- #table = parse_table(slice)
- #slice = draw_table(table)
+ table = parse_table(slice)
+ slice = draw_table(table)
vim.current.buffer[upper - 1:lower] = slice