summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-11-29 13:39:04 +0000
committerManolo Gouy <Manolo>2010-11-29 13:39:04 +0000
commit8c6c5c9ec36bf0c0ba73ed0c8d7d0adcbead61dd (patch)
treebd00171680643abb2239a04fea39dad2ec9cdd50 /src
parentb2d7e70851daacf582f98b2be9352bf278f363ba (diff)
Fixes STR #2460 and also fixes linefull selection by triple click
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7908 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Text_Display.cxx34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx
index 945f43fc2..e19367f9a 100644
--- a/src/Fl_Text_Display.cxx
+++ b/src/Fl_Text_Display.cxx
@@ -3594,8 +3594,6 @@ int Fl_Text_Display::handle(int event) {
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,18 +3658,26 @@ int Fl_Text_Display::handle(int event) {
}
case FL_RELEASE: {
- 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;
+ 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;
+ }
const char* copy = buffer()->selection_text();
if (*copy) Fl::copy(copy, strlen(copy), 0);