mirror of
https://github.com/neovim/neovim.git
synced 2025-09-19 01:38:16 +00:00
refactor: follow style guide
- reduce variable scope - prefer initialization over declaration and assignment - use bool to represent boolean values
This commit is contained in:
@@ -55,8 +55,6 @@ void ex_help(exarg_T *eap)
|
||||
char **matches;
|
||||
int empty_fnum = 0;
|
||||
int alt_fnum = 0;
|
||||
buf_T *buf;
|
||||
int len;
|
||||
const bool old_KeyTyped = KeyTyped;
|
||||
|
||||
if (eap != NULL) {
|
||||
@@ -105,7 +103,7 @@ void ex_help(exarg_T *eap)
|
||||
if (n != FAIL && lang != NULL) {
|
||||
// Find first item with the requested language.
|
||||
for (i = 0; i < num_matches; i++) {
|
||||
len = (int)strlen(matches[i]);
|
||||
int len = (int)strlen(matches[i]);
|
||||
if (len > 3 && matches[i][len - 3] == '@'
|
||||
&& STRICMP(matches[i] + len - 2, lang) == 0) {
|
||||
break;
|
||||
@@ -196,7 +194,7 @@ void ex_help(exarg_T *eap)
|
||||
// may have jumped to another window, check that the buffer is not in a
|
||||
// window.
|
||||
if (empty_fnum != 0 && curbuf->b_fnum != empty_fnum) {
|
||||
buf = buflist_findnr(empty_fnum);
|
||||
buf_T *buf = buflist_findnr(empty_fnum);
|
||||
if (buf != NULL && buf->b_nwindows == 0) {
|
||||
wipe_buffer(buf, true);
|
||||
}
|
||||
@@ -647,9 +645,6 @@ void prepare_help_buffer(void)
|
||||
/// highlighting is not used.
|
||||
void fix_help_buffer(void)
|
||||
{
|
||||
linenr_T lnum;
|
||||
char *line;
|
||||
|
||||
// Set filetype to "help".
|
||||
if (strcmp(curbuf->b_p_ft, "help") != 0) {
|
||||
curbuf->b_ro_locked++;
|
||||
@@ -659,8 +654,8 @@ void fix_help_buffer(void)
|
||||
|
||||
if (!syntax_present(curwin)) {
|
||||
bool in_example = false;
|
||||
for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; lnum++) {
|
||||
line = ml_get_buf(curbuf, lnum);
|
||||
for (linenr_T lnum = 1; lnum <= curbuf->b_ml.ml_line_count; lnum++) {
|
||||
char *line = ml_get_buf(curbuf, lnum);
|
||||
const size_t len = strlen(line);
|
||||
if (in_example && len > 0 && !ascii_iswhite(line[0])) {
|
||||
// End of example: non-white or '<' in first column.
|
||||
@@ -695,8 +690,8 @@ void fix_help_buffer(void)
|
||||
&& ASCII_ISALPHA(fname[6])
|
||||
&& TOLOWER_ASC(fname[7]) == 'x'
|
||||
&& fname[8] == NUL)) {
|
||||
for (lnum = 1; lnum < curbuf->b_ml.ml_line_count; lnum++) {
|
||||
line = ml_get_buf(curbuf, lnum);
|
||||
for (linenr_T lnum = 1; lnum < curbuf->b_ml.ml_line_count; lnum++) {
|
||||
char *line = ml_get_buf(curbuf, lnum);
|
||||
if (strstr(line, "*local-additions*") == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user