nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[wish] copy-pasting indented code when auto-indent is on


From: Seb
Subject: [wish] copy-pasting indented code when auto-indent is on
Date: Thu, 2 Jan 2020 12:02:52 +0100 (CET)
User-agent: Alpine 2.21 (DEB 202 2017-01-01)


Hello,


I sometimes copy-paste indented code from one file to another, or from a web page to a local file. When auto-indent is on, the result is bad. Here is an example:

ORIGINAL CODE

void do_mark(void)
{
     if (!openfile->mark) {
         openfile->mark = openfile->current;
         openfile->mark_x = openfile->current_x;
         statusbar(_("Mark Set"));
         openfile->kind_of_mark = HARDMARK;
     } else {
         openfile->mark = NULL;
         statusbar(_("Mark Unset"));
         refresh_needed = TRUE;
     }
}

COPY-PASTED CODE WITH AUTO-INDENT

void do_mark(void)
{
     if (!openfile->mark) {
             openfile->mark = openfile->current;
                     openfile->mark_x = openfile->current_x;
                             statusbar(_("Mark Set"));
                                     openfile->kind_of_mark = HARDMARK;
                                         } else {
                                                 openfile->mark = NULL;
                                                         statusbar(_("Mark
                                                         Unset"));
                                                                 refresh_needed
                                                                 = TRUE;
                                                                     }
                                                                     }

Is there currently a way to deal with this problem, beside remembering to temporarily deactivate auto-indent before pasting?

Would it be possible for Nano to temporarily deactivate auto-indent if it detects that we're pasting indented lines? (Perhaps the speed at which the characters arrive signals that we're not typing?)


Kind regards,
Sébastien.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]