aboutsummaryrefslogtreecommitdiff
path: root/dw/textblock.cc
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2009-10-26 22:13:14 +0000
committercorvid <corvid@lavabit.com>2009-10-26 22:13:14 +0000
commit5fa02d927490d64d494eddfb6e0dfcd3332e7a74 (patch)
tree31a9a20f019bc8e40ae28afabc3f2d87a818aa5f /dw/textblock.cc
parent30a0ec4bb4d3e79671154852780aa8b52f42f91d (diff)
use spaceStyle in Textblock::motionNotifyImpl when appropriate
Diffstat (limited to 'dw/textblock.cc')
-rw-r--r--dw/textblock.cc12
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;
}
}