コード例 #1
0
        public new void mouseDown(NSEvent evt)
        {
            bool done = false;

            // This is kind of nice, and BBEdit does something similar but it screws
            // up things like drag selections.
            if (evt.modifierFlags_i() == 256)
            {
                int index = DoMouseEventToIndex(evt);
                NSString text = string_();

                // If the user clicked in the whitespace at the start of a line then set
                // the insertion point to the start of the line. TODO: may want a pref
                // for this.
                int start = DoGetLineStartFromSpaceOrTab(text, index);
                if (start >= 0)
                {
                    setSelectedRange(new NSRange(start, 0));
                    done = true;
                }
            }

            if (!done)
                SuperCall(NSTextView.Class, "mouseDown:", evt);
        }