diff options
author | Colomban Wendling <ban@herbesfolles.org> | 2012-08-25 00:07:55 +0200 |
---|---|---|
committer | Colomban Wendling <ban@herbesfolles.org> | 2012-08-25 00:07:55 +0200 |
commit | d88283eb94e318406cf3b6c1c3d489668ac8e804 (patch) | |
tree | 7ed258d66aefa1c70e282f4c3361f468187e4454 | |
parent | 8fb28f024bf597b55e8dbdf2bd11e3f9d69a5a41 (diff) | |
download | scintilla-mirror-d88283eb94e318406cf3b6c1c3d489668ac8e804.tar.gz |
Add SCI_VCHOMEDISPLAY keyboard command
This works like SCI_HOMEDISPLAY but goes to the first visible character
if on a logical line, like does SCI_VCHOME. This command makes it
possible to use display-line-aware commands while keeping the "smart
home" feature.
-rw-r--r-- | include/Scintilla.h | 1 | ||||
-rw-r--r-- | include/Scintilla.iface | 4 | ||||
-rw-r--r-- | src/Editor.cxx | 12 |
3 files changed, 17 insertions, 0 deletions
diff --git a/include/Scintilla.h b/include/Scintilla.h index 63fe4fff5..f415b8e59 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -874,6 +874,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_PROPERTYTYPE 4015 #define SCI_DESCRIBEPROPERTY 4016 #define SCI_DESCRIBEKEYWORDSETS 4017 +#define SCI_VCHOMEDISPLAY 4018 #define SC_MOD_INSERTTEXT 0x1 #define SC_MOD_DELETETEXT 0x2 #define SC_MOD_CHANGESTYLE 0x4 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 138730e61..677dcf855 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -2328,6 +2328,10 @@ fun int DescribeProperty=4016(string name, stringresult description) # Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer. fun int DescribeKeyWordSets=4017(, stringresult descriptions) +# Move caret to before first visible character on display line. +# If already there move to first character on display line. +fun void VCHomeDisplay=4018(,) + # Notifications # Type of modification and the action which caused the modification. # These are defined as a bit mask to make it easy to specify which notifications are wanted. diff --git a/src/Editor.cxx b/src/Editor.cxx index 4a52f38ce..eb616389f 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -4764,6 +4764,7 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lPar case SCI_VCHOMEEXTEND: case SCI_VCHOMEWRAP: case SCI_VCHOMEWRAPEXTEND: + case SCI_VCHOMEDISPLAY: case SCI_DELWORDLEFT: case SCI_DELWORDRIGHT: case SCI_DELWORDRIGHTEND: @@ -5558,6 +5559,16 @@ int Editor::KeyCommand(unsigned int iMessage) { StartEndDisplayLine(sel.MainCaret(), true), -1)); SetLastXChosen(); break; + case SCI_VCHOMEDISPLAY: { + SelectionPosition homePos = SelectionPosition(pdoc->VCHomePosition(sel.MainCaret())); + SelectionPosition viewLineStart = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1); + if (viewLineStart > homePos) + homePos = viewLineStart; + + MovePositionTo(homePos); + SetLastXChosen(); + } + break; case SCI_HOMEDISPLAYEXTEND: MovePositionTo(MovePositionSoVisible( StartEndDisplayLine(sel.MainCaret(), true), -1), Selection::selStream); @@ -8648,6 +8659,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_VCHOMEEXTEND: case SCI_VCHOMEWRAP: case SCI_VCHOMEWRAPEXTEND: + case SCI_VCHOMEDISPLAY: case SCI_ZOOMIN: case SCI_ZOOMOUT: case SCI_DELWORDLEFT: |