syntax-highlighting icon indicating copy to clipboard operation
syntax-highlighting copied to clipboard

When pasting, strip common padding of entire block of code

Open hakakou opened this issue 5 years ago • 0 comments

Description

Before pasting a block of code, all common padding is stripped, but relative indentation is preserved. I needed this because C# tends to have a lot of indentation if the interesting code happens to be already nested deep in some namespace/class/function. By trimming the common white space, the code is much easier to read on a cell phone with limited space (less need for horizontal scrolling).

For example, copying and pasting:

                param.MetaRequest = new BoxMetaRequest[]
                {
                    new BoxMetaRequest()
                    {
                          Name = "Frame",
                    }
                }

Becomes:

param.MetaRequest = new BoxMetaRequest[]
{
    new BoxMetaRequest()
    {
          Name = "Frame",
    }
}

Checklist:

Please replace the space inside the brackets with an x and fill out the ellipses if the following items apply:

  • [x] I've read and understood the contribution guidelines
  • [x] I've tested my changes against at least one of the following Anki builds:
    • [x] Latest standard Anki 2.1 binary build [required for Anki-compatible 2.1 add-ons]
    • [ ] Latest alternative Anki 2.1 binary build
    • [ ] Latest Anki 2.0 binary build [required for Anki 2.0-compatible add-ons]
  • [x] I've tested my changes on at least one of the following platforms:
    • [ ] Linux, version:
    • [x] Windows, version: 10
    • [ ] macOS, version:
  • [x] My changes potentially affect non-desktop platforms, of which I've tested:
    • [ ] AnkiMobile, version:
    • [x] AnkiDroid, version: 2.9.2
    • [x] AnkiWeb

hakakou avatar Feb 11 '20 20:02 hakakou