diff --git a/src/ct/ct_main_win.h b/src/ct/ct_main_win.h index 609cef7f1..56afa8e98 100644 --- a/src/ct/ct_main_win.h +++ b/src/ct/ct_main_win.h @@ -161,7 +161,7 @@ class CtMainWin : public Gtk::ApplicationWindow void apply_scalable_properties(Glib::RefPtr rTextTag, CtScalableTag* pCtScalableTag); Glib::ustring sourceview_hovering_link_get_tooltip(const Glib::ustring& link); bool apply_tag_try_automatic_bounds(Glib::RefPtr text_buffer, Gtk::TextIter iter_start); - void apply_tag_try_automatic_bounds_triple_click(Glib::RefPtr text_buffer, Gtk::TextIter iter_start); + void apply_tag_try_automatic_bounds_paragraph(Glib::RefPtr text_buffer, Gtk::TextIter iter_start); private: Gtk::HBox& _init_status_bar(); diff --git a/src/ct/ct_main_win_buffer.cc b/src/ct/ct_main_win_buffer.cc index b4cf3a0bb..655c8070f 100644 --- a/src/ct/ct_main_win_buffer.cc +++ b/src/ct/ct_main_win_buffer.cc @@ -382,8 +382,8 @@ bool CtMainWin::apply_tag_try_automatic_bounds(Glib::RefPtr tex } // Try to select the full paragraph -void CtMainWin::apply_tag_try_automatic_bounds_triple_click(Glib::RefPtr text_buffer, - Gtk::TextIter iter_start) +void CtMainWin::apply_tag_try_automatic_bounds_paragraph(Glib::RefPtr text_buffer, + Gtk::TextIter iter_start) { Gtk::TextIter iter_end = iter_start; iter_end.forward_to_line_end(); diff --git a/src/ct/ct_main_win_events.cc b/src/ct/ct_main_win_events.cc index 3e417b529..8b2d379f2 100644 --- a/src/ct/ct_main_win_events.cc +++ b/src/ct/ct_main_win_events.cc @@ -510,11 +510,7 @@ void CtMainWin::_on_textview_event_after(GdkEvent* event) _ctTextview.for_event_after_double_click_button1(event); } if (event->type == GDK_3BUTTON_PRESS and event->button.button == 1) { - if (curr_tree_iter().get_node_is_rich_text() and _pCtConfig->tripleClickParagraph) { - if (_ctTextview.get_todo_rotate_time() != event->button.time) { - _ctTextview.for_event_after_triple_click_button1(event); - } - } + _ctTextview.for_event_after_triple_click_button1(event); } else if (event->type == GDK_BUTTON_PRESS or event->type == GDK_KEY_PRESS) { if (event->type == GDK_BUTTON_PRESS) { diff --git a/src/ct/ct_text_view.cc b/src/ct/ct_text_view.cc index f448a0a93..c8f6c148a 100644 --- a/src/ct/ct_text_view.cc +++ b/src/ct/ct_text_view.cc @@ -249,18 +249,32 @@ void CtTextView::for_event_after_double_click_button1(GdkEvent* event) window_to_buffer_coords(Gtk::TEXT_WINDOW_TEXT, (int)event->button.x, (int)event->button.y, x, y); Gtk::TextIter iter_start; get_iter_at_location(iter_start, x, y); + const auto pGutterLineNumbers = get_gutter(Gtk::TEXT_WINDOW_LEFT); + if (pGutterLineNumbers) { + const auto pGutterLNWindow = pGutterLineNumbers->get_window(); + if (pGutterLNWindow and pGutterLNWindow->gobj() == event->button.window) { + // line number click + _pCtMainWin->apply_tag_try_automatic_bounds_paragraph(text_buffer, iter_start); + return; + } + } _pCtMainWin->apply_tag_try_automatic_bounds(text_buffer, iter_start); } // Called after every Triple Click with button 1 void CtTextView::for_event_after_triple_click_button1(GdkEvent* event) { - auto text_buffer = get_buffer(); - int x, y; - window_to_buffer_coords(Gtk::TEXT_WINDOW_TEXT, (int)event->button.x, (int)event->button.y, x, y); - Gtk::TextIter iter_start; - get_iter_at_location(iter_start, x, y); - _pCtMainWin->apply_tag_try_automatic_bounds_triple_click(text_buffer, iter_start); + if (_pCtConfig->tripleClickParagraph and + _pCtMainWin->curr_tree_iter().get_node_is_rich_text() and + get_todo_rotate_time() != event->button.time) + { + auto text_buffer = get_buffer(); + int x, y; + window_to_buffer_coords(Gtk::TEXT_WINDOW_TEXT, (int)event->button.x, (int)event->button.y, x, y); + Gtk::TextIter iter_start; + get_iter_at_location(iter_start, x, y); + _pCtMainWin->apply_tag_try_automatic_bounds_paragraph(text_buffer, iter_start); + } } #ifdef MD_AUTO_REPLACEMENT @@ -304,7 +318,7 @@ void CtTextView::for_event_after_button_press(GdkEvent* event) const auto pGutterLNWindow = pGutterLineNumbers->get_window(); if (pGutterLNWindow and pGutterLNWindow->gobj() == event->button.window) { // line number click - _pCtMainWin->apply_tag_try_automatic_bounds_triple_click(text_buffer, text_iter); + _pCtMainWin->apply_tag_try_automatic_bounds(text_buffer, text_iter); return; } }