Support edits on tables embedded in text files
Opened this issue · 2 comments
wadetb commented
When working in a large Markdown document, sometimes it's nice to quickly paste some text in CSV format and do some calculations on it.
Identify the table either by one of:
- Selection
- Scanning forwards & backwards from the cursor for a blank line
Maybe provide global modes like "operate on selection" vs "operate on file".
wadetb commented
I'm recently thinking that the best way to implement this is both of the above options.
If there is a selection spanning multiple lines, treat that as the region of text to operate on.
Otherwise, scan from the cursor(s) and operate on each surrounding block.
wadetb commented
A more general way to implement this would be:
- For each cursor and selection region, extend a region forwards and backwards for the nearest blank line or end of document.
- Merge the resultant regions where they overlap.
- Apply the command to each region.
Note that for commands which are destructive, we have to be careful that the individual regions work cumulatively (e.g. select column).