Mercurial > vim
comparison src/textformat.c @ 31825:0d27ddce621d v9.0.1245
patch 9.0.1245: code is indented more than necessary
Commit: https://github.com/vim/vim/commit/032713f8299abd92fcfb1e490d1ae5c1ecadde41
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Wed Jan 25 21:05:38 2023 +0000
patch 9.0.1245: code is indented more than necessary
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes #11879)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 25 Jan 2023 22:15:03 +0100 |
parents | defef01ac8ea |
children | 0839c759c9d1 |
comparison
equal
deleted
inserted
replaced
31824:086864270b73 | 31825:0d27ddce621d |
---|---|
750 int end_insert) // TRUE when ending Insert mode | 750 int end_insert) // TRUE when ending Insert mode |
751 { | 751 { |
752 int c = ' '; | 752 int c = ' '; |
753 int cc; | 753 int cc; |
754 | 754 |
755 if (did_add_space) | 755 if (!did_add_space) |
756 { | 756 return; |
757 cc = gchar_cursor(); | 757 |
758 if (!WHITECHAR(cc)) | 758 cc = gchar_cursor(); |
759 // Somehow the space was removed already. | 759 if (!WHITECHAR(cc)) |
760 // Somehow the space was removed already. | |
761 did_add_space = FALSE; | |
762 else | |
763 { | |
764 if (!end_insert) | |
765 { | |
766 inc_cursor(); | |
767 c = gchar_cursor(); | |
768 dec_cursor(); | |
769 } | |
770 if (c != NUL) | |
771 { | |
772 // The space is no longer at the end of the line, delete it. | |
773 del_char(FALSE); | |
760 did_add_space = FALSE; | 774 did_add_space = FALSE; |
761 else | |
762 { | |
763 if (!end_insert) | |
764 { | |
765 inc_cursor(); | |
766 c = gchar_cursor(); | |
767 dec_cursor(); | |
768 } | |
769 if (c != NUL) | |
770 { | |
771 // The space is no longer at the end of the line, delete it. | |
772 del_char(FALSE); | |
773 did_add_space = FALSE; | |
774 } | |
775 } | 775 } |
776 } | 776 } |
777 } | 777 } |
778 | 778 |
779 /* | 779 /* |