New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grep and some string functions double ANSI length #1406
Comments
Not sure I'm seeing what you're seeing. |
That's very peculiar. I've replicated it in three places so far. What patch level are you using? |
Ah. This seems to have started with commit 152acc5. I am one commit behind it and don't have this issue, but tested it on a game with 152acc5 and yep, same issue. @HarryCordewener this was your commit for
|
I'll be looking into this. I did not encounter this on my side with MAX_COMMAND_LEN doubled. |
diff --git a/hdrs/ansi.h b/hdrs/ansi.h
index 9e57c247..1d0652b0 100644
--- a/hdrs/ansi.h
+++ b/hdrs/ansi.h
@@ -191,7 +191,7 @@ typedef struct _ansi_string {
int len; /**< Length of the string */
char *source; /**< Original source of string */
uint32_t flags; /**< Bitwise or of AS_<foo> flags */
- int16_t *markup; /**< Indexes of markup, if it has any. */
+ int32_t *markup; /**< Indexes of markup, if it has any. */
new_markup_information *mi; /**< Markup information */
StrTree *tags; /**< Tags. */
int micount; /**< # of used markup information in ->mi */
diff --git a/src/markup.c b/src/markup.c
index db94f050..4d928968 100644
--- a/src/markup.c
+++ b/src/markup.c
@@ -2511,7 +2511,7 @@ ansi_string_replace(ansi_string *dst, int loc, int count, ansi_string *src)
/* Move markup as necessary. */
if (dstleft > 0) {
memmove(dst->markup + srcend, dst->markup + (loc + count),
- dstleft * sizeof(int16_t));
+ dstleft * sizeof(int32_t));
}
/* If, and only if, mis and mie have a markup_information in common, |
…#1397) * Issue 1336: Fix it so that mushtype.h #MAX_COMMAND_LEN can be set higher than *2 for a larger PennMUSH buffer * Readme Update
Issue #1406: Fix markup bug affecting strinsert()
This is in ansi_str_replace. Replacing part of a string with an ANSI string will bleed the color to double the intended length.
think Replication:
think strinsert(1234567890,5, ansi(y,!))
think strinsert(1234567890,5, ansi(y,!!!))
think Notably this does not happen in strings that already have markup:
think strinsert(ansi(u,1234567890),3,ansi(y,!!))
The text was updated successfully, but these errors were encountered: