mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 05:58:33 +00:00
refactor: reduce scope of locals as per the style guide (#22211)
This commit is contained in:
@@ -369,14 +369,13 @@ bool msg_attr_keep(const char *s, int attr, bool keep, bool multiline)
|
||||
char *msg_strtrunc(char *s, int force)
|
||||
{
|
||||
char *buf = NULL;
|
||||
int len;
|
||||
int room;
|
||||
|
||||
// May truncate message to avoid a hit-return prompt
|
||||
if ((!msg_scroll && !need_wait_return && shortmess(SHM_TRUNCALL)
|
||||
&& !exmode_active && msg_silent == 0 && !ui_has(kUIMessages))
|
||||
|| force) {
|
||||
len = vim_strsize(s);
|
||||
int room;
|
||||
int len = vim_strsize(s);
|
||||
if (msg_scrolled != 0) {
|
||||
// Use all the columns.
|
||||
room = (Rows - msg_row) * Columns - 1;
|
||||
@@ -1033,7 +1032,6 @@ void ex_messages(void *const eap_p)
|
||||
{
|
||||
const exarg_T *const eap = (const exarg_T *)eap_p;
|
||||
struct msg_hist *p;
|
||||
int c = 0;
|
||||
|
||||
if (strcmp(eap->arg, "clear") == 0) {
|
||||
int keep = eap->addr_count == 0 ? 0 : eap->line2;
|
||||
@@ -1052,6 +1050,7 @@ void ex_messages(void *const eap_p)
|
||||
p = first_msg_hist;
|
||||
|
||||
if (eap->addr_count != 0) {
|
||||
int c = 0;
|
||||
// Count total messages
|
||||
for (; p != NULL && !got_int; p = p->next) {
|
||||
c++;
|
||||
@@ -1542,7 +1541,6 @@ int msg_outtrans_len_attr(const char *msgstr, int len, int attr)
|
||||
const char *str = msgstr;
|
||||
const char *plain_start = msgstr;
|
||||
char *s;
|
||||
int mb_l;
|
||||
int c;
|
||||
int save_got_int = got_int;
|
||||
|
||||
@@ -1565,7 +1563,7 @@ int msg_outtrans_len_attr(const char *msgstr, int len, int attr)
|
||||
// Normal characters are printed several at a time.
|
||||
while (--len >= 0 && !got_int) {
|
||||
// Don't include composing chars after the end.
|
||||
mb_l = utfc_ptr2len_len(str, len + 1);
|
||||
int mb_l = utfc_ptr2len_len(str, len + 1);
|
||||
if (mb_l > 1) {
|
||||
c = utf_ptr2char(str);
|
||||
if (vim_isprintc(c)) {
|
||||
@@ -2652,12 +2650,11 @@ void msg_sb_eol(void)
|
||||
static msgchunk_T *disp_sb_line(int row, msgchunk_T *smp)
|
||||
{
|
||||
msgchunk_T *mp = smp;
|
||||
char *p;
|
||||
|
||||
for (;;) {
|
||||
msg_row = row;
|
||||
msg_col = mp->sb_msg_col;
|
||||
p = mp->sb_text;
|
||||
char *p = mp->sb_text;
|
||||
if (*p == '\n') { // don't display the line break
|
||||
p++;
|
||||
}
|
||||
@@ -2767,7 +2764,6 @@ static int do_more_prompt(int typed_char)
|
||||
int oldState = State;
|
||||
int c;
|
||||
int retval = false;
|
||||
int toscroll;
|
||||
bool to_redraw = false;
|
||||
msgchunk_T *mp_last = NULL;
|
||||
msgchunk_T *mp;
|
||||
@@ -2809,7 +2805,7 @@ static int do_more_prompt(int typed_char)
|
||||
c = get_keystroke(resize_events);
|
||||
}
|
||||
|
||||
toscroll = 0;
|
||||
int toscroll = 0;
|
||||
switch (c) {
|
||||
case BS: // scroll one line back
|
||||
case K_BS:
|
||||
@@ -3507,7 +3503,6 @@ int do_dialog(int type, char *title, char *message, char *buttons, int dfltbutto
|
||||
{
|
||||
int retval = 0;
|
||||
char *hotkeys;
|
||||
int c;
|
||||
int i;
|
||||
|
||||
if (silent_mode // No dialogs in silent mode ("ex -s")
|
||||
@@ -3530,7 +3525,7 @@ int do_dialog(int type, char *title, char *message, char *buttons, int dfltbutto
|
||||
|
||||
for (;;) {
|
||||
// Get a typed character directly from the user.
|
||||
c = get_keystroke(NULL);
|
||||
int c = get_keystroke(NULL);
|
||||
switch (c) {
|
||||
case CAR: // User accepts default option
|
||||
case NL:
|
||||
|
Reference in New Issue
Block a user