DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: http://www.fltk.org/str.php?L2721
Version: 1.3-feature
I have write code for drawing of cursor on the selected text, but for
Fl_Input I cannot to do it, because there are baffling for me (wrap
mode...)
Regards.
Link: http://www.fltk.org/str.php?L2721
Version: 1.3-feature
--- src/Fl_Text_Display.cxx 2011-08-03 14:17:34.000000000 +0600
+++ src/Fl_Text_Display.cxx 2011-09-30 02:02:05.204000002 +0600
@@ -3444,18 +3444,27 @@
// draw the text cursor
if (damage() & (FL_DAMAGE_ALL | FL_DAMAGE_SCROLL | FL_DAMAGE_EXPOSE)
- && !buffer()->primary_selection()->selected() &&
+ && /* !buffer()->primary_selection()->selected() && */
mCursorOn && Fl::focus() == (Fl_Widget*)this ) {
fl_push_clip(text_area.x-LEFT_MARGIN,
text_area.y,
text_area.w+LEFT_MARGIN+RIGHT_MARGIN,
text_area.h);
- int X, Y;
- if (position_to_xy(mCursorPos, &X, &Y)) draw_cursor(X, Y);
- // else puts("position_to_xy() failed - unable to draw cursor!");
- //printf("drew cursor at pos: %d (%d,%d)\n", mCursorPos, X, Y);
- mCursorOldY = Y;
+ if(buffer()->primary_selection()->selected()){
+ int tmpStart = 0, tmpEnd = 0, tmpCurPos = 0;
+ buffer()->selection_position(&tmpStart, &tmpEnd);
+ if(mCursorPos == tmpEnd){ tmpCurPos = tmpEnd; }
+ else { tmpCurPos = tmpStart; }
+ if (position_to_xy(tmpCurPos, &tmpStart, &tmpEnd)) draw_cursor(tmpStart,
tmpEnd);
+ mCursorOldY = tmpEnd;
+ } else {
+ int X, Y;
+ if (position_to_xy(mCursorPos, &X, &Y)) draw_cursor(X, Y);
+ // else puts("position_to_xy() failed - unable to draw cursor!");
+ //printf("drew cursor at pos: %d (%d,%d)\n", mCursorPos, X, Y);
+ mCursorOldY = Y;
+ }
fl_pop_clip();
}
fl_pop_clip();
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev