From a2aad3f4adca979ad4da66764655b94bae648574 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Mon, 6 Jul 2009 01:15:56 +0000 Subject: Allow drag and drop in virtual space. --- src/Selection.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/Selection.cxx') diff --git a/src/Selection.cxx b/src/Selection.cxx index 224fafc69..715319602 100644 --- a/src/Selection.cxx +++ b/src/Selection.cxx @@ -70,6 +70,26 @@ int SelectionRange::Length() const { } } +#ifdef NEEDED +// Like Length but takes virtual space into account +int SelectionRange::Width() const { + SelectionPosition first; + SelectionPosition last; + if (anchor > caret) { + first = caret; + last = anchor; + } else { + first = anchor; + last = caret; + } + if (first.Position() == last.Position()) { + return last.VirtualSpace() - first.VirtualSpace(); + } else { + return last.Position() - first.Position() + last.VirtualSpace(); + } +} +#endif + bool SelectionRange::Contains(int pos) const { if (anchor > caret) return (pos >= caret.Position()) && (pos <= anchor.Position()); -- cgit v1.2.3