diff --git a/src/gui/value/text.cpp b/src/gui/value/text.cpp
index 35a5a049..ee668f0b 100644
--- a/src/gui/value/text.cpp
+++ b/src/gui/value/text.cpp
@@ -79,12 +79,16 @@ void TextValueEditor::onMotion(const RealPoint& pos, wxMouseEvent& ev) {
size_t index = v.indexAt(style().getRotation().trInv(pos));
if (select_words) {
// on the left, swap start and end
- bool left = index < max(selection_start_i, selection_end_i);
- if (left != (selection_end_i < selection_start_i)) {
+ bool left = selection_end_i < selection_start_i;
+ size_t next = nextWordBoundry(index);
+ size_t prev = prevWordBoundry(index);
+ if (( left && next > max(selection_start_i, selection_end_i)) ||
+ (!left && prev < min(selection_start_i, selection_end_i))) {
+ left = !left;
swap(selection_start_i, selection_end_i);
}
-// //if (left && selection_end_i < selection_start_i
- moveSelection(TYPE_INDEX, left ? prevWordBoundry(index) : nextWordBoundry(index), false, MOVE_MID);
+ // TODO : still not quite right, requires a moveSelection function that moves start & end simultaniously
+ moveSelection(TYPE_INDEX, left ? prev : next, false, MOVE_MID);
} else {
moveSelection(TYPE_INDEX, index, false, MOVE_MID);
}
diff --git a/src/mse.vcproj b/src/mse.vcproj
index 5d01d080..86ebc8cf 100644
--- a/src/mse.vcproj
+++ b/src/mse.vcproj
@@ -1190,102 +1190,12 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1298,12 +1208,6 @@
-
-
-
-
@@ -1340,12 +1244,6 @@
-
-
-
-
@@ -1619,6 +1517,112 @@
RelativePath=".\data\field\text.hpp">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
(text, tag_start, pos));
-/* } else if (is_substr(text, start, _(" e(new ErrorTextElement(text, pos, end));
- fromString(e->elements, text, pos, end, style, ctx);
- pos = skip_tag(text, end);
-*/ } else if (is_substr(text, tag_start, _(" e(new AtomTextElement(text, pos, end));
@@ -107,7 +100,7 @@ struct TextElementsFromString {
if (symbol > 0 && style.symbol_font.valid()) {
te.elements.push_back(new_shared5(text, pos, pos + 1, style.symbol_font, &ctx));
} else {
- te.elements.push_back(new_shared4 (text, pos, pos + 1, style.font.make(bold > 0, italic > 0)));
+ te.elements.push_back(new_shared5 (text, pos, pos + 1, style.font.make(bold > 0, italic > 0), line > 0 ? BREAK_LINE : BREAK_HARD));
}
}
pos += 1;
diff --git a/src/render/text/element.hpp b/src/render/text/element.hpp
index a9572d48..fac8e7d9 100644
--- a/src/render/text/element.hpp
+++ b/src/render/text/element.hpp
@@ -126,17 +126,18 @@ class SimpleTextElement : public TextElement {
/// A text element that uses a normal font
class FontTextElement : public SimpleTextElement {
public:
- FontTextElement(const String& text, size_t start ,size_t end, const FontP& font)
+ FontTextElement(const String& text, size_t start ,size_t end, const FontP& font, LineBreak break_style)
: SimpleTextElement(text, start, end)
- , font(font)
+ , font(font), break_style(break_style)
{}
virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, const double* xs, DrawWhat what, size_t start, size_t end) const;
virtual void getCharInfo(RotatedDC& dc, double scale, vector& out) const;
virtual double minScale() const;
private:
- FontP font;
- DrawWhat draw_as;
+ FontP font;
+ DrawWhat draw_as;
+ LineBreak break_style;
};
/// A text element that uses a symbol font
@@ -179,7 +180,7 @@ class AtomTextElement : public CompoundTextElement {
// ----------------------------------------------------------------------------- : Other text elements
-
+/*
/// A text element that displays a horizontal separator line
class HorizontalLineTextElement : public TextElement {
public:
@@ -189,21 +190,7 @@ class HorizontalLineTextElement : public TextElement {
virtual void getCharInfo(RotatedDC& dc, double scale, vector& out) const;
virtual double minScale() const;
};
-
-/*
-// ----------------------------------------------------------------------------- : CompoundTextElement
-
-/// A TextElement consisting of sub elements
-class CompoundTextElement : public TextElement {
- public:
- CompoundTextElement(const String& text, size_t start ,size_t end) : TextElement(text, start, end) {}
-
- virtual void draw (RotatedDC& dc, double scale, const RealRect& rect, const double* xs, DrawWhat what, size_t start, size_t end) const;
- virtual RealSize charSize(RotatedDC& dc, double scale, size_t index) const;
-
- private:
- TextElements elements;
-};
*/
+
// ----------------------------------------------------------------------------- : EOF
#endif
diff --git a/src/render/text/font.cpp b/src/render/text/font.cpp
index 1af95b89..08b3383e 100644
--- a/src/render/text/font.cpp
+++ b/src/render/text/font.cpp
@@ -44,7 +44,7 @@ void FontTextElement::getCharInfo(RotatedDC& dc, double scale, vector&
Char c = text.GetChar(i);
RealSize s = dc.GetTextExtent(text.substr(start, i - start + 1));
out.push_back(CharInfo(RealSize(s.width - prev_width, s.height),
- c == _('\n') ? BREAK_HARD :
+ c == _('\n') ? break_style :
c == _(' ') ? BREAK_SOFT : BREAK_NO
));
prev_width = s.width;
diff --git a/src/render/text/line.cpp b/src/render/text/line.cpp
index afaf8db4..fa38ddf9 100644
--- a/src/render/text/line.cpp
+++ b/src/render/text/line.cpp
@@ -1,4 +1,4 @@
-//+----------------------------------------------------------------------------+
+/*//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
//| License: GNU General Public License 2 or later (see file COPYING) |
@@ -21,4 +21,4 @@ void HorizontalLineTextElement::getCharInfo(RotatedDC& dc, double scale, vector<
double HorizontalLineTextElement::minScale() const {
return 0; // we don't care about scaling
}
-
+*/
diff --git a/src/script/parser.cpp b/src/script/parser.cpp
index 4d75f936..5a56c74e 100644
--- a/src/script/parser.cpp
+++ b/src/script/parser.cpp
@@ -247,9 +247,9 @@ void TokenIterator::readStringToken() {
// escape
if (pos >= input.size()) throw ScriptParseError(_("Unexpected end of input in string constant"));
c = input.GetChar(pos++);
- if (c == _('n')) str += _('\n');
- if (c == _('<')) str += _('\1'); // escape for <
- else str += c; // \ or { or "
+ if (c == _('n')) str += _('\n');
+ else if (c == _('<')) str += _('\1'); // escape for <
+ else str += c; // \ or { or "
} else if (c == _('{')) {
// smart string
// "a{e}b" --> "a" "{ e }" "b"
diff --git a/src/util/tagged_string.cpp b/src/util/tagged_string.cpp
index 6245ae7b..0b0547da 100644
--- a/src/util/tagged_string.cpp
+++ b/src/util/tagged_string.cpp
@@ -175,13 +175,6 @@ size_t index_to_cursor(const String& str, size_t index, Movement dir) {
if (is_substr(str, i, _(" index) {
- // HACK: Don't walk past
- dir = dir == MOVE_RIGHT ? MOVE_LEFT : MOVE_RIGHT;
- }
} else {
i = skip_tag(str, i);
end = i;
@@ -216,9 +209,6 @@ void cursor_to_index_range(const String& str, size_t cursor, size_t& start, size
if (is_substr(str, i, _("