mirror of git://git.sv.gnu.org/nano.git
tweaks: avoid calling extra_chunks_in() when not softwrapping
The function is somewhat costly; better avoid it whenever possible.
This commit is contained in:
parent
f54bc6c7d6
commit
cf0820549b
|
@ -34,7 +34,7 @@ void do_deletion(undo_type action)
|
|||
int charlen = char_length(openfile->current->data + openfile->current_x);
|
||||
size_t line_len = strlen(openfile->current->data + openfile->current_x);
|
||||
#ifndef NANO_TINY
|
||||
size_t old_amount = extra_chunks_in(openfile->current);
|
||||
size_t old_amount = ISSET(SOFTWRAP) ? extra_chunks_in(openfile->current) : 0;
|
||||
|
||||
/* If the type of action changed or the cursor moved to a different
|
||||
* line, create a new undo item, otherwise update the existing item. */
|
||||
|
|
|
@ -1399,12 +1399,13 @@ void inject(char *burst, size_t count)
|
|||
linestruct *thisline = openfile->current;
|
||||
size_t datalen = strlen(thisline->data);
|
||||
#ifndef NANO_TINY
|
||||
size_t old_amount = extra_chunks_in(openfile->current);
|
||||
size_t original_row = 0;
|
||||
size_t old_amount = 0;
|
||||
|
||||
if (ISSET(SOFTWRAP)) {
|
||||
if (openfile->current_y == editwinrows - 1)
|
||||
original_row = chunk_for(xplustabs(), thisline);
|
||||
old_amount = extra_chunks_in(thisline);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue