summaryrefslogtreecommitdiffstats
path: root/src/text-context.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2013-05-16 16:29:10 +0000
committerJabiertxo Arraiza Zenotz <jtx@jtx.marker.es>2013-05-16 16:29:10 +0000
commitb0d75ca0f9aea3c7652042d1a6300bbfdf1391e8 (patch)
treefe0c3c3eb28289ad60a96ab65ff6954576834ddc /src/text-context.cpp
parentChange only selected nodes (diff)
parentWin32. More include fixes for glibmm 2.36 (file dialog). (diff)
downloadinkscape-b0d75ca0f9aea3c7652042d1a6300bbfdf1391e8.tar.gz
inkscape-b0d75ca0f9aea3c7652042d1a6300bbfdf1391e8.zip
Update to trunk
(bzr r11950.1.114)
Diffstat (limited to 'src/text-context.cpp')
-rw-r--r--src/text-context.cpp34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/text-context.cpp b/src/text-context.cpp
index d137b673d..862c50737 100644
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
@@ -307,6 +307,7 @@ static gint sp_text_context_item_handler(SPEventContext *event_context, SPItem *
gint ret = FALSE;
sp_text_context_validate_cursor_iterators(tc);
+ Inkscape::Text::Layout::iterator old_start = tc->text_sel_start;
switch (event->type) {
case GDK_BUTTON_PRESS:
@@ -319,7 +320,12 @@ static gint sp_text_context_item_handler(SPEventContext *event_context, SPItem *
// find out click point in document coordinates
Geom::Point p = desktop->w2d(Geom::Point(event->button.x, event->button.y));
// set the cursor closest to that point
- tc->text_sel_start = tc->text_sel_end = sp_te_get_position_by_coords(tc->text, p);
+ if (event->button.state & GDK_SHIFT_MASK) {
+ tc->text_sel_start = old_start;
+ tc->text_sel_end = sp_te_get_position_by_coords(tc->text, p);
+ } else {
+ tc->text_sel_start = tc->text_sel_end = sp_te_get_position_by_coords(tc->text, p);
+ }
// update display
sp_text_context_update_cursor(tc);
sp_text_context_update_text_selection(tc);
@@ -948,13 +954,21 @@ static gint sp_text_context_root_handler(SPEventContext *const event_context, Gd
bool noSelection = false;
- if (tc->text_sel_start == tc->text_sel_end) {
- tc->text_sel_start.prevCursorPosition();
+ if (MOD__CTRL(event)) {
+ tc->text_sel_start = tc->text_sel_end;
+ }
+
+ if (tc->text_sel_start == tc->text_sel_end) {
+ if (MOD__CTRL(event)) {
+ tc->text_sel_start.prevStartOfWord();
+ } else {
+ tc->text_sel_start.prevCursorPosition();
+ }
noSelection = true;
}
- iterator_pair bspace_pair;
- bool success = sp_te_delete(tc->text, tc->text_sel_start, tc->text_sel_end, bspace_pair);
+ iterator_pair bspace_pair;
+ bool success = sp_te_delete(tc->text, tc->text_sel_start, tc->text_sel_end, bspace_pair);
if (noSelection) {
if (success) {
@@ -982,8 +996,16 @@ static gint sp_text_context_root_handler(SPEventContext *const event_context, Gd
if (tc->text) {
bool noSelection = false;
+ if (MOD__CTRL(event)) {
+ tc->text_sel_start = tc->text_sel_end;
+ }
+
if (tc->text_sel_start == tc->text_sel_end) {
- tc->text_sel_end.nextCursorPosition();
+ if (MOD__CTRL(event)) {
+ tc->text_sel_end.nextEndOfWord();
+ } else {
+ tc->text_sel_end.nextCursorPosition();
+ }
noSelection = true;
}