Applying the tab expansion patch from koga.

This commit is contained in:
Christoph Lohmann 2012-10-28 13:35:00 +01:00
parent 71b09ec4f1
commit b56a0da283

22
st.c
View File

@ -663,9 +663,9 @@ bpress(XEvent *e) {
void void
selcopy(void) { selcopy(void) {
char *str, *ptr; char *str, *ptr, *p;
int x, y, bufsize, is_selected = 0, size; int x, y, bufsize, is_selected = 0, size;
Glyph *gp; Glyph *gp, *last;
if(sel.bx == -1) { if(sel.bx == -1) {
str = NULL; str = NULL;
@ -675,15 +675,19 @@ selcopy(void) {
/* append every set & selected glyph to the selection */ /* append every set & selected glyph to the selection */
for(y = 0; y < term.row; y++) { for(y = 0; y < term.row; y++) {
for(x = 0; x < term.col; x++) { gp = &term.line[y][0];
gp = &term.line[y][x]; last = gp + term.col;
if(!(is_selected = selected(x, y)) while(--last >= gp && !(last->state & GLYPH_SET))
|| !(gp->state & GLYPH_SET)) { /* nothing */;
for(x = 0; gp <= last; x++, ++gp) {
if(!(is_selected = selected(x, y)))
continue; continue;
}
size = utf8size(gp->c); p = (gp->state & GLYPH_SET) ? gp->c : " ";
memcpy(ptr, gp->c, size); size = utf8size(p);
memcpy(ptr, p, size);
ptr += size; ptr += size;
} }
/* \n at the end of every selected line except for the last one */ /* \n at the end of every selected line except for the last one */