Author: manolo
Date: 2010-11-29 05:39:04 -0800 (Mon, 29 Nov 2010)
New Revision: 7908
Log:
Fixes STR #2460 and also fixes linefull selection by triple click

Modified:
   branches/branch-1.3/src/Fl_Text_Display.cxx

Modified: branches/branch-1.3/src/Fl_Text_Display.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Text_Display.cxx 2010-11-28 21:57:37 UTC (rev 
7907)
+++ branches/branch-1.3/src/Fl_Text_Display.cxx 2010-11-29 13:39:04 UTC (rev 
7908)
@@ -3594,8 +3594,6 @@
         buffer()->unselect();
       else if (dragType == DRAG_WORD)
         buffer()->select(word_start(pos), word_end(pos));
-      else if (dragType == DRAG_LINE)
-        buffer()->select(buffer()->line_start(pos), 
buffer()->next_char(buffer()->line_end(pos)));
       
       if (buffer()->primary_selection()->selected())
         insert_position(buffer()->primary_selection()->end());
@@ -3660,19 +3658,27 @@
     }
       
     case FL_RELEASE: {
-      dragging = 0;
-      if (scroll_direction) {
-        Fl::remove_timeout(scroll_timer_cb, this);
-        scroll_direction = 0;
-      }
+      if (Fl::event_is_click() && (! Fl::event_clicks()) && 
buffer()->primary_selection()->includes(dragPos) ) {
+       buffer()->unselect(); // clicking in the selection: unselect and move 
cursor
+       insert_position(dragPos);
+       return 1;
+      } else if (Fl::event_clicks() == DRAG_LINE) {
+        buffer()->select(buffer()->line_start(dragPos), 
buffer()->next_char(buffer()->line_end(dragPos)));
+      } else {
+       dragging = 0;
+       if (scroll_direction) {
+         Fl::remove_timeout(scroll_timer_cb, this);
+         scroll_direction = 0;
+       }
+       
+       // convert from WORD or LINE selection to CHAR
+       if (insert_position() >= dragPos)
+         dragPos = buffer()->primary_selection()->start();
+       else
+         dragPos = buffer()->primary_selection()->end();
+       dragType = DRAG_CHAR;
+       }
       
-      // convert from WORD or LINE selection to CHAR
-      if (insert_position() >= dragPos)
-        dragPos = buffer()->primary_selection()->start();
-      else
-        dragPos = buffer()->primary_selection()->end();
-      dragType = DRAG_CHAR;
-      
       const char* copy = buffer()->selection_text();
       if (*copy) Fl::copy(copy, strlen(copy), 0);
       free((void*)copy);

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to