mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-18 18:57:42 +00:00
Clean up the part of the code that fixed the glitch in ansi code (#14180)
This commit is contained in:
parent
80970f9a14
commit
9a0d05a709
@ -148,17 +148,14 @@ static const char *set_attr(RConsCanvas *c, const char *s) {
|
||||
}
|
||||
|
||||
if (p != s) {
|
||||
//since sometimes ANSI takes up too much buf
|
||||
//this should be big enough
|
||||
//at any time when the glitch comes back
|
||||
//just tweak the size
|
||||
char tmp[4096];
|
||||
const int slen = R_MIN (p - s, sizeof (tmp) - 1);
|
||||
RStrBuf *tmp = r_strbuf_new (NULL);
|
||||
if (!tmp) {
|
||||
return NULL;
|
||||
}
|
||||
const int slen = p - s;
|
||||
if (slen > 0) {
|
||||
memcpy (tmp, s, slen);
|
||||
tmp[slen] = 0;
|
||||
// could be faster
|
||||
c->attr = r_str_const (tmp);
|
||||
r_strbuf_append_n (tmp, s, slen);
|
||||
c->attr = r_str_const (r_strbuf_drain (tmp));
|
||||
}
|
||||
}
|
||||
return p;
|
||||
|
Loading…
Reference in New Issue
Block a user