From 96a028c2639f29896aaafbb6d6e533c9a7cd1498 Mon Sep 17 00:00:00 2001 From: ac-stef Date: Thu, 15 Sep 2016 18:15:51 +0200 Subject: [PATCH] guess height for selections set by command --- source/src/editing.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/src/editing.cpp b/source/src/editing.cpp index 36939e27..69ff2d30 100644 --- a/source/src/editing.cpp +++ b/source/src/editing.cpp @@ -142,6 +142,7 @@ char *editinfo() void addselection(int x, int y, int xs, int ys, int h) { block &s = sels.add(); + if(h == -999 && !OUTBORD(x + xs / 2, y + ys / 2)) h = S(x + xs / 2, y + ys / 2)->floor; s.x = x; s.y = y; s.xs = xs; s.ys = ys; s.h = h; if(!correctsel(s)) { sels.drop(); } } @@ -152,8 +153,8 @@ void resetselections() sels.shrink(0); } -COMMANDF(select, "iiii", (int *x, int *y, int *xs, int *ys) { resetselections(); addselection(*x, *y, *xs, *ys, 0); }); -COMMANDF(addselection, "iiii", (int *x, int *y, int *xs, int *ys) { addselection(*x, *y, *xs, *ys, 0); }); +COMMANDF(select, "iiii", (int *x, int *y, int *xs, int *ys) { resetselections(); addselection(*x, *y, *xs, *ys, -999); }); +COMMANDF(addselection, "iiii", (int *x, int *y, int *xs, int *ys) { addselection(*x, *y, *xs, *ys, -999); }); COMMAND(resetselections, ""); // reset all invalid selections