Skip to content

Commit

Permalink
Do not assume height of table rows are always odd
Browse files Browse the repository at this point in the history
Should prevent tablemode errors when using rows > 1 line.

Note: Does not solve problem when cells span multiple rows.
  • Loading branch information
R1dO committed Sep 9, 2017
1 parent e56d757 commit 07f2a0b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ReText/tablemode.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,11 @@ def _getTableLines(doc, pos, markupClass):
row.separatorline = True
row.paddingchar = '-'
elif markupClass == ReStructuredTextMarkup:
for i, row in enumerate(rows):
if i & 1 == 0: # i is even
for row in rows:
if row.text.strip().startswith(('+-','+=')):
row.separatorline = True
row.paddingchar = '=' if (i == 2) else '-'
row.paddingchar = row.text.strip()[1]
row.text = row.text.replace('+', '|')

return rows, editedlineindex, offset

def _sortaUndoEdit(rows, editedlineindex, editsize):
Expand Down

0 comments on commit 07f2a0b

Please sign in to comment.