aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Editor.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2016-09-29 13:36:43 +1000
committerNeil <nyamatongwe@gmail.com>2016-09-29 13:36:43 +1000
commitde7dccbae50c839869017a30cd5e57d6ef639242 (patch)
tree6bedd6676770b1381104cddea9d4f0ff17ca5402 /src/Editor.cxx
parentcfe3c049555422cbc7dcf3fd2fadad2f08487dd7 (diff)
downloadscintilla-mirror-de7dccbae50c839869017a30cd5e57d6ef639242.tar.gz
The number of margins can be changed with SCI_SETMARGINS.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r--src/Editor.cxx18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 0e686e101..9fcd01fbb 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -2426,9 +2426,9 @@ void Editor::NotifyIndicatorClick(bool click, int position, bool shift, bool ctr
bool Editor::NotifyMarginClick(Point pt, int modifiers) {
int marginClicked = -1;
int x = vs.textStart - vs.fixedColumnWidth;
- for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) {
+ for (size_t margin = 0; margin < vs.ms.size(); margin++) {
if ((pt.x >= x) && (pt.x < x + vs.ms[margin].width))
- marginClicked = margin;
+ marginClicked = static_cast<int>(margin);
x += vs.ms[margin].width;
}
if ((marginClicked >= 0) && vs.ms[marginClicked].sensitive) {
@@ -4289,7 +4289,7 @@ bool Editor::PointInSelMargin(Point pt) const {
Window::Cursor Editor::GetMarginCursor(Point pt) const {
int x = 0;
- for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) {
+ for (size_t margin = 0; margin < vs.ms.size(); margin++) {
if ((pt.x >= x) && (pt.x < x + vs.ms[margin].width))
return static_cast<Window::Cursor>(vs.ms[margin].cursor);
x += vs.ms[margin].width;
@@ -5569,8 +5569,8 @@ void Editor::AddStyledText(char *buffer, int appendLength) {
SetEmptySelection(sel.MainCaret() + lengthInserted);
}
-static bool ValidMargin(uptr_t wParam) {
- return wParam <= SC_MAX_MARGIN;
+bool Editor::ValidMargin(uptr_t wParam) {
+ return wParam < vs.ms.size();
}
static char *CharPtrFromSPtr(sptr_t lParam) {
@@ -6897,6 +6897,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
else
return 0;
+ case SCI_SETMARGINS:
+ if (wParam < 1000)
+ vs.ms.resize(wParam);
+ break;
+
+ case SCI_GETMARGINS:
+ return vs.ms.size();
+
case SCI_STYLECLEARALL:
vs.ClearStyles();
InvalidateStyleRedraw();