strip is hidden

This commit is contained in:
p.kosyh 2011-07-27 09:50:17 +00:00
parent b7e5b04264
commit c6e660ee5a
2 changed files with 29 additions and 3 deletions

View file

@ -2126,7 +2126,25 @@ void layout_add_margin(struct layout *layout, struct margin *margin)
return;
}
int layout_find_margin(struct layout *layout, int y, int *w)
static int layout_skip_margin(struct layout *layout, int y)
{
struct margin *m = layout->margin;
int my = y;
if (!m)
return y;
while (m) {
if (m->y + m->h > my)
my = m->y + m->h;
m = m->next;
}
if (y < my)
y = my;
return y;
}
static int layout_find_margin(struct layout *layout, int y, int *w)
{
struct margin *m = layout->margin;
int xpos = 0;
@ -3702,6 +3720,8 @@ void _txt_layout_add(layout_t lay, char *txt)
line->align = layout->align;
line->h = 0;//h;
line->y = ol->y + ol->h;
// line->x = 0;
line->x = layout_find_margin(layout, line->y, &width);
// fprintf(stderr,"%d %d\n", line->x, width);
@ -3755,6 +3775,12 @@ void _txt_layout_add(layout_t lay, char *txt)
if (img_align && (m = margin_new())) {
int x2, w2;
if (!line_empty(line) && !line->h) {
line->y = layout_skip_margin(layout, line->y);
width = layout->w;
line->x = 0;
}
x2 = layout_find_margin(layout, line->y, &w2);

View file

@ -1919,13 +1919,13 @@ Commands:^
showlast = true,
_scripts = {};
};
function strip(s)
stead.strip = function(s)
local s = tostring(s);
s = stead.string.gsub(s, '^[ \t]*', '');
s = stead.string.gsub(s, '[ \t]*$', '');
return s;
end
stead.strip = strip
function isForcedsc(v)
local r,g