mirror of
https://github.com/jarun/nnn.git
synced 2024-11-17 16:39:14 +00:00
In-place invert optimization
This commit is contained in:
parent
cef9bd289f
commit
61d8a29d84
11
src/nnn.c
11
src/nnn.c
|
@ -1595,9 +1595,14 @@ static void invertselbuf(char *path)
|
|||
len = mkpath(path, dentp->name, g_buf);
|
||||
found = findinsel(findselpos, len);
|
||||
if (found) {
|
||||
marked[nmarked].startpos = found;
|
||||
marked[nmarked].len = len;
|
||||
++nmarked;
|
||||
if (nmarked && (found
|
||||
== (marked[nmarked - 1].startpos + marked[nmarked - 1].len)))
|
||||
marked[nmarked - 1].len += len;
|
||||
else {
|
||||
marked[nmarked].startpos = found;
|
||||
marked[nmarked].len = len;
|
||||
++nmarked;
|
||||
}
|
||||
|
||||
--nselected;
|
||||
offset += len; /* buffer size adjustment */
|
||||
|
|
Loading…
Reference in a new issue