diff options
Diffstat (limited to 'src/scintilla_backports/6160_a1a9cde51997.patch')
-rw-r--r-- | src/scintilla_backports/6160_a1a9cde51997.patch | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/src/scintilla_backports/6160_a1a9cde51997.patch b/src/scintilla_backports/6160_a1a9cde51997.patch new file mode 100644 index 00000000..093ba79a --- /dev/null +++ b/src/scintilla_backports/6160_a1a9cde51997.patch @@ -0,0 +1,142 @@ +# HG changeset patch +# User Vicente +# Date 1491085058 -36000 +# Node ID a1a9cde519976fa12e46224d6cd57483bc4633ae +# Parent 67865d8e5a374e2cf9468e9b2638901342b1dca0 +Added "Reverse Selected Lines" as SCI_LINEREVERSE. + +diff -r 67865d8e5a37 -r a1a9cde51997 doc/ScintillaDoc.html +--- a/doc/ScintillaDoc.html Sat Apr 01 13:30:58 2017 +1100 ++++ b/doc/ScintillaDoc.html Sun Apr 02 08:17:38 2017 +1000 +@@ -5199,15 +5199,18 @@ + <td><code>SCI_DELLINERIGHT</code></td> + + <td><code>SCI_LINEDELETE</code></td> +- </tr> +- +- <tr> ++ + <td><code>SCI_LINECUT</code></td> ++ </tr> ++ ++ <tr> + + <td><code>SCI_LINECOPY</code></td> + + <td><code>SCI_LINETRANSPOSE</code></td> + ++ <td><code>SCI_LINEREVERSE</code></td> ++ + <td><code>SCI_LINEDUPLICATE</code></td> + </tr> + +diff -r 67865d8e5a37 -r a1a9cde51997 doc/ScintillaHistory.html +--- a/doc/ScintillaHistory.html Sat Apr 01 13:30:58 2017 +1100 ++++ b/doc/ScintillaHistory.html Sun Apr 02 08:17:38 2017 +1000 +@@ -527,6 +527,9 @@ + Released 21 March 2017. + </li> + <li> ++ Added "Reverse Selected Lines" feature. ++ </li> ++ <li> + Updated case conversion and character categories to Unicode 9. + </li> + <li> +diff -r 67865d8e5a37 -r a1a9cde51997 include/Scintilla.h +--- a/include/Scintilla.h Sat Apr 01 13:30:58 2017 +1100 ++++ b/include/Scintilla.h Sun Apr 02 08:17:38 2017 +1000 +@@ -638,6 +638,7 @@ + #define SCI_LINECUT 2337 + #define SCI_LINEDELETE 2338 + #define SCI_LINETRANSPOSE 2339 ++#define SCI_LINEREVERSE 2354 + #define SCI_LINEDUPLICATE 2404 + #define SCI_LOWERCASE 2340 + #define SCI_UPPERCASE 2341 +diff -r 67865d8e5a37 -r a1a9cde51997 include/Scintilla.iface +--- a/include/Scintilla.iface Sat Apr 01 13:30:58 2017 +1100 ++++ b/include/Scintilla.iface Sun Apr 02 08:17:38 2017 +1000 +@@ -1614,6 +1614,9 @@ + # Switch the current line with the previous. + fun void LineTranspose=2339(,) + ++# Reverse order of selected lines. ++fun void LineReverse=2354(,) ++ + # Duplicate the current line. + fun void LineDuplicate=2404(,) + +diff -r 67865d8e5a37 -r a1a9cde51997 src/Editor.cxx +--- a/src/Editor.cxx Sat Apr 01 13:30:58 2017 +1100 ++++ b/src/Editor.cxx Sun Apr 02 08:17:38 2017 +1000 +@@ -2800,6 +2800,7 @@ + case SCI_LINECUT: + case SCI_LINEDELETE: + case SCI_LINETRANSPOSE: ++ case SCI_LINEREVERSE: + case SCI_LINEDUPLICATE: + case SCI_LOWERCASE: + case SCI_UPPERCASE: +@@ -2967,6 +2968,32 @@ + } + } + ++void Editor::LineReverse() { ++ const Sci::Line lineStart = pdoc->LineFromPosition(sel.RangeMain().Start().Position()); ++ const Sci::Line lineEnd = pdoc->LineFromPosition(sel.RangeMain().End().Position()-1); ++ const Sci::Line lineDiff = lineEnd - lineStart; ++ if (lineDiff <= 0) ++ return; ++ UndoGroup ug(pdoc); ++ for (Sci::Line i=(lineDiff+1)/2-1; i>=0; --i) { ++ const Sci::Line lineNum2 = lineEnd - i; ++ const Sci::Line lineNum1 = lineStart + i; ++ Sci::Position lineStart2 = pdoc->LineStart(lineNum2); ++ const Sci::Position lineStart1 = pdoc->LineStart(lineNum1); ++ const std::string line2 = RangeText(lineStart2, pdoc->LineEnd(lineNum2)); ++ const std::string line1 = RangeText(lineStart1, pdoc->LineEnd(lineNum1)); ++ const Sci::Position lineLen2 = static_cast<Sci::Position>(line2.length()); ++ const Sci::Position lineLen1 = static_cast<Sci::Position>(line1.length()); ++ pdoc->DeleteChars(lineStart2, lineLen2); ++ pdoc->DeleteChars(lineStart1, lineLen1); ++ lineStart2 -= lineLen1; ++ pdoc->InsertString(lineStart2, line1.c_str(), lineLen1); ++ pdoc->InsertString(lineStart1, line2.c_str(), lineLen2); ++ } ++ // Wholly select all affected lines ++ sel.RangeMain() = SelectionRange(pdoc->LineStart(lineStart), pdoc->LineStart(lineEnd+1)); ++} ++ + void Editor::Duplicate(bool forLine) { + if (sel.Empty()) { + forLine = true; +@@ -3809,6 +3836,9 @@ + case SCI_LINETRANSPOSE: + LineTranspose(); + break; ++ case SCI_LINEREVERSE: ++ LineReverse(); ++ break; + case SCI_LINEDUPLICATE: + Duplicate(true); + break; +@@ -7453,6 +7483,7 @@ + case SCI_LINECUT: + case SCI_LINEDELETE: + case SCI_LINETRANSPOSE: ++ case SCI_LINEREVERSE: + case SCI_LINEDUPLICATE: + case SCI_LOWERCASE: + case SCI_UPPERCASE: +diff -r 67865d8e5a37 -r a1a9cde51997 src/Editor.h +--- a/src/Editor.h Sat Apr 01 13:30:58 2017 +1100 ++++ b/src/Editor.h Sun Apr 02 08:17:38 2017 +1000 +@@ -460,6 +460,7 @@ + virtual std::string CaseMapString(const std::string &s, int caseMapping); + void ChangeCaseOfSelection(int caseMapping); + void LineTranspose(); ++ void LineReverse(); + void Duplicate(bool forLine); + virtual void CancelModes(); + void NewLine(); |