コード例 #1
0
        public void sel_to_word_right()
        {
            if (sel_len_ == 0)
            {
                moving_ = move_direction_type.right;
            }

            bool moved_now       = false;
            bool needs_readd_now = false;

            move_sel_one_char_right(ref moved_now, ref needs_readd_now);
            bool needs_readd = needs_readd_now;
            bool moved       = moved_now;

            while (moved_now)
            {
                bool reached_word = string_search.is_delim_or_does_not_exist(Text, moving_ == move_direction_type.right ? sel_start_ + sel_len_ - 1 : sel_start_);
                if (reached_word)
                {
                    break;
                }
                move_sel_one_char_right(ref moved_now, ref needs_readd_now);
                needs_readd = needs_readd | needs_readd_now;
            }

            if (needs_readd)
            {
                readd_all_text();
            }
            if (moved)
            {
                update_cached_sel_text();
                update_selected_text();
            }
        }
コード例 #2
0
        public void sel_to_right()
        {
            if (sel_len_ == 0)
            {
                moving_ = move_direction_type.right;
            }

            bool moved       = false;
            bool needs_readd = false;

            move_sel_one_char_right(ref moved, ref needs_readd);
            if (needs_readd)
            {
                readd_all_text();
            }
            if (moved)
            {
                update_cached_sel_text();
                update_selected_text();
            }
        }
コード例 #3
0
        private void smart_readonly_textbox_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = true;

            if (e.KeyChar == '\x1b')
            {
                // escape
                escape();
                return;
            }
            moving_ = move_direction_type.right;

            string new_text = raw_sel_text() + e.KeyChar, new_text_with_space = "";

            if (raw_sel_text() != "")
            {
                new_text_with_space = raw_sel_text() + " " + e.KeyChar;
            }

            // all searches are case-insensitive
            new_text_with_space = new_text_with_space.ToLower();
            new_text            = new_text.ToLower();

            // first, search ahead
            string txt             = Text.ToLower();
            int    pos_ahead       = sel_start_ < txt.Length ? txt.IndexOf(new_text, sel_start_) : -1;
            int    pos_ahead_space = new_text_with_space != "" && sel_start_ < txt.Length ? txt.IndexOf(new_text_with_space, sel_start_) : -1;

            if (pos_ahead >= 0 || pos_ahead_space >= 0)
            {
                int  new_sel_start = pos_ahead >= 0 ? pos_ahead : pos_ahead_space;
                bool moving        = new_sel_start != sel_start_;
                sel_start_ = new_sel_start;
                sel_len_   = pos_ahead >= 0 ? sel_len_ + 1 : sel_len_ + 2;

                if (moving)
                {
                    readd_all_text();
                }

                update_cached_sel_text();
                update_selected_text();
                return;
            }

            //second, search from start
            pos_ahead       = txt.IndexOf(new_text);
            pos_ahead_space = new_text_with_space != "" ? txt.IndexOf(new_text_with_space) : -1;

            if (pos_ahead >= 0 || pos_ahead_space >= 0)
            {
                int  new_sel_start = pos_ahead >= 0 ? pos_ahead : pos_ahead_space;
                bool moving        = new_sel_start != sel_start_;
                sel_start_ = new_sel_start;
                sel_len_   = pos_ahead >= 0 ? sel_len_ + 1 : sel_len_ + 2;

                if (moving)
                {
                    readd_all_text();
                }

                update_cached_sel_text();
                update_selected_text();
                return;
            }

            // did not find anything, let parent know
            on_search_ahead(new_text);
        }
コード例 #4
0
 public void on_mouse_up()
 {
     moving_           = move_direction_type.none;
     mouse_down_start_ = -1;
     parent_.lv_parent.sel_changed(log_view_sel_change_type.click);
 }
コード例 #5
0
 public void on_mouse_up() {
     moving_ = move_direction_type.none;
     mouse_down_start_ = -1;
     parent_.lv_parent.sel_changed(log_view_sel_change_type.click);
 }
コード例 #6
0
        private void smart_readonly_textbox_KeyPress(object sender, KeyPressEventArgs e) {
            e.Handled = true;

            if ( e.KeyChar == '\x1b') {
                // escape
                escape();
                return;
            }
            moving_ = move_direction_type.right;

            string new_text = raw_sel_text() + e.KeyChar, new_text_with_space = "";
            if (raw_sel_text() != "")
                new_text_with_space = raw_sel_text() + " " + e.KeyChar;

            // all searches are case-insensitive
            new_text_with_space = new_text_with_space.ToLower();
            new_text = new_text.ToLower();

            // first, search ahead
            string txt = Text.ToLower();
            int pos_ahead = sel_start_ < txt.Length ? txt.IndexOf(new_text, sel_start_) : -1;
            int pos_ahead_space = new_text_with_space != "" && sel_start_ < txt.Length ? txt.IndexOf(new_text_with_space, sel_start_) : -1;

            if (pos_ahead >= 0 || pos_ahead_space >= 0) {
                int new_sel_start = pos_ahead >= 0 ? pos_ahead : pos_ahead_space;
                bool moving = new_sel_start != sel_start_;
                sel_start_ = new_sel_start;
                sel_len_ = pos_ahead >= 0 ? sel_len_ + 1 : sel_len_ + 2;

                if (moving)
                    readd_all_text();

                update_cached_sel_text();
                update_selected_text();
                return;
            }

            //second, search from start
            pos_ahead = txt.IndexOf(new_text);
            pos_ahead_space = new_text_with_space != "" ? txt.IndexOf(new_text_with_space) : -1;

            if (pos_ahead >= 0 || pos_ahead_space >= 0) {
                int new_sel_start = pos_ahead >= 0 ? pos_ahead : pos_ahead_space;
                bool moving = new_sel_start != sel_start_;
                sel_start_ = new_sel_start;
                sel_len_ = pos_ahead >= 0 ? sel_len_ + 1 : sel_len_ + 2;

                if (moving)
                    readd_all_text();

                update_cached_sel_text();
                update_selected_text();
                return;                
            }

            // did not find anything, let parent know
            on_search_ahead(new_text);
        }
コード例 #7
0
        public void sel_to_word_right() {
            if ( sel_len_ == 0)
                moving_ = move_direction_type.right;

            bool moved_now = false;
            bool needs_readd_now = false;
            move_sel_one_char_right(ref moved_now, ref needs_readd_now);
            bool needs_readd = needs_readd_now;
            bool moved = moved_now;

            while (moved_now) {
                bool reached_word = string_search.is_delim_or_does_not_exist(Text, moving_ == move_direction_type.right ? sel_start_ + sel_len_ - 1 : sel_start_ );
                if (reached_word)
                    break;
                move_sel_one_char_right(ref moved_now, ref needs_readd_now);
                needs_readd = needs_readd | needs_readd_now;
            }
                
            if ( needs_readd)
                readd_all_text();
            if (moved) {
                update_cached_sel_text();
                update_selected_text();
            }
        }
コード例 #8
0
        public void sel_to_right() {
            if ( sel_len_ == 0)
                moving_ = move_direction_type.right;

            bool moved = false;
            bool needs_readd = false;
            move_sel_one_char_right(ref moved, ref needs_readd);
            if ( needs_readd)
                readd_all_text();
            if (moved) {
                update_cached_sel_text();
                update_selected_text();
            }
        }