Mercurial > vim
comparison src/edit.c @ 31545:c8d4fced1f94 v9.0.1105
patch 9.0.1105: code is indented too much
Commit: https://github.com/vim/vim/commit/87c1cbbe984e60582f2536e4d3c2ce88cd474bb7
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Tue Dec 27 19:54:52 2022 +0000
patch 9.0.1105: code is indented too much
Problem: Code is indented too much.
Solution: Use an early return. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/11756)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 27 Dec 2022 21:00:05 +0100 |
parents | 627d4f236ac8 |
children | e94571ac4134 |
comparison
equal
deleted
inserted
replaced
31544:922e7109afcf | 31545:c8d4fced1f94 |
---|---|
1662 void | 1662 void |
1663 edit_putchar(int c, int highlight) | 1663 edit_putchar(int c, int highlight) |
1664 { | 1664 { |
1665 int attr; | 1665 int attr; |
1666 | 1666 |
1667 if (ScreenLines != NULL) | 1667 if (ScreenLines == NULL) |
1668 { | 1668 return; |
1669 update_topline(); // just in case w_topline isn't valid | 1669 |
1670 validate_cursor(); | 1670 update_topline(); // just in case w_topline isn't valid |
1671 if (highlight) | 1671 validate_cursor(); |
1672 attr = HL_ATTR(HLF_8); | 1672 if (highlight) |
1673 else | 1673 attr = HL_ATTR(HLF_8); |
1674 attr = 0; | 1674 else |
1675 pc_row = W_WINROW(curwin) + curwin->w_wrow; | 1675 attr = 0; |
1676 pc_col = curwin->w_wincol; | 1676 pc_row = W_WINROW(curwin) + curwin->w_wrow; |
1677 pc_status = PC_STATUS_UNSET; | 1677 pc_col = curwin->w_wincol; |
1678 pc_status = PC_STATUS_UNSET; | |
1678 #ifdef FEAT_RIGHTLEFT | 1679 #ifdef FEAT_RIGHTLEFT |
1679 if (curwin->w_p_rl) | 1680 if (curwin->w_p_rl) |
1680 { | 1681 { |
1681 pc_col += curwin->w_width - 1 - curwin->w_wcol; | 1682 pc_col += curwin->w_width - 1 - curwin->w_wcol; |
1682 if (has_mbyte) | 1683 if (has_mbyte) |
1684 { | |
1685 int fix_col = mb_fix_col(pc_col, pc_row); | |
1686 | |
1687 if (fix_col != pc_col) | |
1683 { | 1688 { |
1684 int fix_col = mb_fix_col(pc_col, pc_row); | 1689 screen_putchar(' ', pc_row, fix_col, attr); |
1685 | 1690 --curwin->w_wcol; |
1686 if (fix_col != pc_col) | 1691 pc_status = PC_STATUS_RIGHT; |
1687 { | |
1688 screen_putchar(' ', pc_row, fix_col, attr); | |
1689 --curwin->w_wcol; | |
1690 pc_status = PC_STATUS_RIGHT; | |
1691 } | |
1692 } | 1692 } |
1693 } | 1693 } |
1694 else | 1694 } |
1695 #endif | 1695 else |
1696 { | 1696 #endif |
1697 pc_col += curwin->w_wcol; | 1697 { |
1698 if (mb_lefthalve(pc_row, pc_col)) | 1698 pc_col += curwin->w_wcol; |
1699 pc_status = PC_STATUS_LEFT; | 1699 if (mb_lefthalve(pc_row, pc_col)) |
1700 } | 1700 pc_status = PC_STATUS_LEFT; |
1701 | 1701 } |
1702 // save the character to be able to put it back | 1702 |
1703 if (pc_status == PC_STATUS_UNSET) | 1703 // save the character to be able to put it back |
1704 { | 1704 if (pc_status == PC_STATUS_UNSET) |
1705 screen_getbytes(pc_row, pc_col, pc_bytes, &pc_attr); | 1705 { |
1706 pc_status = PC_STATUS_SET; | 1706 screen_getbytes(pc_row, pc_col, pc_bytes, &pc_attr); |
1707 } | 1707 pc_status = PC_STATUS_SET; |
1708 screen_putchar(c, pc_row, pc_col, attr); | 1708 } |
1709 } | 1709 screen_putchar(c, pc_row, pc_col, attr); |
1710 } | 1710 } |
1711 | 1711 |
1712 #if defined(FEAT_JOB_CHANNEL) || defined(PROTO) | 1712 #if defined(FEAT_JOB_CHANNEL) || defined(PROTO) |
1713 /* | 1713 /* |
1714 * Set the insert start position for when using a prompt buffer. | 1714 * Set the insert start position for when using a prompt buffer. |
1780 * in insert mode. | 1780 * in insert mode. |
1781 */ | 1781 */ |
1782 void | 1782 void |
1783 undisplay_dollar(void) | 1783 undisplay_dollar(void) |
1784 { | 1784 { |
1785 if (dollar_vcol >= 0) | 1785 if (dollar_vcol < 0) |
1786 { | 1786 return; |
1787 dollar_vcol = -1; | 1787 |
1788 redrawWinline(curwin, curwin->w_cursor.lnum); | 1788 dollar_vcol = -1; |
1789 } | 1789 redrawWinline(curwin, curwin->w_cursor.lnum); |
1790 } | 1790 } |
1791 | 1791 |
1792 /* | 1792 /* |
1793 * Truncate the space at the end of a line. This is to be used only in an | 1793 * Truncate the space at the end of a line. This is to be used only in an |
1794 * insert mode. It handles fixing the replace stack for MODE_REPLACE and | 1794 * insert mode. It handles fixing the replace stack for MODE_REPLACE and |
2552 { | 2552 { |
2553 char_u *s; | 2553 char_u *s; |
2554 | 2554 |
2555 vim_free(last_insert); | 2555 vim_free(last_insert); |
2556 last_insert = alloc(MB_MAXBYTES * 3 + 5); | 2556 last_insert = alloc(MB_MAXBYTES * 3 + 5); |
2557 if (last_insert != NULL) | 2557 if (last_insert == NULL) |
2558 { | 2558 return; |
2559 s = last_insert; | 2559 |
2560 // Use the CTRL-V only when entering a special char | 2560 s = last_insert; |
2561 if (c < ' ' || c == DEL) | 2561 // Use the CTRL-V only when entering a special char |
2562 *s++ = Ctrl_V; | 2562 if (c < ' ' || c == DEL) |
2563 s = add_char2buf(c, s); | 2563 *s++ = Ctrl_V; |
2564 *s++ = ESC; | 2564 s = add_char2buf(c, s); |
2565 *s++ = NUL; | 2565 *s++ = ESC; |
2566 last_insert_skip = 0; | 2566 *s++ = NUL; |
2567 } | 2567 last_insert_skip = 0; |
2568 } | 2568 } |
2569 | 2569 |
2570 #if defined(EXITFREE) || defined(PROTO) | 2570 #if defined(EXITFREE) || defined(PROTO) |
2571 void | 2571 void |
2572 free_last_insert(void) | 2572 free_last_insert(void) |