2016-02-22 Chris Allegretta <chrisa@asty.org>

* Add ability to kill the trailing spaces when justifying
        code.  New nanorc option kill_spaces_on_wrap, we'll see
        whether this warrants a command line flahg or not.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5664 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2016-02-22 15:10:32 +00:00
parent 3ed08c568f
commit 6a0ae5aaa2
4 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2016-02-22 Chris Allegretta <chrisa@asty.org>
* Add ability to kill the trailing spaces when justifying
code. New nanorc option kill_spaces_on_wrap, we'll see
whether this warrants a command line flahg or not.
2016-02-22 Benno Schulenberg <bensberg@justemail.net> 2016-02-22 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (free_openfilestruct): Elide this function. * src/nano.c (free_openfilestruct): Elide this function.
* scr/global.c (thanks_for_all_the_fish, free_list_item): Condense. * scr/global.c (thanks_for_all_the_fish, free_list_item): Condense.

View File

@ -517,7 +517,8 @@ enum
POS_HISTORY, POS_HISTORY,
LOCKING, LOCKING,
NOREAD_MODE, NOREAD_MODE,
MAKE_IT_UNIX MAKE_IT_UNIX,
KILL_TRAILING_SPACES
}; };
/* Flags for the menus in which a given function should be present. */ /* Flags for the menus in which a given function should be present. */

View File

@ -90,6 +90,7 @@ static const rcoption rcopts[] = {
{"backwards", BACKWARDS_SEARCH}, {"backwards", BACKWARDS_SEARCH},
{"casesensitive", CASE_SENSITIVE}, {"casesensitive", CASE_SENSITIVE},
{"cut", CUT_TO_END}, {"cut", CUT_TO_END},
{"kill_spaces_on_wrap", KILL_TRAILING_SPACES},
{"locking", LOCKING}, {"locking", LOCKING},
{"matchbrackets", 0}, {"matchbrackets", 0},
{"noconvert", NO_CONVERT}, {"noconvert", NO_CONVERT},

View File

@ -1277,7 +1277,7 @@ bool do_wrap(filestruct *line)
/* If after_break doesn't end in a blank, make sure it ends in a /* If after_break doesn't end in a blank, make sure it ends in a
* space. */ * space. */
if (!is_blank_mbchar(end)) { if (!is_blank_mbchar(end) && !ISSET(KILL_TRAILING_SPACES)) {
#ifndef NANO_TINY #ifndef NANO_TINY
add_undo(ADD); add_undo(ADD);
#endif #endif
@ -2174,7 +2174,10 @@ void do_justify(bool full_justify)
#endif #endif
/* Break the current line. */ /* Break the current line. */
null_at(&openfile->current->data, break_pos); if (ISSET(KILL_TRAILING_SPACES))
null_at(&openfile->current->data, break_pos - 1);
else
null_at(&openfile->current->data, break_pos);
/* Go to the next line. */ /* Go to the next line. */
par_len--; par_len--;