glutanimate / syntax-highlighting

A fork of Tiago Barroso's Syntax Highlighting add-on with support for Anki 2.1
https://ankiweb.net/shared/info/1463041493
Other
108 stars 27 forks source link

When pasting, strip common padding of entire block of code #18

Open hakakou opened 4 years ago

hakakou commented 4 years ago

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: