|
@@ -1,11 +1,11 @@
|
|
|
+#include "charman.h"
|
|
|
+#include "render.h"
|
|
|
+#include "utils.h"
|
|
|
+#include "zf_log.h"
|
|
|
#include <ctype.h>
|
|
|
#include <regex>
|
|
|
#include <string>
|
|
|
#include <vector>
|
|
|
-#include "charman.h"
|
|
|
-#include "utils.h"
|
|
|
-#include "zf_log.h"
|
|
|
-#include "render.h"
|
|
|
|
|
|
void CharMan::validate(void) {
|
|
|
// Control buffer debugging output.
|
|
@@ -109,9 +109,18 @@ void CharMan::insert(int pos, std::string str) {
|
|
|
// vector is holding.
|
|
|
idx = this->text_offsets[pos - 1] + 1;
|
|
|
ZF_LOGE("Use %d for idx", idx);
|
|
|
- } else
|
|
|
+ } else {
|
|
|
idx = this->text_offsets[pos];
|
|
|
|
|
|
+ // What happens if pos is pointing at color code? Or ANSI cursor movement?
|
|
|
+ // (that follows text)
|
|
|
+
|
|
|
+ if (idx == -1) {
|
|
|
+ idx = this->text_offsets[pos - 1] + 1;
|
|
|
+ ZF_LOGE("-1 take 2: %d", idx);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// ZF_LOGE("insert( POS %d, LEN %d, IDX %d, %s)", pos, len, idx, str.c_str());
|
|
|
// diagnostics();
|
|
|
std::string blank(len, ' ');
|
|
@@ -231,7 +240,8 @@ int CharMan::word_tangler(std::pair<int, int> pos_len) {
|
|
|
int r = 1; // randint(2) + 1;
|
|
|
|
|
|
buffer << TRIGGER "P1" TRIGGER "R" << r;
|
|
|
- r = randint(3) + 1; // This will cause us to speed up regarding render speed. (reducing delay for callers using the bbs)
|
|
|
+ r = randint(3) + 1; // This will cause us to speed up regarding render
|
|
|
+ // speed. (reducing delay for callers using the bbs)
|
|
|
buffer << TRIGGER "S" << r;
|
|
|
tangle = buffer.str();
|
|
|
std::string reset = TRIGGER "R0" TRIGGER "S0";
|
|
@@ -295,4 +305,5 @@ CharMan::CharMan(std::string &buffer, std::string &work, std::string &text,
|
|
|
CharMan::~CharMan() {
|
|
|
ZF_LOGD("~CharMan");
|
|
|
// validate();
|
|
|
+ // diagnostics();
|
|
|
}
|