summaryrefslogtreecommitdiff
path: root/command/marks.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'command/marks.cpp')
-rw-r--r--command/marks.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/command/marks.cpp b/command/marks.cpp
index f06416d..8442872 100644
--- a/command/marks.cpp
+++ b/command/marks.cpp
@@ -186,6 +186,25 @@ clMark *clMarks::Get(int Position)
return mark;
}
+clMark *clMarks::GetAround(int Position, int Type, int Mask)
+{
+ clMark *m1=GetPrev(Position,Type,Mask);
+ clMark *m2=GetNext(Position,Type,Mask);
+
+ if (!m1 && !m2) return NULL;
+ if (!m1 && m2) return m2;
+ if (m1 && !m2) return m1;
+
+ if (abs(m1->position-Position)>abs(m2->position-Position))
+ {
+ return m2;
+ }
+ else
+ {
+ return m1;
+ }
+}
+
clMark *clMarks::GetPrev(int Position, int Type, int Mask)
{
if (!first) return NULL; // no elements yet