diff options
Diffstat (limited to 'dw/textblock.cc')
-rw-r--r-- | dw/textblock.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc index 69239011..4c3fd5b6 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -522,10 +522,11 @@ bool Textblock::motionNotifyImpl (core::EventMotion *event) if (event->state & core::BUTTON1_MASK) return sendSelectionEvent (core::SelectionState::BUTTON_MOTION, event); else { + bool inSpace; int wordIndex, linkOld = hoverLink; core::style::Tooltip *tooltipOld = hoverTooltip; - wordIndex = findWord (event->xWidget, event->yWidget); + wordIndex = findWord (event->xWidget, event->yWidget, &inSpace); // cursor from word or widget style if (wordIndex == -1) { @@ -533,7 +534,9 @@ bool Textblock::motionNotifyImpl (core::EventMotion *event) hoverLink = -1; hoverTooltip = NULL; } else { - core::style::Style *style = words->getRef(wordIndex)->style; + core::style::Style *style = + inSpace ? words->getRef(wordIndex)->spaceStyle : + words->getRef(wordIndex)->style; setCursor (style->cursor); hoverLink = style->x_link; hoverTooltip = style->x_tooltip; @@ -1469,13 +1472,15 @@ int Textblock::findLineOfWord (int wordIndex) /** * \brief Find the index of the word, or -1. */ -int Textblock::findWord (int x, int y) +int Textblock::findWord (int x, int y, bool *inSpace) { int lineIndex, wordIndex; int xCursor, lastXCursor, yWidgetBase; Line *line; Word *word; + *inSpace = false; + if ((lineIndex = findLineIndex (y)) >= lines->size ()) return -1; line = lines->getRef (lineIndex); @@ -1491,6 +1496,7 @@ int Textblock::findWord (int x, int y) if (lastXCursor <= x && xCursor > x && y > yWidgetBase - word->size.ascent && y <= yWidgetBase + word->size.descent) { + *inSpace = x >= xCursor - word->effSpace; return wordIndex; } } |