Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support edits on tables embedded in text files #1

Open
wadetb opened this issue May 30, 2014 · 2 comments
Open

Support edits on tables embedded in text files #1

wadetb opened this issue May 30, 2014 · 2 comments

Comments

@wadetb
Copy link
Owner

wadetb commented May 30, 2014

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:

  1. Selection
  2. Scanning forwards & backwards from the cursor for a blank line

Maybe provide global modes like "operate on selection" vs "operate on file".

@wadetb
Copy link
Owner Author

wadetb commented Jul 23, 2015

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
Copy link
Owner Author

wadetb commented Jul 23, 2015

A more general way to implement this would be:

  1. For each cursor and selection region, extend a region forwards and backwards for the nearest blank line or end of document.
  2. Merge the resultant regions where they overlap.
  3. 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant