aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/textblock.cc10
-rw-r--r--dw/textblock.hh2
-rw-r--r--src/uicmd.cc4
3 files changed, 8 insertions, 8 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc
index f40f6c91..095ad219 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -919,7 +919,7 @@ void Textblock::drawWord (Line *line, int wordIndex1, int wordIndex2,
// Simple case, where copying in one buffer is not needed.
Word *word = words->getRef (wordIndex1);
drawWord0 (wordIndex1, wordIndex2, word->content.text, word->size.width,
- style, view, area, xWidget, yWidgetBase);
+ false, style, view, area, xWidget, yWidgetBase);
} else {
// Concatenate all words in a new buffer.
int l = 0, totalWidth = 0;
@@ -943,7 +943,7 @@ void Textblock::drawWord (Line *line, int wordIndex1, int wordIndex2,
text[p++] = 0;
}
- drawWord0 (wordIndex1, wordIndex2, text, totalWidth,
+ drawWord0 (wordIndex1, wordIndex2, text, totalWidth, drawHyphen,
style, view, area, xWidget, yWidgetBase);
}
}
@@ -952,7 +952,7 @@ void Textblock::drawWord (Line *line, int wordIndex1, int wordIndex2,
* TODO Comment
*/
void Textblock::drawWord0 (int wordIndex1, int wordIndex2,
- const char *text, int totalWidth,
+ const char *text, int totalWidth, bool drawHyphen,
core::style::Style *style, core::View *view,
core::Rectangle *area, int xWidget, int yWidgetBase)
{
@@ -1011,7 +1011,9 @@ void Textblock::drawWord0 (int wordIndex1, int wordIndex2,
xStart = xWorld;
if (firstCharIdx)
xStart += textWidth (text, 0, firstCharIdx, style);
- if (firstCharIdx == 0 && lastCharIdx == wordLen)
+ // With a hyphen, the width is a bit longer than totalWidth,
+ // and so, the optimization to use totalWidth is not correct.
+ if (!drawHyphen && firstCharIdx == 0 && lastCharIdx == wordLen)
width = totalWidth;
else
width = textWidth (text, firstCharIdx,
diff --git a/dw/textblock.hh b/dw/textblock.hh
index 7c4f8820..cc11eb9c 100644
--- a/dw/textblock.hh
+++ b/dw/textblock.hh
@@ -402,7 +402,7 @@ protected:
void drawWord (Line *line, int wordIndex1, int wordIndex2, core::View *view,
core::Rectangle *area, int xWidget, int yWidgetBase);
void drawWord0 (int wordIndex1, int wordIndex2,
- const char *text, int totalWidth,
+ const char *text, int totalWidth, bool drawHyphen,
core::style::Style *style, core::View *view,
core::Rectangle *area, int xWidget, int yWidgetBase);
void drawSpace (int wordIndex, core::View *view, core::Rectangle *area,
diff --git a/src/uicmd.cc b/src/uicmd.cc
index bf4bbe2f..40279a60 100644
--- a/src/uicmd.cc
+++ b/src/uicmd.cc
@@ -84,7 +84,7 @@ class CustTabButton : public Fl_Button {
// active one (the highest numbered gets focus).
public:
CustTabButton (int x,int y,int w,int h, const char* label = 0) :
- Fl_Button (x,y,w,h,label) { ui_ = NULL; };
+ Fl_Button (x,y,w,h,label) { ui_ = NULL; focus_num_ = 0; };
void ui(UI *pui) { ui_ = pui; }
UI *ui(void) { return ui_; }
void focus_num(uint_t fn) { focus_num_ = fn; }
@@ -290,8 +290,6 @@ UI *CustTabs::add_new_tab(UI *old_ui, int focus)
if (focus) {
switch_tab(btn);
} else if (num_tabs() == 2) {
- increase_focus_counter();
- btn->focus_num(focus_counter);
// no focus and tabbar added: redraw current page
Wizard->redraw();
}