mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-25 06:09:50 +00:00
Add r_str_crop() will be used by canvas to shifted render text
This commit is contained in:
parent
a708b77a2d
commit
0d68756791
@ -59,7 +59,7 @@ static void Node_print(RConsCanvas *can, Node *n, int cur) {
|
||||
return;
|
||||
}
|
||||
if (cur) {
|
||||
F (n->x,n->y, n->w, n->h, '.');
|
||||
//F (n->x,n->y, n->w, n->h, '.');
|
||||
snprintf (title, sizeof (title)-1,
|
||||
"-[ 0x%08"PFMT64x" ]-", n->addr);
|
||||
} else {
|
||||
@ -68,8 +68,11 @@ static void Node_print(RConsCanvas *can, Node *n, int cur) {
|
||||
}
|
||||
if (G (n->x+1, n->y+1))
|
||||
W (title);
|
||||
if (G (n->x+2, n->y+2))
|
||||
if (G (n->x+2, n->y+2)) {
|
||||
// TODO: temporary crop depending on out of screen offsets
|
||||
//n->text = r_str_crop (n->text, 1,1,4,4);
|
||||
W (n->text);
|
||||
}
|
||||
if (G (n->x+1, n->y+1))
|
||||
W (title);
|
||||
B (n->x, n->y, n->w, n->h);
|
||||
|
@ -361,6 +361,7 @@ static inline void r_str_rmch (char *s, char ch) {
|
||||
R_API const char *r_str_rchr(const char *base, const char *p, int ch);
|
||||
R_API const char *r_str_closer_chr (const char *b, const char *s);
|
||||
R_API int r_str_bounds(const char *str, int *h);
|
||||
R_API char *r_str_crop(const char *str, int x, int y, int w, int h);
|
||||
R_API int r_str_len_utf8 (const char *s);
|
||||
R_API int r_str_len_utf8char (const char *s, int left);
|
||||
R_API void r_str_filter_zeroline(char *str, int len);
|
||||
|
@ -1314,6 +1314,22 @@ R_API int r_str_bounds(const char *str, int *h) {
|
||||
|
||||
R_API char *r_str_crop(const char *str, int x, int y, int w, int h) {
|
||||
char *ret = strdup (str);
|
||||
char *r = ret;
|
||||
int ch = 0, cw = 0;
|
||||
while (*str) {
|
||||
if (*str == '\n') {
|
||||
*r++ = *str;
|
||||
ch++;
|
||||
cw = 0;
|
||||
} else
|
||||
if (ch>=y && ch<h)
|
||||
if (cw>=x && cw<w)
|
||||
*r++ = *str;
|
||||
str++;
|
||||
cw++;
|
||||
}
|
||||
*r = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
R_API const char * r_str_tok (const char *str1, const char b, size_t len) {
|
||||
|
@ -33,7 +33,7 @@ make clean
|
||||
fi
|
||||
|
||||
if [ $? = 0 ]; then
|
||||
make -j4
|
||||
time make -j4
|
||||
if [ $? = 0 ]; then
|
||||
( cd binr/radare2 ; make ios_sdk_sign )
|
||||
rm -rf /tmp/r2ios
|
||||
|
Loading…
Reference in New Issue
Block a user