Trim trailing whitespaces in every selection case
Trailing whitespaces are trimmed when copying from normal selection and rectangular selection on lines that have their last character included or on the left of the selection. It leads to inconsistent behaviors when copying the exact same text from the left and right window in applications with vertical splits. This patch solves this issue by always trimming the selection.
This commit is contained in:
parent
4418939dd9
commit
09f5d98251
1 changed files with 2 additions and 0 deletions
2
st.c
2
st.c
|
@ -947,6 +947,8 @@ getsel(void) {
|
||||||
lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1;
|
lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1;
|
||||||
}
|
}
|
||||||
last = &term.line[y][MIN(lastx, linelen-1)];
|
last = &term.line[y][MIN(lastx, linelen-1)];
|
||||||
|
while(last >= gp && last->c[0] == ' ')
|
||||||
|
--last;
|
||||||
|
|
||||||
for( ; gp <= last; ++gp) {
|
for( ; gp <= last; ++gp) {
|
||||||
if(gp->mode & ATTR_WDUMMY)
|
if(gp->mode & ATTR_WDUMMY)
|
||||||
|
|
Loading…
Reference in a new issue