vkocubinsky / SublimeTableEditor

This package is no more supported. I moved to vim.
Other
494 stars 67 forks source link

Workflow issues adding colspan to existing table #25

Closed idpaterson closed 11 years ago

idpaterson commented 11 years ago

In the dev branch, I am able to use colspan syntax in Textile, which is a great addition to SublimeTableEditor. However, actually using the feature brings up a few minor workflow issues.

Adding colspan syntax to an empty row pushes new columns; expected behavior is probably to "consume" empty cells.

After entering a header row I press Tab to insert a new row. My editor looks like this:

|_. Attribute Name |_. Required |_. Value Type |
|                  |            |              |

I decide that I want a row spanning all 3 columns, so I type

|_. Attribute Name |_. Required |_. Value Type |
| \3. All Events                 |            |              |

After pressing Tab, my expectation is the following

|_. Attribute Name |_. Required |_. Value Type |
|\3. All Events                                |
|                  |            |              |

However, the current behavior interprets the remaining cells in addition to the spanned cell, adding to each row.

|_. Attribute Name |_. Required |_. Value Type |   |   |
|\3. All Events                                |   |   |

The workaround for this is to manually remove the additional separators from the colspan line before causing the table to be reinterpreted, but it would be nice to not have to do that. I think that the expectation would be different if the cells are not empty, so this could be a bit tricky.

Considering a more complicated table, it will not always be easy to notice that rows were added at the end or to manually remove the proper number of separators. This would certainly be a nice-to-have improvement.

vkocubinsky commented 11 years ago

Usually all rows have the same column count and only one(current) have extra empty columns at the end of row. Idea for fix this is provide configuration setting "table_editor_intelligent_formatting" and if this setting is on remove these extra columns.

I have committed fix into master branch. For try this you should set property "table_editor_intelligent_formatting" to True, because by default "table_editor_intelligent_formatting" is disabled.

It is my Textile.sublime-settings file

{
    "enable_table_editor": true,
    "table_editor_intelligent_formatting":true
}

Your example

|_. Attribute Name |_. Required |_. Value Type |
| \3. All Events                 |            |              |

Formats as you expected

|_. Attribute Name |_. Required |_. Value Type |
|\3. All Events                                |

I guess I will change default settings for "table_editor_intelligent_formatting" to True, because I don't see any drawback.

vkocubinsky commented 11 years ago

I also commited rowspan feature.

Table

|/3. spans 3 rows | a |
| b |
| c |

Formats as

|/3. spans 3 rows | a |
| b               |
| c               |
vkocubinsky commented 11 years ago

If you will have a chance play with "intelligent_formatting" and rowspan send me feedback it very useful for me.

Thanks!

idpaterson commented 11 years ago

Thanks, I will try this later today!

vkocubinsky commented 11 years ago

I changed the default value of "intelligent_formatting" to true ,so you do not need any additional effort to try

idpaterson commented 11 years ago

It looks good to me, the intelligent colspan formatting works well. I'll start a separate issue to talk about rowspan.