aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/keys/listkey.cpp22
-rw-r--r--src/keys/swkey.cpp2
-rw-r--r--src/modules/comments/rawcom/rawcom.cpp3
-rw-r--r--src/modules/comments/zcom/zcom.cpp3
-rw-r--r--src/modules/texts/rawtext/rawtext.cpp3
-rw-r--r--src/modules/texts/ztext/ztext.cpp3
6 files changed, 25 insertions, 11 deletions
diff --git a/src/keys/listkey.cpp b/src/keys/listkey.cpp
index 557e36e..8f2876d 100644
--- a/src/keys/listkey.cpp
+++ b/src/keys/listkey.cpp
@@ -126,10 +126,10 @@ void ListKey::add(const SWKey &ikey) {
void ListKey::setPosition(SW_POSITION p) {
switch (p) {
case 1: // GCC won't compile P_TOP
- SetToElement(0);
+ SetToElement(0, p);
break;
case 2: // GCC won't compile P_BOTTOM
- SetToElement(arraycnt-1);
+ SetToElement(arraycnt-1, p);
break;
}
}
@@ -152,7 +152,7 @@ void ListKey::increment(int step) {
if ((array[arraypos]->Error()) || (!array[arraypos]->isBoundSet())) {
SetToElement(arraypos+1);
}
- else *this = (const char *)(*array[arraypos]);
+ else SWKey::setText((const char *)(*array[arraypos]));
}
else error = KEYERR_OUTOFBOUNDS;
}
@@ -176,7 +176,7 @@ void ListKey::decrement(int step) {
if ((array[arraypos]->Error()) || (!array[arraypos]->isBoundSet())) {
SetToElement(arraypos-1, BOTTOM);
}
- else *this = (const char *)(*array[arraypos]);
+ else SWKey::setText((const char *)(*array[arraypos]));
}
else error = KEYERR_OUTOFBOUNDS;
}
@@ -219,9 +219,9 @@ char ListKey::SetToElement(int ielement, SW_POSITION pos) {
if (arraycnt) {
if (array[arraypos]->isBoundSet())
(*array[arraypos]) = pos;
- *this = (const char *)(*array[arraypos]);
+ SWKey::setText((const char *)(*array[arraypos]));
}
- else *this = "";
+ else SWKey::setText("");
return error;
}
@@ -290,5 +290,15 @@ const char *ListKey::getText() const {
return (key) ? key->getText() : keytext;
}
+
+void ListKey::setText(const char *ikey) {
+ // at least try to set the current element to this text
+ int pos = arraypos;
+ SWKey *key = (pos >= arraycnt) ? 0:array[pos];
+ if (key) key->setText(ikey);
+
+ SWKey::setText(ikey);
+}
+
SWORD_NAMESPACE_END
diff --git a/src/keys/swkey.cpp b/src/keys/swkey.cpp
index 94f0908..d8da49e 100644
--- a/src/keys/swkey.cpp
+++ b/src/keys/swkey.cpp
@@ -38,7 +38,7 @@ SWKey::SWKey(SWKey const &k)
keytext = 0;
rangeText = 0;
error = k.error;
- stdstr(&keytext, k.keytext);
+ setText(k.getText());
init();
}
diff --git a/src/modules/comments/rawcom/rawcom.cpp b/src/modules/comments/rawcom/rawcom.cpp
index c9cfcd5..75904eb 100644
--- a/src/modules/comments/rawcom/rawcom.cpp
+++ b/src/modules/comments/rawcom/rawcom.cpp
@@ -112,7 +112,8 @@ void RawCom::increment(int steps) {
findoffset(tmpkey->Testament(), index, &start, &size);
if (
(((laststart != start) || (lastsize != size)) // we're a different entry
- && (start > 0) && (size)) // and we actually have a size
+// && (start > 0)
+ && (size)) // and we actually have a size
||(!skipConsecutiveLinks)) { // or we don't want to skip consecutive links
steps += (steps < 0) ? 1 : -1;
lastgood = *tmpkey;
diff --git a/src/modules/comments/zcom/zcom.cpp b/src/modules/comments/zcom/zcom.cpp
index b3a10de..cb47e23 100644
--- a/src/modules/comments/zcom/zcom.cpp
+++ b/src/modules/comments/zcom/zcom.cpp
@@ -182,7 +182,8 @@ void zCom::increment(int steps) {
findoffset(tmpkey->Testament(), index, &start, &size);
if (
(((laststart != start) || (lastsize != size)) // we're a different entry
- && (start > 0) && (size)) // and we actually have a size
+// && (start > 0)
+ && (size)) // and we actually have a size
||(!skipConsecutiveLinks)) { // or we don't want to skip consecutive links
steps += (steps < 0) ? 1 : -1;
lastgood = *tmpkey;
diff --git a/src/modules/texts/rawtext/rawtext.cpp b/src/modules/texts/rawtext/rawtext.cpp
index ef7742a..1b1171a 100644
--- a/src/modules/texts/rawtext/rawtext.cpp
+++ b/src/modules/texts/rawtext/rawtext.cpp
@@ -542,7 +542,8 @@ void RawText::increment(int steps) {
findoffset(tmpkey->Testament(), index, &start, &size);
if (
(((laststart != start) || (lastsize != size)) // we're a different entry
- && (start > 0) && (size)) // and we actually have a size
+// && (start > 0)
+ && (size)) // and we actually have a size
||(!skipConsecutiveLinks)) { // or we don't want to skip consecutive links
steps += (steps < 0) ? 1 : -1;
lastgood = *tmpkey;
diff --git a/src/modules/texts/ztext/ztext.cpp b/src/modules/texts/ztext/ztext.cpp
index 00793c2..0867d8a 100644
--- a/src/modules/texts/ztext/ztext.cpp
+++ b/src/modules/texts/ztext/ztext.cpp
@@ -189,7 +189,8 @@ void zText::increment(int steps) {
if (
(((laststart != start) || (lastsize != size)) // we're a different entry
- && (start > 0) && (size)) // and we actually have a size
+// && (start > 0)
+ && (size)) // and we actually have a size
||(!skipConsecutiveLinks)) { // or we don't want to skip consecutive links
steps += (steps < 0) ? 1 : -1;
lastgood = *tmpkey;