summaryrefslogtreecommitdiff
path: root/src/Fl_Text_Display.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-12-14 17:07:45 +0000
committerManolo Gouy <Manolo>2010-12-14 17:07:45 +0000
commit5889675f7db09dc14cdddc189ad93b152987da7c (patch)
treeccbf011e582b040234fa9b1d3b6dd1ebbc3dcdce /src/Fl_Text_Display.cxx
parent62487fbe23c82e7b5679b0685f82c4e103a8b7a7 (diff)
Fix STR # 2484. Middle mouse button paste now works within an Fl_Text_Editor
and from/to other applications. Also fixed interaction between selection and insertion cursor. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8027 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Text_Display.cxx')
-rw-r--r--src/Fl_Text_Display.cxx17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/Fl_Text_Display.cxx b/src/Fl_Text_Display.cxx
index a512e477e..3891ac3be 100644
--- a/src/Fl_Text_Display.cxx
+++ b/src/Fl_Text_Display.cxx
@@ -3592,10 +3592,14 @@ int Fl_Text_Display::handle(int event) {
return 1;
}
dragType = Fl::event_clicks();
- if (dragType == DRAG_CHAR)
+ if (dragType == DRAG_CHAR) {
buffer()->unselect();
- else if (dragType == DRAG_WORD)
+ Fl::copy("", 0, 0);
+ }
+ else if (dragType == DRAG_WORD) {
buffer()->select(word_start(pos), word_end(pos));
+ dragPos = word_start(pos);
+ }
if (buffer()->primary_selection()->selected())
insert_position(buffer()->primary_selection()->end());
@@ -3667,6 +3671,8 @@ int Fl_Text_Display::handle(int event) {
return 1;
} else if (Fl::event_clicks() == DRAG_LINE) {
buffer()->select(buffer()->line_start(dragPos), buffer()->next_char(buffer()->line_end(dragPos)));
+ dragPos = line_start(dragPos);
+ dragType = DRAG_CHAR;
} else {
dragging = 0;
if (scroll_direction) {
@@ -3675,10 +3681,10 @@ int Fl_Text_Display::handle(int event) {
}
// convert from WORD or LINE selection to CHAR
- if (insert_position() >= dragPos)
+ /*if (insert_position() >= dragPos)
dragPos = buffer()->primary_selection()->start();
else
- dragPos = buffer()->primary_selection()->end();
+ dragPos = buffer()->primary_selection()->end();*/
dragType = DRAG_CHAR;
}
@@ -3725,6 +3731,9 @@ int Fl_Text_Display::handle(int event) {
// Select all ?
if ((Fl::event_state()&(FL_CTRL|FL_COMMAND)) && Fl::event_key()=='a') {
buffer()->select(0,buffer()->length());
+ const char *copy = buffer()->selection_text();
+ if (*copy) Fl::copy(copy, strlen(copy), 0);
+ free((void*)copy);
return 1;
}