Selection now handles empty lines less counter-intuitively.

Now, when you are selecting a region, you will get all empty lines that happen
to be in it, including trailing ones. Last line terminator is omitted as it previously
was, though.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
This commit is contained in:
Alexander Sedov 2013-04-18 12:47:23 +04:00 committed by Christoph Lohmann
parent da182612b7
commit e5ff746430
1 changed files with 2 additions and 5 deletions

7
st.c
View File

@ -752,7 +752,7 @@ bpress(XEvent *e) {
void void
selcopy(void) { selcopy(void) {
char *str, *ptr; char *str, *ptr;
int x, y, bufsize, isselected = 0, size; int x, y, bufsize, size;
Glyph *gp, *last; Glyph *gp, *last;
if(sel.bx == -1) { if(sel.bx == -1) {
@ -763,7 +763,6 @@ selcopy(void) {
/* append every set & selected glyph to the selection */ /* append every set & selected glyph to the selection */
for(y = sel.b.y; y < sel.e.y + 1; y++) { for(y = sel.b.y; y < sel.e.y + 1; y++) {
isselected = 0;
gp = &term.line[y][0]; gp = &term.line[y][0];
last = gp + term.col; last = gp + term.col;
@ -774,8 +773,6 @@ selcopy(void) {
for(x = 0; gp <= last; x++, ++gp) { for(x = 0; gp <= last; x++, ++gp) {
if(!selected(x, y)) { if(!selected(x, y)) {
continue; continue;
} else {
isselected = 1;
} }
size = utf8size(gp->c); size = utf8size(gp->c);
@ -792,7 +789,7 @@ selcopy(void) {
* st. * st.
* FIXME: Fix the computer world. * FIXME: Fix the computer world.
*/ */
if(isselected && y < sel.e.y) if(y < sel.e.y)
*ptr++ = '\n'; *ptr++ = '\n';
} }
*ptr = 0; *ptr = 0;