patch 9.1.1363: style: inconsistent indentation in various files
Problem: style: inconsistent indentation in various files
Solution: fix style, updated codestyle test
(Naruhiko Nishino)
closes: #17254
Signed-off-by: Naruhiko Nishino <naru123456789@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/cindent.c b/src/cindent.c
index 2414b3f..eb7102e 100644
--- a/src/cindent.c
+++ b/src/cindent.c
@@ -406,10 +406,10 @@
while (vim_isIDc(**s))
{
- if (has_mbyte)
- (*s) += (*mb_ptr2len)(*s);
- else
- (*s)++;
+ if (has_mbyte)
+ (*s) += (*mb_ptr2len)(*s);
+ else
+ (*s)++;
}
*s = cin_skipcomment(*s);
diff --git a/src/clipboard.c b/src/clipboard.c
index 75e0f4f..fb967dc 100644
--- a/src/clipboard.c
+++ b/src/clipboard.c
@@ -2221,7 +2221,7 @@
&& clip_plus.available) ? '+' : '*';
}
if ((!clip_star.available && *rp == '*') ||
- (!clip_plus.available && *rp == '+'))
+ (!clip_plus.available && *rp == '+'))
{
msg_warn_missing_clipboard();
*rp = 0;
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 3b13cf0..74afd9d 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -5582,34 +5582,34 @@
f_getcellpixels(typval_T *argvars UNUSED, typval_T *rettv)
{
if (rettv_list_alloc(rettv) == FAIL)
- return;
+ return;
#if defined(FEAT_GUI)
if (gui.in_use)
{
- // success pixel size and no gui.
- list_append_number(rettv->vval.v_list, (varnumber_T)gui.char_width);
- list_append_number(rettv->vval.v_list, (varnumber_T)gui.char_height);
+ // success pixel size and no gui.
+ list_append_number(rettv->vval.v_list, (varnumber_T)gui.char_width);
+ list_append_number(rettv->vval.v_list, (varnumber_T)gui.char_height);
}
else
#endif
{
- struct cellsize cs;
+ struct cellsize cs;
#if defined(UNIX)
- mch_calc_cell_size(&cs);
+ mch_calc_cell_size(&cs);
#else
- // Non-Unix CUIs are not supported, so set this to -1x-1.
- cs.cs_xpixel = -1;
- cs.cs_ypixel = -1;
+ // Non-Unix CUIs are not supported, so set this to -1x-1.
+ cs.cs_xpixel = -1;
+ cs.cs_ypixel = -1;
#endif
- // failed get pixel size.
- if (cs.cs_xpixel == -1)
- return;
+ // failed get pixel size.
+ if (cs.cs_xpixel == -1)
+ return;
- // success pixel size and no gui.
- list_append_number(rettv->vval.v_list, (varnumber_T)cs.cs_xpixel);
- list_append_number(rettv->vval.v_list, (varnumber_T)cs.cs_ypixel);
+ // success pixel size and no gui.
+ list_append_number(rettv->vval.v_list, (varnumber_T)cs.cs_xpixel);
+ list_append_number(rettv->vval.v_list, (varnumber_T)cs.cs_ypixel);
}
}
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 279a202..0dad7b1 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -5975,7 +5975,7 @@
return expand_user_command_name(idx);
// the following are no real commands
if (STRNCMP(cmdnames[idx].cmd_name, "{", 1) == 0 ||
- STRNCMP(cmdnames[idx].cmd_name, "}", 1) == 0)
+ STRNCMP(cmdnames[idx].cmd_name, "}", 1) == 0)
return (char_u *)"";
return cmdnames[idx].cmd_name;
}
diff --git a/src/message.c b/src/message.c
index eade461..376119e 100644
--- a/src/message.c
+++ b/src/message.c
@@ -1127,17 +1127,17 @@
// Either "wait" or "hit-enter" is required
if (!(messages_flags_new & (MESSAGES_HIT_ENTER | MESSAGES_WAIT)))
- return FAIL;
+ return FAIL;
// "history" must be set
if (!(messages_flags_new & MESSAGES_HISTORY))
- return FAIL;
+ return FAIL;
if (messages_history_new < 0 || messages_history_new > 10000)
- return FAIL;
+ return FAIL;
if (messages_wait_new < 0 || messages_wait_new > 10000)
- return FAIL;
+ return FAIL;
msg_flags = messages_flags_new;
msg_wait = messages_wait_new;
diff --git a/src/os_unix.c b/src/os_unix.c
index de6e661..714f203 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -4440,14 +4440,14 @@
if (cs.cs_xpixel == -1)
{
- // failed get pixel size.
- ws.ws_xpixel = 0;
- ws.ws_ypixel = 0;
+ // failed get pixel size.
+ ws.ws_xpixel = 0;
+ ws.ws_ypixel = 0;
}
else
{
- ws.ws_xpixel = cols * cs.cs_xpixel;
- ws.ws_ypixel = rows * cs.cs_ypixel;
+ ws.ws_xpixel = cols * cs.cs_xpixel;
+ ws.ws_ypixel = rows * cs.cs_ypixel;
}
retval = ioctl(tty_fd, TIOCSWINSZ, &ws);
diff --git a/src/os_win32.c b/src/os_win32.c
index 799ec57..0b6fecd 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -971,7 +971,7 @@
ovi.dwOSVersionInfoSize = sizeof(ovi);
if (!GetVersionEx(&ovi))
- return;
+ return;
#ifdef FEAT_EVAL
vim_snprintf(windowsVersion, sizeof(windowsVersion), "%d.%d",
@@ -988,7 +988,7 @@
#ifdef HAVE_ACL
// Enable privilege for getting or setting SACLs.
if (!win32_enable_privilege(SE_SECURITY_NAME))
- return;
+ return;
#endif
}
#ifdef _MSC_VER
@@ -6349,7 +6349,7 @@
// Switch back to main screen buffer.
if (exiting && use_alternate_screen_buffer)
- vtp_printf("\033[?1049l");
+ vtp_printf("\033[?1049l");
if (!USE_WT && (p_rs || exiting))
{
diff --git a/src/popupmenu.c b/src/popupmenu.c
index 15d899c..4aaddaf 100644
--- a/src/popupmenu.c
+++ b/src/popupmenu.c
@@ -228,7 +228,7 @@
pum_size = size;
pum_compute_size();
max_width = pum_base_width;
- if (p_pmw > 0 && max_width > p_pmw)
+ if (p_pmw > 0 && max_width > p_pmw)
max_width = p_pmw;
// Calculate column
@@ -785,61 +785,61 @@
for ( ; ; MB_PTR_ADV(p))
{
- if (s == NULL)
- s = p;
- w = ptr2cells(p);
- if (*p != NUL && *p != TAB && *totwidth_ptr + w <= pum_width)
- {
- width += w;
- continue;
- }
+ if (s == NULL)
+ s = p;
+ w = ptr2cells(p);
+ if (*p != NUL && *p != TAB && *totwidth_ptr + w <= pum_width)
+ {
+ width += w;
+ continue;
+ }
- // Display the text that fits or comes before a Tab.
- // First convert it to printable characters.
- char_u *st;
- int *attrs = NULL;
- int saved = *p;
+ // Display the text that fits or comes before a Tab.
+ // First convert it to printable characters.
+ char_u *st;
+ int *attrs = NULL;
+ int saved = *p;
- if (saved != NUL)
- *p = NUL;
- st = transstr(s);
- if (saved != NUL)
- *p = saved;
+ if (saved != NUL)
+ *p = NUL;
+ st = transstr(s);
+ if (saved != NUL)
+ *p = saved;
- if (item_type == CPT_ABBR)
- attrs = pum_compute_text_attrs(st, hlf,
- pum_array[idx].pum_user_abbr_hlattr);
+ if (item_type == CPT_ABBR)
+ attrs = pum_compute_text_attrs(st, hlf,
+ pum_array[idx].pum_user_abbr_hlattr);
#ifdef FEAT_RIGHTLEFT
- if (pum_rl)
- col = pum_display_rtl_text(row, col, st, attr, attrs,
- width, pum_width, *totwidth_ptr, next_isempty);
- else
+ if (pum_rl)
+ col = pum_display_rtl_text(row, col, st, attr, attrs,
+ width, pum_width, *totwidth_ptr, next_isempty);
+ else
#endif
- col = pum_display_ltr_text(row, col, st, attr, attrs,
- width, pum_width, *totwidth_ptr, next_isempty);
+ col = pum_display_ltr_text(row, col, st, attr, attrs,
+ width, pum_width, *totwidth_ptr, next_isempty);
- if (attrs != NULL)
- VIM_CLEAR(attrs);
+ if (attrs != NULL)
+ VIM_CLEAR(attrs);
- if (*p != TAB)
- break;
+ if (*p != TAB)
+ break;
- // Display two spaces for a Tab.
+ // Display two spaces for a Tab.
#ifdef FEAT_RIGHTLEFT
- if (pum_rl)
- {
- screen_puts_len((char_u *)" ", 2, row, col - 1, attr);
- col -= 2;
- }
- else
+ if (pum_rl)
+ {
+ screen_puts_len((char_u *)" ", 2, row, col - 1, attr);
+ col -= 2;
+ }
+ else
#endif
- {
- screen_puts_len((char_u *)" ", 2, row, col, attr);
- col += 2;
- }
- *totwidth_ptr += 2;
- s = NULL; // start text at next char
- width = 0;
+ {
+ screen_puts_len((char_u *)" ", 2, row, col, attr);
+ col += 2;
+ }
+ *totwidth_ptr += 2;
+ s = NULL; // start text at next char
+ width = 0;
}
return col;
@@ -856,7 +856,7 @@
int thumb_height)
{
if (pum_scrollbar <= 0)
- return;
+ return;
int attr = (i >= thumb_pos && i < thumb_pos + thumb_height) ?
highlight_attr[HLF_PST] : highlight_attr[HLF_PSB];
diff --git a/src/popupwin.c b/src/popupwin.c
index 0cff7f6..60a54d7 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -3592,8 +3592,8 @@
{
popup_reset_handled(POPUP_HANDLED_2);
wp = find_next_popup(FALSE, POPUP_HANDLED_2);
- if (wp != NULL)
- {
+ if (wp != NULL)
+ {
popup_close_with_retval(wp, -1);
res = TRUE;
}
diff --git a/src/quickfix.c b/src/quickfix.c
index 2bc2f2d..2271ae0 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -2268,12 +2268,12 @@
if (buf != NULL &&
buf->b_ffname != NULL && fullname != NULL)
{
- if (fnamecmp(fullname, buf->b_ffname) != 0)
- {
- p = shorten_fname1(fullname);
- if (p != NULL)
+ if (fnamecmp(fullname, buf->b_ffname) != 0)
+ {
+ p = shorten_fname1(fullname);
+ if (p != NULL)
qfp->qf_fname = vim_strsave(p);
- }
+ }
}
vim_free(fullname);
if ((qfp->qf_text = vim_strsave(mesg)) == NULL)
@@ -7893,7 +7893,7 @@
{
entry_to_select = entry;
entry_to_select_index = qfl->qf_count;
- }
+ }
}
// Check if any valid error entries are added to the list.
diff --git a/src/search.c b/src/search.c
index 68b2e72..43491b6 100644
--- a/src/search.c
+++ b/src/search.c
@@ -4518,13 +4518,13 @@
}
// Check exact match condition
- if (currIdx != (int_u)i)
+ if (currIdx != (int_u)i)
is_exact_match = FALSE;
}
// Boost score for exact matches
if (is_exact_match && numMatches == strSz)
- score += EXACT_MATCH_BONUS;
+ score += EXACT_MATCH_BONUS;
return score;
}
@@ -5265,7 +5265,7 @@
char_u *line_end = NULL;
if (str == NULL || pat == NULL)
- return found;
+ return found;
line_end = find_line_end(str);
while (str < line_end)
@@ -5333,12 +5333,12 @@
int whole_line = ctrl_x_mode_whole_line();
if (buf == curbuf)
- circly_end = *start_pos;
+ circly_end = *start_pos;
else
{
- circly_end.lnum = buf->b_ml.ml_line_count;
- circly_end.col = 0;
- circly_end.coladd = 0;
+ circly_end.lnum = buf->b_ml.ml_line_count;
+ circly_end.col = 0;
+ circly_end.coladd = 0;
}
if (whole_line && start_pos->lnum != pos->lnum)
diff --git a/src/sign.c b/src/sign.c
index e997a77..6d54584 100644
--- a/src/sign.c
+++ b/src/sign.c
@@ -45,17 +45,17 @@
static char *cmds[] = { "define",
# define SIGNCMD_DEFINE 0
- "undefine",
+ "undefine",
# define SIGNCMD_UNDEFINE 1
- "list",
+ "list",
# define SIGNCMD_LIST 2
- "place",
+ "place",
# define SIGNCMD_PLACE 3
- "unplace",
+ "unplace",
# define SIGNCMD_UNPLACE 4
- "jump",
+ "jump",
# define SIGNCMD_JUMP 5
- NULL
+ NULL
# define SIGNCMD_LAST 6
};
@@ -87,21 +87,21 @@
if (HASHITEM_EMPTY(hi))
{
- // new group
- group = alloc(offsetof(signgroup_T, sg_name) + STRLEN(groupname) + 1);
- if (group == NULL)
- return NULL;
+ // new group
+ group = alloc(offsetof(signgroup_T, sg_name) + STRLEN(groupname) + 1);
+ if (group == NULL)
+ return NULL;
- STRCPY(group->sg_name, groupname);
- group->sg_refcount = 1;
- group->sg_next_sign_id = 1;
- hash_add_item(&sg_table, hi, group->sg_name, hash);
+ STRCPY(group->sg_name, groupname);
+ group->sg_refcount = 1;
+ group->sg_next_sign_id = 1;
+ hash_add_item(&sg_table, hi, group->sg_name, hash);
}
else
{
- // existing group
- group = HI2SG(hi);
- group->sg_refcount++;
+ // existing group
+ group = HI2SG(hi);
+ group->sg_refcount++;
}
return group;
@@ -116,15 +116,15 @@
{
hashitem_T *hi = hash_find(&sg_table, groupname);
if (HASHITEM_EMPTY(hi))
- return;
+ return;
signgroup_T *group = HI2SG(hi);
group->sg_refcount--;
if (group->sg_refcount == 0)
{
- // All the signs in this group are removed
- hash_remove(&sg_table, hi, "sign remove");
- vim_free(group);
+ // All the signs in this group are removed
+ hash_remove(&sg_table, hi, "sign remove");
+ vim_free(group);
}
}
@@ -137,9 +137,9 @@
sign_in_group(sign_entry_T *sign, char_u *group)
{
return ((group != NULL && STRCMP(group, "*") == 0) ||
- (group == NULL && sign->se_group == NULL) ||
- (group != NULL && sign->se_group != NULL &&
- STRCMP(group, sign->se_group->sg_name) == 0));
+ (group == NULL && sign->se_group == NULL) ||
+ (group != NULL && sign->se_group != NULL &&
+ STRCMP(group, sign->se_group->sg_name) == 0));
}
/*
@@ -150,7 +150,7 @@
sign_group_for_window(sign_entry_T *sign, win_T *wp)
{
int for_popup = sign->se_group != NULL &&
- STRNCMP("PopUp", sign->se_group->sg_name, 5) == 0;
+ STRNCMP("PopUp", sign->se_group->sg_name, 5) == 0;
return WIN_IS_POPUP(wp) ? for_popup : !for_popup;
}
@@ -167,31 +167,31 @@
if (groupname != NULL)
{
- hashitem_T *hi = hash_find(&sg_table, groupname);
- if (HASHITEM_EMPTY(hi))
- return id;
- group = HI2SG(hi);
+ hashitem_T *hi = hash_find(&sg_table, groupname);
+ if (HASHITEM_EMPTY(hi))
+ return id;
+ group = HI2SG(hi);
}
// Search for the next usable sign identifier
int found = FALSE;
while (!found)
{
- if (group == NULL)
- id = next_sign_id++; // global group
- else
- id = group->sg_next_sign_id++;
+ if (group == NULL)
+ id = next_sign_id++; // global group
+ else
+ id = group->sg_next_sign_id++;
- // Check whether this sign is already placed in the buffer
- found = TRUE;
- FOR_ALL_SIGNS_IN_BUF(buf, sign)
- {
- if (id == sign->se_id && sign_in_group(sign, groupname))
- {
- found = FALSE; // sign identifier is in use
- break;
- }
- }
+ // Check whether this sign is already placed in the buffer
+ found = TRUE;
+ FOR_ALL_SIGNS_IN_BUF(buf, sign)
+ {
+ if (id == sign->se_id && sign_in_group(sign, groupname))
+ {
+ found = FALSE; // sign identifier is in use
+ break;
+ }
+ }
}
return id;
@@ -203,18 +203,18 @@
*/
static void
insert_sign(buf_T *buf, // buffer to store sign in
- sign_entry_T *prev, // previous sign entry
- sign_entry_T *next, // next sign entry
- int id, // sign ID
- char_u *group, // sign group; NULL for global group
- int prio, // sign priority
- linenr_T lnum, // line number which gets the mark
- int typenr) // typenr of sign we are adding
+ sign_entry_T *prev, // previous sign entry
+ sign_entry_T *next, // next sign entry
+ int id, // sign ID
+ char_u *group, // sign group; NULL for global group
+ int prio, // sign priority
+ linenr_T lnum, // line number which gets the mark
+ int typenr) // typenr of sign we are adding
{
sign_entry_T *newsign =
- lalloc_id(sizeof(sign_entry_T), FALSE, aid_insert_sign);
+ lalloc_id(sizeof(sign_entry_T), FALSE, aid_insert_sign);
if (newsign == NULL)
- return;
+ return;
newsign->se_id = id;
newsign->se_lnum = lnum;
@@ -222,44 +222,44 @@
if (group != NULL)
{
- newsign->se_group = sign_group_ref(group);
- if (newsign->se_group == NULL)
- {
- vim_free(newsign);
- return;
- }
+ newsign->se_group = sign_group_ref(group);
+ if (newsign->se_group == NULL)
+ {
+ vim_free(newsign);
+ return;
+ }
}
else
{
- newsign->se_group = NULL;
+ newsign->se_group = NULL;
}
newsign->se_priority = prio;
newsign->se_next = next;
newsign->se_prev = prev;
if (next != NULL)
- next->se_prev = newsign;
+ next->se_prev = newsign;
if (prev == NULL)
{
- // When adding first sign need to redraw the windows to create the
- // column for signs.
- if (buf->b_signlist == NULL)
- {
- redraw_buf_later(buf, UPD_NOT_VALID);
- changed_line_abv_curs();
- }
+ // When adding first sign need to redraw the windows to create the
+ // column for signs.
+ if (buf->b_signlist == NULL)
+ {
+ redraw_buf_later(buf, UPD_NOT_VALID);
+ changed_line_abv_curs();
+ }
- // first sign in signlist
- buf->b_signlist = newsign;
+ // first sign in signlist
+ buf->b_signlist = newsign;
# ifdef FEAT_NETBEANS_INTG
- if (netbeans_active())
- buf->b_has_sign_column = TRUE;
+ if (netbeans_active())
+ buf->b_has_sign_column = TRUE;
# endif
}
else
{
- prev->se_next = newsign;
+ prev->se_next = newsign;
}
}
@@ -268,17 +268,17 @@
*/
static void
insert_sign_by_lnum_prio(buf_T *buf, // buffer to store sign in
- sign_entry_T *prev, // previous sign entry
- int id, // sign ID
- char_u *group, // sign group; NULL for global group
- int prio, // sign priority
- linenr_T lnum, // line number which gets the mark
- int typenr) // typenr of sign we are adding
+ sign_entry_T *prev, // previous sign entry
+ int id, // sign ID
+ char_u *group, // sign group; NULL for global group
+ int prio, // sign priority
+ linenr_T lnum, // line number which gets the mark
+ int typenr) // typenr of sign we are adding
{
// keep signs sorted by lnum and by priority: insert new sign at
// the proper position in the list for this lnum.
while (prev != NULL && prev->se_lnum == lnum && prev->se_priority <= prio)
- prev = prev->se_prev;
+ prev = prev->se_prev;
sign_entry_T *sign = (prev == NULL) ? buf->b_signlist : prev->se_next;
@@ -293,8 +293,8 @@
{
sign_T *sp = NULL;
FOR_ALL_SIGNS(sp)
- if (sp->sn_typenr == typenr)
- return sp;
+ if (sp->sn_typenr == typenr)
+ return sp;
return NULL;
}
@@ -306,8 +306,8 @@
{
sign_T *sp = NULL;
FOR_ALL_SIGNS(sp)
- if (sp->sn_typenr == typenr)
- return sp->sn_name;
+ if (sp->sn_typenr == typenr)
+ return sp->sn_name;
return (char_u *)_("[Deleted]");
}
@@ -319,12 +319,12 @@
{
dict_T *d = dict_alloc_id(aid_sign_getinfo);
if (d == NULL)
- return NULL;
+ return NULL;
dict_add_number(d, "id", sign->se_id);
dict_add_string(d, "group",
- (sign->se_group == NULL) ? (char_u *)""
- : sign->se_group->sg_name);
+ (sign->se_group == NULL) ? (char_u *)""
+ : sign->se_group->sg_name);
dict_add_number(d, "lnum", sign->se_lnum);
dict_add_string(d, "name", sign_typenr2name(sign->se_typenr));
dict_add_number(d, "priority", sign->se_priority);
@@ -343,10 +343,10 @@
// If there is only one sign in the buffer or only one sign on the line or
// the sign is already sorted by priority, then return.
if ((sign->se_prev == NULL || sign->se_prev->se_lnum != sign->se_lnum ||
- sign->se_prev->se_priority > sign->se_priority) &&
- (sign->se_next == NULL || sign->se_next->se_lnum != sign->se_lnum ||
- sign->se_next->se_priority < sign->se_priority))
- return;
+ sign->se_prev->se_priority > sign->se_priority) &&
+ (sign->se_next == NULL || sign->se_next->se_lnum != sign->se_lnum ||
+ sign->se_next->se_priority < sign->se_priority))
+ return;
// One or more signs on the same line as 'sign'
// Find a sign after which 'sign' should be inserted
@@ -354,28 +354,28 @@
// First search backward for a sign with higher priority on the same line
sign_entry_T *p = sign;
while (p->se_prev != NULL && p->se_prev->se_lnum == sign->se_lnum &&
- p->se_prev->se_priority <= sign->se_priority)
- p = p->se_prev;
+ p->se_prev->se_priority <= sign->se_priority)
+ p = p->se_prev;
if (p == sign)
{
- // Sign not found. Search forward for a sign with priority just before
- // 'sign'.
- p = sign->se_next;
- while (p->se_next != NULL && p->se_next->se_lnum == sign->se_lnum &&
- p->se_next->se_priority > sign->se_priority)
- p = p->se_next;
+ // Sign not found. Search forward for a sign with priority just before
+ // 'sign'.
+ p = sign->se_next;
+ while (p->se_next != NULL && p->se_next->se_lnum == sign->se_lnum &&
+ p->se_next->se_priority > sign->se_priority)
+ p = p->se_next;
}
// Remove 'sign' from the list
if (buf->b_signlist == sign)
- buf->b_signlist = sign->se_next;
+ buf->b_signlist = sign->se_next;
if (sign->se_prev != NULL)
- sign->se_prev->se_next = sign->se_next;
+ sign->se_prev->se_next = sign->se_next;
if (sign->se_next != NULL)
- sign->se_next->se_prev = sign->se_prev;
+ sign->se_next->se_prev = sign->se_prev;
sign->se_prev = NULL;
sign->se_next = NULL;
@@ -383,24 +383,24 @@
// Re-insert 'sign' at the right place
if (p->se_priority <= sign->se_priority)
{
- // 'sign' has a higher priority and should be inserted before 'p'
- sign->se_prev = p->se_prev;
- sign->se_next = p;
- p->se_prev = sign;
- if (sign->se_prev != NULL)
- sign->se_prev->se_next = sign;
+ // 'sign' has a higher priority and should be inserted before 'p'
+ sign->se_prev = p->se_prev;
+ sign->se_next = p;
+ p->se_prev = sign;
+ if (sign->se_prev != NULL)
+ sign->se_prev->se_next = sign;
- if (buf->b_signlist == p)
- buf->b_signlist = sign;
+ if (buf->b_signlist == p)
+ buf->b_signlist = sign;
}
else
{
- // 'sign' has a lower priority and should be inserted after 'p'
- sign->se_prev = p;
- sign->se_next = p->se_next;
- p->se_next = sign;
- if (sign->se_next != NULL)
- sign->se_next->se_prev = sign;
+ // 'sign' has a lower priority and should be inserted after 'p'
+ sign->se_prev = p;
+ sign->se_next = p->se_next;
+ p->se_next = sign;
+ if (sign->se_next != NULL)
+ sign->se_next->se_prev = sign;
}
}
@@ -409,32 +409,32 @@
*/
static void
buf_addsign(buf_T *buf, // buffer to store sign in
- int id, // sign ID
- char_u *groupname, // sign group
- int prio, // sign priority
- linenr_T lnum, // line number which gets the mark
- int typenr) // typenr of sign we are adding
+ int id, // sign ID
+ char_u *groupname, // sign group
+ int prio, // sign priority
+ linenr_T lnum, // line number which gets the mark
+ int typenr) // typenr of sign we are adding
{
sign_entry_T *sign = NULL; // a sign in the signlist
sign_entry_T *prev = NULL; // the previous sign
FOR_ALL_SIGNS_IN_BUF(buf, sign)
{
- if (lnum == sign->se_lnum && id == sign->se_id &&
- sign_in_group(sign, groupname))
- {
- // Update an existing sign
- sign->se_typenr = typenr;
- sign->se_priority = prio;
- sign_sort_by_prio_on_line(buf, sign);
- return;
- }
- else if (lnum < sign->se_lnum)
- {
- insert_sign_by_lnum_prio(buf, prev, id, groupname, prio, lnum,
- typenr);
- return;
- }
- prev = sign;
+ if (lnum == sign->se_lnum && id == sign->se_id &&
+ sign_in_group(sign, groupname))
+ {
+ // Update an existing sign
+ sign->se_typenr = typenr;
+ sign->se_priority = prio;
+ sign_sort_by_prio_on_line(buf, sign);
+ return;
+ }
+ else if (lnum < sign->se_lnum)
+ {
+ insert_sign_by_lnum_prio(buf, prev, id, groupname, prio, lnum,
+ typenr);
+ return;
+ }
+ prev = sign;
}
insert_sign_by_lnum_prio(buf, prev, id, groupname, prio, lnum, typenr);
@@ -446,21 +446,21 @@
*/
static linenr_T
buf_change_sign_type(buf_T *buf, // buffer to store sign in
- int markId, // sign ID
- char_u *group, // sign group
- int typenr, // typenr of sign we are adding
- int prio) // sign priority
+ int markId, // sign ID
+ char_u *group, // sign group
+ int typenr, // typenr of sign we are adding
+ int prio) // sign priority
{
sign_entry_T *sign = NULL; // a sign in the signlist
FOR_ALL_SIGNS_IN_BUF(buf, sign)
{
- if (sign->se_id == markId && sign_in_group(sign, group))
- {
- sign->se_typenr = typenr;
- sign->se_priority = prio;
- sign_sort_by_prio_on_line(buf, sign);
- return sign->se_lnum;
- }
+ if (sign->se_id == markId && sign_in_group(sign, group))
+ {
+ sign->se_typenr = typenr;
+ sign->se_priority = prio;
+ sign_sort_by_prio_on_line(buf, sign);
+ return sign->se_lnum;
+ }
}
return (linenr_T)0;
@@ -480,73 +480,73 @@
sign_entry_T *sign = NULL;
FOR_ALL_SIGNS_IN_BUF(buf, sign)
{
- // Signs are sorted by line number in the buffer. No need to check
- // for signs after the specified line number 'lnum'.
- if (sign->se_lnum > lnum)
- break;
+ // Signs are sorted by line number in the buffer. No need to check
+ // for signs after the specified line number 'lnum'.
+ if (sign->se_lnum > lnum)
+ break;
- if (sign->se_lnum == lnum
+ if (sign->se_lnum == lnum
# ifdef FEAT_PROP_POPUP
- && sign_group_for_window(sign, wp)
+ && sign_group_for_window(sign, wp)
# endif
- )
- {
- sattr->sat_typenr = sign->se_typenr;
- sign_T *sp = find_sign_by_typenr(sign->se_typenr);
- if (sp == NULL)
- return FALSE;
+ )
+ {
+ sattr->sat_typenr = sign->se_typenr;
+ sign_T *sp = find_sign_by_typenr(sign->se_typenr);
+ if (sp == NULL)
+ return FALSE;
# ifdef FEAT_SIGN_ICONS
- sattr->sat_icon = sp->sn_image;
+ sattr->sat_icon = sp->sn_image;
# endif
- sattr->sat_text = sp->sn_text;
+ sattr->sat_text = sp->sn_text;
- if (sattr->sat_text != NULL && sp->sn_text_hl > 0)
- sattr->sat_texthl = syn_id2attr(sp->sn_text_hl);
+ if (sattr->sat_text != NULL && sp->sn_text_hl > 0)
+ sattr->sat_texthl = syn_id2attr(sp->sn_text_hl);
- if (sp->sn_line_hl > 0)
- sattr->sat_linehl = syn_id2attr(sp->sn_line_hl);
+ if (sp->sn_line_hl > 0)
+ sattr->sat_linehl = syn_id2attr(sp->sn_line_hl);
- if (sp->sn_cul_hl > 0)
- sattr->sat_culhl = syn_id2attr(sp->sn_cul_hl);
+ if (sp->sn_cul_hl > 0)
+ sattr->sat_culhl = syn_id2attr(sp->sn_cul_hl);
- if (sp->sn_num_hl > 0)
- sattr->sat_numhl = syn_id2attr(sp->sn_num_hl);
+ if (sp->sn_num_hl > 0)
+ sattr->sat_numhl = syn_id2attr(sp->sn_num_hl);
- sattr->sat_priority = sign->se_priority;
+ sattr->sat_priority = sign->se_priority;
- // If there is another sign next with the same priority, may
- // combine the text and the line highlighting.
- if (sign->se_next != NULL &&
- sign->se_next->se_priority == sign->se_priority &&
- sign->se_next->se_lnum == sign->se_lnum)
- {
- sign_T *next_sp = find_sign_by_typenr(sign->se_next->se_typenr);
- if (next_sp == NULL)
- return FALSE;
+ // If there is another sign next with the same priority, may
+ // combine the text and the line highlighting.
+ if (sign->se_next != NULL &&
+ sign->se_next->se_priority == sign->se_priority &&
+ sign->se_next->se_lnum == sign->se_lnum)
+ {
+ sign_T *next_sp = find_sign_by_typenr(sign->se_next->se_typenr);
+ if (next_sp == NULL)
+ return FALSE;
- if (sattr->sat_icon == NULL && sattr->sat_text == NULL)
- {
+ if (sattr->sat_icon == NULL && sattr->sat_text == NULL)
+ {
# ifdef FEAT_SIGN_ICONS
- sattr->sat_icon = next_sp->sn_image;
+ sattr->sat_icon = next_sp->sn_image;
# endif
- sattr->sat_text = next_sp->sn_text;
- }
+ sattr->sat_text = next_sp->sn_text;
+ }
- if (sp->sn_text_hl <= 0 && next_sp->sn_text_hl > 0)
- sattr->sat_texthl = syn_id2attr(next_sp->sn_text_hl);
+ if (sp->sn_text_hl <= 0 && next_sp->sn_text_hl > 0)
+ sattr->sat_texthl = syn_id2attr(next_sp->sn_text_hl);
- if (sp->sn_line_hl <= 0 && next_sp->sn_line_hl > 0)
- sattr->sat_linehl = syn_id2attr(next_sp->sn_line_hl);
+ if (sp->sn_line_hl <= 0 && next_sp->sn_line_hl > 0)
+ sattr->sat_linehl = syn_id2attr(next_sp->sn_line_hl);
- if (sp->sn_cul_hl <= 0 && next_sp->sn_cul_hl > 0)
- sattr->sat_culhl = syn_id2attr(next_sp->sn_cul_hl);
+ if (sp->sn_cul_hl <= 0 && next_sp->sn_cul_hl > 0)
+ sattr->sat_culhl = syn_id2attr(next_sp->sn_cul_hl);
- if (sp->sn_num_hl <= 0 && next_sp->sn_num_hl > 0)
- sattr->sat_numhl = syn_id2attr(next_sp->sn_num_hl);
- }
- return TRUE;
- }
+ if (sp->sn_num_hl <= 0 && next_sp->sn_num_hl > 0)
+ sattr->sat_numhl = syn_id2attr(next_sp->sn_num_hl);
+ }
+ return TRUE;
+ }
}
return FALSE;
}
@@ -563,9 +563,9 @@
*/
linenr_T
buf_delsign(buf_T *buf, // buffer sign is stored in
- linenr_T atlnum, // sign at this line, 0 - at any line
- int id, // sign id
- char_u *group) // sign group
+ linenr_T atlnum, // sign at this line, 0 - at any line
+ int id, // sign id
+ char_u *group) // sign group
{
// pointer to pointer to current sign
sign_entry_T **lastp = &buf->b_signlist;
@@ -574,44 +574,44 @@
for (sign_entry_T *sign = buf->b_signlist; sign != NULL; sign = next)
{
- next = sign->se_next;
+ next = sign->se_next;
- if ((id == 0 || sign->se_id == id) &&
- (atlnum == 0 || sign->se_lnum == atlnum) &&
- sign_in_group(sign, group))
- {
- *lastp = next;
- if (next != NULL)
- next->se_prev = sign->se_prev;
+ if ((id == 0 || sign->se_id == id) &&
+ (atlnum == 0 || sign->se_lnum == atlnum) &&
+ sign_in_group(sign, group))
+ {
+ *lastp = next;
+ if (next != NULL)
+ next->se_prev = sign->se_prev;
- lnum = sign->se_lnum;
+ lnum = sign->se_lnum;
- if (sign->se_group != NULL)
- sign_group_unref(sign->se_group->sg_name);
+ if (sign->se_group != NULL)
+ sign_group_unref(sign->se_group->sg_name);
- vim_free(sign);
- redraw_buf_line_later(buf, lnum);
+ vim_free(sign);
+ redraw_buf_line_later(buf, lnum);
- // Check whether only one sign needs to be deleted
- // If deleting a sign with a specific identifier in a particular
- // group or deleting any sign at a particular line number, delete
- // only one sign.
- if (group == NULL || (*group != '*' && id != 0) ||
- (*group == '*' && atlnum != 0))
- break;
- }
- else
- {
- lastp = &sign->se_next;
- }
+ // Check whether only one sign needs to be deleted
+ // If deleting a sign with a specific identifier in a particular
+ // group or deleting any sign at a particular line number, delete
+ // only one sign.
+ if (group == NULL || (*group != '*' && id != 0) ||
+ (*group == '*' && atlnum != 0))
+ break;
+ }
+ else
+ {
+ lastp = &sign->se_next;
+ }
}
// When deleting the last sign the cursor position may change, because the
// sign columns no longer shows. And the 'signcolumn' may be hidden.
if (buf->b_signlist == NULL)
{
- redraw_buf_later(buf, UPD_NOT_VALID);
- changed_line_abv_curs();
+ redraw_buf_later(buf, UPD_NOT_VALID);
+ changed_line_abv_curs();
}
return lnum;
@@ -624,13 +624,13 @@
*/
int
buf_findsign(buf_T *buf, // buffer to store sign in
- int id, // sign ID
- char_u *group) // sign group
+ int id, // sign ID
+ char_u *group) // sign group
{
sign_entry_T *sign = NULL; // a sign in the signlist
FOR_ALL_SIGNS_IN_BUF(buf, sign)
- if (sign->se_id == id && sign_in_group(sign, group))
- return sign->se_lnum;
+ if (sign->se_id == id && sign_in_group(sign, group))
+ return sign->se_lnum;
return 0;
}
@@ -641,19 +641,19 @@
*/
static sign_entry_T *
buf_getsign_at_line(buf_T *buf, // buffer whose sign we are searching for
- linenr_T lnum, // line number of sign
- char_u *groupname) // sign group name
+ linenr_T lnum, // line number of sign
+ char_u *groupname) // sign group name
{
sign_entry_T *sign = NULL; // a sign in the signlist
FOR_ALL_SIGNS_IN_BUF(buf, sign)
{
- // Signs are sorted by line number in the buffer. No need to check
- // for signs after the specified line number 'lnum'.
- if (sign->se_lnum > lnum)
- break;
+ // Signs are sorted by line number in the buffer. No need to check
+ // for signs after the specified line number 'lnum'.
+ if (sign->se_lnum > lnum)
+ break;
- if (sign->se_lnum == lnum && sign_in_group(sign, groupname))
- return sign;
+ if (sign->se_lnum == lnum && sign_in_group(sign, groupname))
+ return sign;
}
return NULL;
@@ -664,13 +664,13 @@
*/
int
buf_findsign_id(buf_T *buf, // buffer whose sign we are searching for
- linenr_T lnum, // line number of sign
- char_u *groupname) // sign group name
+ linenr_T lnum, // line number of sign
+ char_u *groupname) // sign group name
{
// a sign in the signlist
sign_entry_T *sign = buf_getsign_at_line(buf, lnum, groupname);
if (sign != NULL)
- return sign->se_id;
+ return sign->se_id;
return 0;
}
@@ -681,19 +681,19 @@
*/
int
buf_findsigntype_id(buf_T *buf, // buffer whose sign we are searching for
- linenr_T lnum, // line number of sign
- int typenr) // sign type number
+ linenr_T lnum, // line number of sign
+ int typenr) // sign type number
{
sign_entry_T *sign = NULL; // a sign in the signlist
FOR_ALL_SIGNS_IN_BUF(buf, sign)
{
- // Signs are sorted by line number in the buffer. No need to check
- // for signs after the specified line number 'lnum'.
- if (sign->se_lnum > lnum)
- break;
+ // Signs are sorted by line number in the buffer. No need to check
+ // for signs after the specified line number 'lnum'.
+ if (sign->se_lnum > lnum)
+ break;
- if (sign->se_lnum == lnum && sign->se_typenr == typenr)
- return sign->se_id;
+ if (sign->se_lnum == lnum && sign->se_typenr == typenr)
+ return sign->se_id;
}
return 0;
@@ -710,13 +710,13 @@
sign_entry_T *sign = NULL; // a sign in the signlist
FOR_ALL_SIGNS_IN_BUF(buf, sign)
{
- // Signs are sorted by line number in the buffer. No need to check
- // for signs after the specified line number 'lnum'.
- if (sign->se_lnum > lnum)
- break;
+ // Signs are sorted by line number in the buffer. No need to check
+ // for signs after the specified line number 'lnum'.
+ if (sign->se_lnum > lnum)
+ break;
- if (sign->se_lnum == lnum && sign_get_image(sign->se_typenr) != NULL)
- count++;
+ if (sign->se_lnum == lnum && sign_get_image(sign->se_typenr) != NULL)
+ count++;
}
return count;
@@ -735,8 +735,8 @@
// sign column. Not when curwin is NULL (this means we're exiting).
if (buf->b_signlist != NULL && curwin != NULL)
{
- redraw_buf_later(buf, UPD_NOT_VALID);
- changed_line_abv_curs();
+ redraw_buf_later(buf, UPD_NOT_VALID);
+ changed_line_abv_curs();
}
// pointer to pointer to current sign
@@ -745,23 +745,23 @@
for (sign_entry_T *sign = buf->b_signlist; sign != NULL; sign = next)
{
- next = sign->se_next;
- if (sign_in_group(sign, group))
- {
- *lastp = next;
+ next = sign->se_next;
+ if (sign_in_group(sign, group))
+ {
+ *lastp = next;
- if (next != NULL)
- next->se_prev = sign->se_prev;
+ if (next != NULL)
+ next->se_prev = sign->se_prev;
- if (sign->se_group != NULL)
- sign_group_unref(sign->se_group->sg_name);
+ if (sign->se_group != NULL)
+ sign_group_unref(sign->se_group->sg_name);
- vim_free(sign);
- }
- else
- {
- lastp = &sign->se_next;
- }
+ vim_free(sign);
+ }
+ else
+ {
+ lastp = &sign->se_next;
+ }
}
}
@@ -780,41 +780,41 @@
buf_T *buf = (rbuf == NULL) ? firstbuf : rbuf;
while (buf != NULL && !got_int)
{
- if (buf->b_signlist != NULL)
- {
- vim_snprintf(lbuf, MSG_BUF_LEN, _("Signs for %s:"), buf->b_fname);
- msg_puts_attr(lbuf, HL_ATTR(HLF_D));
- msg_putchar('\n');
- }
+ if (buf->b_signlist != NULL)
+ {
+ vim_snprintf(lbuf, MSG_BUF_LEN, _("Signs for %s:"), buf->b_fname);
+ msg_puts_attr(lbuf, HL_ATTR(HLF_D));
+ msg_putchar('\n');
+ }
- sign_entry_T *sign = NULL;
- FOR_ALL_SIGNS_IN_BUF(buf, sign)
- {
- if (got_int)
- break;
+ sign_entry_T *sign = NULL;
+ FOR_ALL_SIGNS_IN_BUF(buf, sign)
+ {
+ if (got_int)
+ break;
- if (!sign_in_group(sign, sign_group))
- continue;
+ if (!sign_in_group(sign, sign_group))
+ continue;
- if (sign->se_group != NULL)
- vim_snprintf(group, MSG_BUF_LEN, _(" group=%s"),
- sign->se_group->sg_name);
- else
- group[0] = '\0';
+ if (sign->se_group != NULL)
+ vim_snprintf(group, MSG_BUF_LEN, _(" group=%s"),
+ sign->se_group->sg_name);
+ else
+ group[0] = '\0';
- vim_snprintf(lbuf, MSG_BUF_LEN,
- _(" line=%ld id=%d%s name=%s priority=%d"),
- (long)sign->se_lnum, sign->se_id, group,
- sign_typenr2name(sign->se_typenr), sign->se_priority);
+ vim_snprintf(lbuf, MSG_BUF_LEN,
+ _(" line=%ld id=%d%s name=%s priority=%d"),
+ (long)sign->se_lnum, sign->se_id, group,
+ sign_typenr2name(sign->se_typenr), sign->se_priority);
- msg_puts(lbuf);
- msg_putchar('\n');
- }
+ msg_puts(lbuf);
+ msg_putchar('\n');
+ }
- if (rbuf != NULL)
- break;
+ if (rbuf != NULL)
+ break;
- buf = buf->b_next;
+ buf = buf->b_next;
}
}
@@ -827,28 +827,28 @@
sign_entry_T *sign = NULL; // a sign in a b_signlist
FOR_ALL_SIGNS_IN_BUF(curbuf, sign)
{
- // Ignore changes to lines after the sign
- if (sign->se_lnum < line1)
- continue;
+ // Ignore changes to lines after the sign
+ if (sign->se_lnum < line1)
+ continue;
- linenr_T new_lnum = sign->se_lnum;
+ linenr_T new_lnum = sign->se_lnum;
- if (sign->se_lnum <= line2)
- {
- if (amount != MAXLNUM)
- new_lnum += amount;
- }
- else if (sign->se_lnum > line2)
- {
- // Lines inserted or deleted before the sign
- new_lnum += amount_after;
- }
+ if (sign->se_lnum <= line2)
+ {
+ if (amount != MAXLNUM)
+ new_lnum += amount;
+ }
+ else if (sign->se_lnum > line2)
+ {
+ // Lines inserted or deleted before the sign
+ new_lnum += amount_after;
+ }
- // If the new sign line number is past the last line in the buffer,
- // then don't adjust the line number. Otherwise, it will always be past
- // the last line and will not be visible.
- if (new_lnum <= curbuf->b_ml.ml_line_count)
- sign->se_lnum = new_lnum;
+ // If the new sign line number is past the last line in the buffer,
+ // then don't adjust the line number. Otherwise, it will always be past
+ // the last line and will not be visible.
+ if (new_lnum <= curbuf->b_ml.ml_line_count)
+ sign->se_lnum = new_lnum;
}
}
@@ -858,14 +858,14 @@
*/
static int
sign_cmd_idx(char_u *begin_cmd, // begin of sign subcmd
- char_u *end_cmd) // just after sign subcmd
+ char_u *end_cmd) // just after sign subcmd
{
int idx = 0;
char save = *end_cmd;
*end_cmd = NUL;
while (cmds[idx] != NULL && STRCMP(begin_cmd, cmds[idx]) != 0)
- ++idx;
+ ++idx;
*end_cmd = save;
return idx;
@@ -878,16 +878,16 @@
sign_find(char_u *name, sign_T **sp_prev)
{
if (sp_prev != NULL)
- *sp_prev = NULL;
+ *sp_prev = NULL;
sign_T *sp = NULL;
FOR_ALL_SIGNS(sp)
{
- if (STRCMP(sp->sn_name, name) == 0)
- break;
+ if (STRCMP(sp->sn_name, name) == 0)
+ break;
- if (sp_prev != NULL)
- *sp_prev = sp;
+ if (sp_prev != NULL)
+ *sp_prev = sp;
}
return sp;
@@ -904,7 +904,7 @@
// Allocate a new sign.
sign_T *sp = alloc_clear_id(sizeof(sign_T), aid_sign_define_by_name);
if (sp == NULL)
- return NULL;
+ return NULL;
// Check that next_sign_typenr is not already being used.
// This only happens after wrapping around. Hopefully
@@ -912,36 +912,36 @@
sign_T *lp = first_sign;
while (lp != NULL)
{
- if (lp->sn_typenr == next_sign_typenr)
- {
- ++next_sign_typenr;
+ if (lp->sn_typenr == next_sign_typenr)
+ {
+ ++next_sign_typenr;
- if (next_sign_typenr == MAX_TYPENR)
- next_sign_typenr = 1;
+ if (next_sign_typenr == MAX_TYPENR)
+ next_sign_typenr = 1;
- if (next_sign_typenr == start)
- {
- vim_free(sp);
- emsg(_(e_too_many_signs_defined));
- return NULL;
- }
+ if (next_sign_typenr == start)
+ {
+ vim_free(sp);
+ emsg(_(e_too_many_signs_defined));
+ return NULL;
+ }
- lp = first_sign; // start all over
- continue;
- }
- lp = lp->sn_next;
+ lp = first_sign; // start all over
+ continue;
+ }
+ lp = lp->sn_next;
}
sp->sn_typenr = next_sign_typenr;
if (++next_sign_typenr == MAX_TYPENR)
- next_sign_typenr = 1; // wrap around
+ next_sign_typenr = 1; // wrap around
sp->sn_name = vim_strsave(name);
if (sp->sn_name == NULL) // out of memory
{
- vim_free(sp);
- return NULL;
+ vim_free(sp);
+ return NULL;
}
return sp;
@@ -959,10 +959,10 @@
# ifdef FEAT_SIGN_ICONS
if (gui.in_use)
{
- out_flush();
- if (sp->sn_image != NULL)
- gui_mch_destroy_sign(sp->sn_image);
- sp->sn_image = gui_mch_register_sign(sp->sn_icon);
+ out_flush();
+ if (sp->sn_image != NULL)
+ gui_mch_destroy_sign(sp->sn_image);
+ sp->sn_image = gui_mch_register_sign(sp->sn_icon);
}
# endif
}
@@ -980,39 +980,39 @@
// Remove backslashes so that it is possible to use a space.
for (s = text; s + 1 < endp; ++s)
{
- if (*s == '\\')
- {
- STRMOVE(s, s + 1);
- --endp;
- }
+ if (*s == '\\')
+ {
+ STRMOVE(s, s + 1);
+ --endp;
+ }
}
// Count cells and check for non-printable chars
if (has_mbyte)
{
- for (s = text; s < endp; s += (*mb_ptr2len)(s))
- {
- if (!vim_isprintc((*mb_ptr2char)(s)))
- break;
+ for (s = text; s < endp; s += (*mb_ptr2len)(s))
+ {
+ if (!vim_isprintc((*mb_ptr2char)(s)))
+ break;
- cells += (*mb_ptr2cells)(s);
- }
+ cells += (*mb_ptr2cells)(s);
+ }
}
else
{
- for (s = text; s < endp; ++s)
- {
- if (!vim_isprintc(*s))
- break;
- }
- cells = (int)(s - text);
+ for (s = text; s < endp; ++s)
+ {
+ if (!vim_isprintc(*s))
+ break;
+ }
+ cells = (int)(s - text);
}
// Currently sign text must be one or two display cells
if (s != endp || cells < 1 || cells > 2)
{
- semsg(_(e_invalid_sign_text_str), text);
- return FAIL;
+ semsg(_(e_invalid_sign_text_str), text);
+ return FAIL;
}
vim_free(sp->sn_text);
@@ -1023,7 +1023,7 @@
// For single character sign text, pad with a space.
if (sp->sn_text != NULL && cells == 1)
- STRCPY(sp->sn_text + len - 1, " ");
+ STRCPY(sp->sn_text + len - 1, " ");
return OK;
}
@@ -1033,79 +1033,79 @@
*/
int
sign_define_by_name(char_u *name,
- char_u *icon,
- char_u *linehl,
- char_u *text,
- char_u *texthl,
- char_u *culhl,
- char_u *numhl,
- int prio)
+ char_u *icon,
+ char_u *linehl,
+ char_u *text,
+ char_u *texthl,
+ char_u *culhl,
+ char_u *numhl,
+ int prio)
{
sign_T *sp_prev = NULL;
sign_T *sp = sign_find(name, &sp_prev);
if (sp == NULL)
{
- sp = alloc_new_sign(name);
- if (sp == NULL)
- return FAIL;
+ sp = alloc_new_sign(name);
+ if (sp == NULL)
+ return FAIL;
- // add the new sign to the list of signs
- if (sp_prev == NULL)
- first_sign = sp;
- else
- sp_prev->sn_next = sp;
+ // add the new sign to the list of signs
+ if (sp_prev == NULL)
+ first_sign = sp;
+ else
+ sp_prev->sn_next = sp;
}
else
{
- win_T *wp = NULL;
- // Signs may already exist, a redraw is needed in windows with a
- // non-empty sign list.
- FOR_ALL_WINDOWS(wp)
- {
- if (wp->w_buffer->b_signlist != NULL)
- redraw_buf_later(wp->w_buffer, UPD_NOT_VALID);
- }
+ win_T *wp = NULL;
+ // Signs may already exist, a redraw is needed in windows with a
+ // non-empty sign list.
+ FOR_ALL_WINDOWS(wp)
+ {
+ if (wp->w_buffer->b_signlist != NULL)
+ redraw_buf_later(wp->w_buffer, UPD_NOT_VALID);
+ }
}
// set values for a defined sign.
if (icon != NULL)
- sign_define_init_icon(sp, icon);
+ sign_define_init_icon(sp, icon);
if (text != NULL && (sign_define_init_text(sp, text) == FAIL))
- return FAIL;
+ return FAIL;
sp->sn_priority = prio;
if (linehl != NULL)
{
- if (*linehl == NUL)
- sp->sn_line_hl = 0;
- else
- sp->sn_line_hl = syn_check_group(linehl, (int)STRLEN(linehl));
+ if (*linehl == NUL)
+ sp->sn_line_hl = 0;
+ else
+ sp->sn_line_hl = syn_check_group(linehl, (int)STRLEN(linehl));
}
if (texthl != NULL)
{
- if (*texthl == NUL)
- sp->sn_text_hl = 0;
- else
- sp->sn_text_hl = syn_check_group(texthl, (int)STRLEN(texthl));
+ if (*texthl == NUL)
+ sp->sn_text_hl = 0;
+ else
+ sp->sn_text_hl = syn_check_group(texthl, (int)STRLEN(texthl));
}
if (culhl != NULL)
{
- if (*culhl == NUL)
- sp->sn_cul_hl = 0;
- else
- sp->sn_cul_hl = syn_check_group(culhl, (int)STRLEN(culhl));
+ if (*culhl == NUL)
+ sp->sn_cul_hl = 0;
+ else
+ sp->sn_cul_hl = syn_check_group(culhl, (int)STRLEN(culhl));
}
if (numhl != NULL)
{
- if (*numhl == NUL)
- sp->sn_num_hl = 0;
- else
- sp->sn_num_hl = syn_check_group(numhl, (int)STRLEN(numhl));
+ if (*numhl == NUL)
+ sp->sn_num_hl = 0;
+ else
+ sp->sn_num_hl = syn_check_group(numhl, (int)STRLEN(numhl));
}
return OK;
@@ -1130,9 +1130,9 @@
sign_T *sp = sign_find(name, &sp_prev);
if (sp == NULL)
{
- if (give_error)
- semsg(_(e_unknown_sign_str), name);
- return FAIL;
+ if (give_error)
+ semsg(_(e_unknown_sign_str), name);
+ return FAIL;
}
sign_undefine(sp, sp_prev);
@@ -1147,9 +1147,9 @@
{
sign_T *sp = sign_find(name, NULL);
if (sp != NULL)
- sign_list_defined(sp);
+ sign_list_defined(sp);
else
- semsg(_(e_unknown_sign_str), name);
+ semsg(_(e_unknown_sign_str), name);
}
static void
@@ -1160,10 +1160,10 @@
FOR_ALL_TAB_WINDOWS(tp, wp)
{
- if (wp->w_buffer == buf && (wp->w_p_nu || wp->w_p_rnu) &&
- (unplace || wp->w_nrwidth_width < 2) &&
- (*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u'))
- wp->w_nrwidth_line_count = 0;
+ if (wp->w_buffer == buf && (wp->w_p_nu || wp->w_p_rnu) &&
+ (unplace || wp->w_nrwidth_width < 2) &&
+ (*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u'))
+ wp->w_nrwidth_line_count = 0;
}
}
@@ -1172,61 +1172,61 @@
*/
int
sign_place(int *sign_id,
- char_u *sign_group,
- char_u *sign_name,
- buf_T *buf,
- linenr_T lnum,
- int prio)
+ char_u *sign_group,
+ char_u *sign_name,
+ buf_T *buf,
+ linenr_T lnum,
+ int prio)
{
// Check for reserved character '*' in group name
if (sign_group != NULL && (*sign_group == '*' || *sign_group == '\0'))
- return FAIL;
+ return FAIL;
sign_T *sp = NULL;
FOR_ALL_SIGNS(sp)
{
- if (STRCMP(sp->sn_name, sign_name) == 0)
- break;
+ if (STRCMP(sp->sn_name, sign_name) == 0)
+ break;
}
if (sp == NULL)
{
- semsg(_(e_unknown_sign_str), sign_name);
- return FAIL;
+ semsg(_(e_unknown_sign_str), sign_name);
+ return FAIL;
}
if (*sign_id == 0)
- *sign_id = sign_group_get_next_signid(buf, sign_group);
+ *sign_id = sign_group_get_next_signid(buf, sign_group);
// Use the default priority value for this sign.
if (prio == -1)
- prio = (sp->sn_priority != -1) ? sp->sn_priority : SIGN_DEF_PRIO;
+ prio = (sp->sn_priority != -1) ? sp->sn_priority : SIGN_DEF_PRIO;
if (lnum > 0)
{
- // ":sign place {id} line={lnum} name={name} file={fname}":
- // place a sign
- buf_addsign(buf, *sign_id, sign_group, prio, lnum, sp->sn_typenr);
+ // ":sign place {id} line={lnum} name={name} file={fname}":
+ // place a sign
+ buf_addsign(buf, *sign_id, sign_group, prio, lnum, sp->sn_typenr);
}
else
{
- // ":sign place {id} file={fname}": change sign type and/or priority
- lnum = buf_change_sign_type(buf, *sign_id, sign_group, sp->sn_typenr,
- prio);
+ // ":sign place {id} file={fname}": change sign type and/or priority
+ lnum = buf_change_sign_type(buf, *sign_id, sign_group, sp->sn_typenr,
+ prio);
}
if (lnum > 0)
{
- redraw_buf_line_later(buf, lnum);
+ redraw_buf_line_later(buf, lnum);
- // When displaying signs in the 'number' column, if the width of the
- // number column is less than 2, then force recomputing the width.
- may_force_numberwidth_recompute(buf, FALSE);
+ // When displaying signs in the 'number' column, if the width of the
+ // number column is less than 2, then force recomputing the width.
+ may_force_numberwidth_recompute(buf, FALSE);
}
else
{
- semsg(_(e_not_possible_to_change_sign_str), sign_name);
- return FAIL;
+ semsg(_(e_not_possible_to_change_sign_str), sign_name);
+ return FAIL;
}
return OK;
@@ -1239,27 +1239,27 @@
sign_unplace(int sign_id, char_u *sign_group, buf_T *buf, linenr_T atlnum)
{
if (buf->b_signlist == NULL) // No signs in the buffer
- return OK;
+ return OK;
if (sign_id == 0)
{
- // Delete all the signs in the specified buffer
- redraw_buf_later(buf, UPD_NOT_VALID);
- buf_delete_signs(buf, sign_group);
+ // Delete all the signs in the specified buffer
+ redraw_buf_later(buf, UPD_NOT_VALID);
+ buf_delete_signs(buf, sign_group);
}
else
{
- // Delete only the specified signs
- linenr_T lnum = buf_delsign(buf, atlnum, sign_id, sign_group);
- if (lnum == 0)
- return FAIL;
+ // Delete only the specified signs
+ linenr_T lnum = buf_delsign(buf, atlnum, sign_id, sign_group);
+ if (lnum == 0)
+ return FAIL;
}
// When all the signs in a buffer are removed, force recomputing the
// number column width (if enabled) in all the windows displaying the
// buffer if 'signcolumn' is set to 'number' in that window.
if (buf->b_signlist == NULL)
- may_force_numberwidth_recompute(buf, TRUE);
+ may_force_numberwidth_recompute(buf, TRUE);
return OK;
}
@@ -1271,12 +1271,12 @@
sign_unplace_at_cursor(char_u *groupname)
{
int id =
- buf_findsign_id(curwin->w_buffer, curwin->w_cursor.lnum, groupname);
+ buf_findsign_id(curwin->w_buffer, curwin->w_cursor.lnum, groupname);
if (id > 0)
- sign_unplace(id, groupname, curwin->w_buffer, curwin->w_cursor.lnum);
+ sign_unplace(id, groupname, curwin->w_buffer, curwin->w_cursor.lnum);
else
- emsg(_(e_missing_sign_number));
+ emsg(_(e_missing_sign_number));
}
/*
@@ -1288,31 +1288,31 @@
linenr_T lnum = buf_findsign(buf, sign_id, sign_group);
if (lnum <= 0)
{
- semsg(_(e_invalid_sign_id_nr), sign_id);
- return -1;
+ semsg(_(e_invalid_sign_id_nr), sign_id);
+ return -1;
}
// goto a sign ...
if (buf_jump_open_win(buf) != NULL)
{ // ... in a current window
- curwin->w_cursor.lnum = lnum;
- check_cursor_lnum();
- beginline(BL_WHITE);
+ curwin->w_cursor.lnum = lnum;
+ check_cursor_lnum();
+ beginline(BL_WHITE);
}
else
{ // ... not currently in a window
- if (buf->b_fname == NULL)
- {
- emsg(_(e_cannot_jump_to_buffer_that_does_not_have_name));
- return -1;
- }
- char_u *cmd = alloc(STRLEN(buf->b_fname) + 25);
- if (cmd == NULL)
- return -1;
+ if (buf->b_fname == NULL)
+ {
+ emsg(_(e_cannot_jump_to_buffer_that_does_not_have_name));
+ return -1;
+ }
+ char_u *cmd = alloc(STRLEN(buf->b_fname) + 25);
+ if (cmd == NULL)
+ return -1;
- sprintf((char *)cmd, "e +%ld %s", (long)lnum, buf->b_fname);
- do_cmdline_cmd(cmd);
- vim_free(cmd);
+ sprintf((char *)cmd, "e +%ld %s", (long)lnum, buf->b_fname);
+ do_cmdline_cmd(cmd);
+ vim_free(cmd);
}
# ifdef FEAT_FOLDING
foldOpenCursor();
@@ -1341,57 +1341,57 @@
// set values for a defined sign.
while (TRUE)
{
- arg = skipwhite(p);
- if (*arg == NUL)
- break;
+ arg = skipwhite(p);
+ if (*arg == NUL)
+ break;
- p = skiptowhite_esc(arg);
- if (STRNCMP(arg, "icon=", 5) == 0)
- {
- arg += 5;
- icon = vim_strnsave(arg, p - arg);
- }
- else if (STRNCMP(arg, "text=", 5) == 0)
- {
- arg += 5;
- text = vim_strnsave(arg, p - arg);
- }
- else if (STRNCMP(arg, "linehl=", 7) == 0)
- {
- arg += 7;
- linehl = vim_strnsave(arg, p - arg);
- }
- else if (STRNCMP(arg, "texthl=", 7) == 0)
- {
- arg += 7;
- texthl = vim_strnsave(arg, p - arg);
- }
- else if (STRNCMP(arg, "culhl=", 6) == 0)
- {
- arg += 6;
- culhl = vim_strnsave(arg, p - arg);
- }
- else if (STRNCMP(arg, "numhl=", 6) == 0)
- {
- arg += 6;
- numhl = vim_strnsave(arg, p - arg);
- }
- else if (STRNCMP(arg, "priority=", 9) == 0)
- {
- arg += 9;
- prio = atoi((char *)arg);
- }
- else
- {
- semsg(_(e_invalid_argument_str), arg);
- failed = TRUE;
- break;
- }
+ p = skiptowhite_esc(arg);
+ if (STRNCMP(arg, "icon=", 5) == 0)
+ {
+ arg += 5;
+ icon = vim_strnsave(arg, p - arg);
+ }
+ else if (STRNCMP(arg, "text=", 5) == 0)
+ {
+ arg += 5;
+ text = vim_strnsave(arg, p - arg);
+ }
+ else if (STRNCMP(arg, "linehl=", 7) == 0)
+ {
+ arg += 7;
+ linehl = vim_strnsave(arg, p - arg);
+ }
+ else if (STRNCMP(arg, "texthl=", 7) == 0)
+ {
+ arg += 7;
+ texthl = vim_strnsave(arg, p - arg);
+ }
+ else if (STRNCMP(arg, "culhl=", 6) == 0)
+ {
+ arg += 6;
+ culhl = vim_strnsave(arg, p - arg);
+ }
+ else if (STRNCMP(arg, "numhl=", 6) == 0)
+ {
+ arg += 6;
+ numhl = vim_strnsave(arg, p - arg);
+ }
+ else if (STRNCMP(arg, "priority=", 9) == 0)
+ {
+ arg += 9;
+ prio = atoi((char *)arg);
+ }
+ else
+ {
+ semsg(_(e_invalid_argument_str), arg);
+ failed = TRUE;
+ break;
+ }
}
if (!failed)
- sign_define_by_name(sign_name, icon, linehl, text, texthl, culhl, numhl,
- prio);
+ sign_define_by_name(sign_name, icon, linehl, text, texthl, culhl, numhl,
+ prio);
vim_free(icon);
vim_free(text);
@@ -1406,40 +1406,40 @@
*/
static void
sign_place_cmd(buf_T *buf,
- linenr_T lnum,
- char_u *sign_name,
- int id,
- char_u *group,
- int prio)
+ linenr_T lnum,
+ char_u *sign_name,
+ int id,
+ char_u *group,
+ int prio)
{
if (id <= 0)
{
- // List signs placed in a file/buffer
- // :sign place file={fname}
- // :sign place group={group} file={fname}
- // :sign place group=* file={fname}
- // :sign place buffer={nr}
- // :sign place group={group} buffer={nr}
- // :sign place group=* buffer={nr}
- // :sign place
- // :sign place group={group}
- // :sign place group=*
- if (lnum >= 0 || sign_name != NULL || (group != NULL && *group == '\0'))
- emsg(_(e_invalid_argument));
- else
- sign_list_placed(buf, group);
+ // List signs placed in a file/buffer
+ // :sign place file={fname}
+ // :sign place group={group} file={fname}
+ // :sign place group=* file={fname}
+ // :sign place buffer={nr}
+ // :sign place group={group} buffer={nr}
+ // :sign place group=* buffer={nr}
+ // :sign place
+ // :sign place group={group}
+ // :sign place group=*
+ if (lnum >= 0 || sign_name != NULL || (group != NULL && *group == '\0'))
+ emsg(_(e_invalid_argument));
+ else
+ sign_list_placed(buf, group);
}
else
{
- // Place a new sign
- if (sign_name == NULL || buf == NULL ||
- (group != NULL && *group == '\0'))
- {
- emsg(_(e_invalid_argument));
- return;
- }
+ // Place a new sign
+ if (sign_name == NULL || buf == NULL ||
+ (group != NULL && *group == '\0'))
+ {
+ emsg(_(e_invalid_argument));
+ return;
+ }
- sign_place(&id, group, sign_name, buf, lnum, prio);
+ sign_place(&id, group, sign_name, buf, lnum, prio);
}
}
@@ -1448,70 +1448,70 @@
*/
static void
sign_unplace_cmd(buf_T *buf,
- linenr_T lnum,
- char_u *sign_name,
- int id,
- char_u *group)
+ linenr_T lnum,
+ char_u *sign_name,
+ int id,
+ char_u *group)
{
if (lnum >= 0 || sign_name != NULL || (group != NULL && *group == '\0'))
{
- emsg(_(e_invalid_argument));
- return;
+ emsg(_(e_invalid_argument));
+ return;
}
if (id == -2)
{
- if (buf != NULL)
- {
- // :sign unplace * file={fname}
- // :sign unplace * group={group} file={fname}
- // :sign unplace * group=* file={fname}
- // :sign unplace * buffer={nr}
- // :sign unplace * group={group} buffer={nr}
- // :sign unplace * group=* buffer={nr}
- sign_unplace(0, group, buf, 0);
- }
- else
- {
- // :sign unplace *
- // :sign unplace * group={group}
- // :sign unplace * group=*
- FOR_ALL_BUFFERS(buf)
- {
- if (buf->b_signlist != NULL)
- buf_delete_signs(buf, group);
- }
- }
+ if (buf != NULL)
+ {
+ // :sign unplace * file={fname}
+ // :sign unplace * group={group} file={fname}
+ // :sign unplace * group=* file={fname}
+ // :sign unplace * buffer={nr}
+ // :sign unplace * group={group} buffer={nr}
+ // :sign unplace * group=* buffer={nr}
+ sign_unplace(0, group, buf, 0);
+ }
+ else
+ {
+ // :sign unplace *
+ // :sign unplace * group={group}
+ // :sign unplace * group=*
+ FOR_ALL_BUFFERS(buf)
+ {
+ if (buf->b_signlist != NULL)
+ buf_delete_signs(buf, group);
+ }
+ }
}
else
{
- if (buf != NULL)
- {
- // :sign unplace {id} file={fname}
- // :sign unplace {id} group={group} file={fname}
- // :sign unplace {id} group=* file={fname}
- // :sign unplace {id} buffer={nr}
- // :sign unplace {id} group={group} buffer={nr}
- // :sign unplace {id} group=* buffer={nr}
- sign_unplace(id, group, buf, 0);
- }
- else
- {
- if (id == -1)
- {
- // :sign unplace group={group}
- // :sign unplace group=*
- sign_unplace_at_cursor(group);
- }
- else
- {
- // :sign unplace {id}
- // :sign unplace {id} group={group}
- // :sign unplace {id} group=*
- FOR_ALL_BUFFERS(buf)
- sign_unplace(id, group, buf, 0);
- }
- }
+ if (buf != NULL)
+ {
+ // :sign unplace {id} file={fname}
+ // :sign unplace {id} group={group} file={fname}
+ // :sign unplace {id} group=* file={fname}
+ // :sign unplace {id} buffer={nr}
+ // :sign unplace {id} group={group} buffer={nr}
+ // :sign unplace {id} group=* buffer={nr}
+ sign_unplace(id, group, buf, 0);
+ }
+ else
+ {
+ if (id == -1)
+ {
+ // :sign unplace group={group}
+ // :sign unplace group=*
+ sign_unplace_at_cursor(group);
+ }
+ else
+ {
+ // :sign unplace {id}
+ // :sign unplace {id} group={group}
+ // :sign unplace {id} group=*
+ FOR_ALL_BUFFERS(buf)
+ sign_unplace(id, group, buf, 0);
+ }
+ }
}
}
@@ -1524,24 +1524,24 @@
*/
static void
sign_jump_cmd(buf_T *buf,
- linenr_T lnum,
- char_u *sign_name,
- int id,
- char_u *group)
+ linenr_T lnum,
+ char_u *sign_name,
+ int id,
+ char_u *group)
{
if (sign_name == NULL && group == NULL && id == -1)
{
- emsg(_(e_argument_required));
- return;
+ emsg(_(e_argument_required));
+ return;
}
if (buf == NULL || (group != NULL && *group == '\0') || lnum >= 0 ||
- sign_name != NULL)
+ sign_name != NULL)
{
- // File or buffer is not specified or an empty group is used
- // or a line number or a sign name is specified.
- emsg(_(e_invalid_argument));
- return;
+ // File or buffer is not specified or an empty group is used
+ // or a line number or a sign name is specified.
+ emsg(_(e_invalid_argument));
+ return;
}
(void)sign_jump(id, group, buf);
@@ -1555,13 +1555,13 @@
*/
static int
parse_sign_cmd_args(int cmd,
- char_u *arg,
- char_u **sign_name,
- int *signid,
- char_u **group,
- int *prio,
- buf_T **buf,
- linenr_T *lnum)
+ char_u *arg,
+ char_u **sign_name,
+ int *signid,
+ char_u **group,
+ int *prio,
+ buf_T **buf,
+ linenr_T *lnum)
{
char_u *arg1 = arg;
char_u *filename = NULL;
@@ -1570,102 +1570,102 @@
// first arg could be placed sign id
if (VIM_ISDIGIT(*arg))
{
- *signid = getdigits(&arg);
- if (!VIM_ISWHITE(*arg) && *arg != NUL)
- {
- *signid = -1;
- arg = arg1;
- }
- else
- {
- arg = skipwhite(arg);
- }
+ *signid = getdigits(&arg);
+ if (!VIM_ISWHITE(*arg) && *arg != NUL)
+ {
+ *signid = -1;
+ arg = arg1;
+ }
+ else
+ {
+ arg = skipwhite(arg);
+ }
}
while (*arg != NUL)
{
- if (STRNCMP(arg, "line=", 5) == 0)
- {
- arg += 5;
- *lnum = atoi((char *)arg);
- arg = skiptowhite(arg);
- lnum_arg = TRUE;
- }
- else if (STRNCMP(arg, "*", 1) == 0 && cmd == SIGNCMD_UNPLACE)
- {
- if (*signid != -1)
- {
- emsg(_(e_invalid_argument));
- return FAIL;
- }
- *signid = -2;
- arg = skiptowhite(arg + 1);
- }
- else if (STRNCMP(arg, "name=", 5) == 0)
- {
- arg += 5;
- char_u *name = arg;
- arg = skiptowhite(arg);
- if (*arg != NUL)
- *arg++ = NUL;
+ if (STRNCMP(arg, "line=", 5) == 0)
+ {
+ arg += 5;
+ *lnum = atoi((char *)arg);
+ arg = skiptowhite(arg);
+ lnum_arg = TRUE;
+ }
+ else if (STRNCMP(arg, "*", 1) == 0 && cmd == SIGNCMD_UNPLACE)
+ {
+ if (*signid != -1)
+ {
+ emsg(_(e_invalid_argument));
+ return FAIL;
+ }
+ *signid = -2;
+ arg = skiptowhite(arg + 1);
+ }
+ else if (STRNCMP(arg, "name=", 5) == 0)
+ {
+ arg += 5;
+ char_u *name = arg;
+ arg = skiptowhite(arg);
+ if (*arg != NUL)
+ *arg++ = NUL;
- while (name[0] == '0' && name[1] != NUL)
- ++name;
+ while (name[0] == '0' && name[1] != NUL)
+ ++name;
- *sign_name = name;
- }
- else if (STRNCMP(arg, "group=", 6) == 0)
- {
- arg += 6;
- *group = arg;
- arg = skiptowhite(arg);
- if (*arg != NUL)
- *arg++ = NUL;
- }
- else if (STRNCMP(arg, "priority=", 9) == 0)
- {
- arg += 9;
- *prio = atoi((char *)arg);
- arg = skiptowhite(arg);
- }
- else if (STRNCMP(arg, "file=", 5) == 0)
- {
- arg += 5;
- filename = arg;
- *buf = buflist_findname_exp(arg);
- break;
- }
- else if (STRNCMP(arg, "buffer=", 7) == 0)
- {
- arg += 7;
- filename = arg;
- *buf = buflist_findnr((int)getdigits(&arg));
+ *sign_name = name;
+ }
+ else if (STRNCMP(arg, "group=", 6) == 0)
+ {
+ arg += 6;
+ *group = arg;
+ arg = skiptowhite(arg);
+ if (*arg != NUL)
+ *arg++ = NUL;
+ }
+ else if (STRNCMP(arg, "priority=", 9) == 0)
+ {
+ arg += 9;
+ *prio = atoi((char *)arg);
+ arg = skiptowhite(arg);
+ }
+ else if (STRNCMP(arg, "file=", 5) == 0)
+ {
+ arg += 5;
+ filename = arg;
+ *buf = buflist_findname_exp(arg);
+ break;
+ }
+ else if (STRNCMP(arg, "buffer=", 7) == 0)
+ {
+ arg += 7;
+ filename = arg;
+ *buf = buflist_findnr((int)getdigits(&arg));
- if (*skipwhite(arg) != NUL)
- semsg(_(e_trailing_characters_str), arg);
+ if (*skipwhite(arg) != NUL)
+ semsg(_(e_trailing_characters_str), arg);
- break;
- }
- else
- {
- emsg(_(e_invalid_argument));
- return FAIL;
- }
+ break;
+ }
+ else
+ {
+ emsg(_(e_invalid_argument));
+ return FAIL;
+ }
- arg = skipwhite(arg);
+ arg = skipwhite(arg);
}
if (filename != NULL && *buf == NULL)
{
- semsg(_(e_invalid_buffer_name_str), filename);
- return FAIL;
+ semsg(_(e_invalid_buffer_name_str), filename);
+ return FAIL;
}
// If the filename is not supplied for the sign place or the sign jump
// command, then use the current buffer.
if (filename == NULL &&
- ((cmd == SIGNCMD_PLACE && lnum_arg) || cmd == SIGNCMD_JUMP))
- *buf = curwin->w_buffer;
+ ((cmd == SIGNCMD_PLACE && lnum_arg) || cmd == SIGNCMD_JUMP))
+ *buf = curwin->w_buffer;
return OK;
}
@@ -1683,70 +1683,70 @@
int idx = sign_cmd_idx(arg, p);
if (idx == SIGNCMD_LAST)
{
- semsg(_(e_unknown_sign_command_str), arg);
- return;
+ semsg(_(e_unknown_sign_command_str), arg);
+ return;
}
arg = skipwhite(p);
if (idx > SIGNCMD_LIST)
{
- char_u *sign_name = NULL;
- int id = -1;
- char_u *group = NULL;
- int prio = -1;
- buf_T *buf = NULL;
- linenr_T lnum = -1;
+ char_u *sign_name = NULL;
+ int id = -1;
+ char_u *group = NULL;
+ int prio = -1;
+ buf_T *buf = NULL;
+ linenr_T lnum = -1;
- // Parse command line arguments
- if (parse_sign_cmd_args(idx, arg, &sign_name, &id, &group, &prio, &buf,
- &lnum) == FAIL)
- return;
+ // Parse command line arguments
+ if (parse_sign_cmd_args(idx, arg, &sign_name, &id, &group, &prio, &buf,
+ &lnum) == FAIL)
+ return;
- if (idx == SIGNCMD_PLACE)
- sign_place_cmd(buf, lnum, sign_name, id, group, prio);
- else if (idx == SIGNCMD_UNPLACE)
- sign_unplace_cmd(buf, lnum, sign_name, id, group);
- else if (idx == SIGNCMD_JUMP)
- sign_jump_cmd(buf, lnum, sign_name, id, group);
+ if (idx == SIGNCMD_PLACE)
+ sign_place_cmd(buf, lnum, sign_name, id, group, prio);
+ else if (idx == SIGNCMD_UNPLACE)
+ sign_unplace_cmd(buf, lnum, sign_name, id, group);
+ else if (idx == SIGNCMD_JUMP)
+ sign_jump_cmd(buf, lnum, sign_name, id, group);
- return;
+ return;
}
// Define, undefine or list signs.
if (idx == SIGNCMD_LIST && *arg == NUL)
{
- // ":sign list": list all defined signs
- for (sign_T *sp = first_sign; sp != NULL && !got_int; sp = sp->sn_next)
- sign_list_defined(sp);
+ // ":sign list": list all defined signs
+ for (sign_T *sp = first_sign; sp != NULL && !got_int; sp = sp->sn_next)
+ sign_list_defined(sp);
}
else if (*arg == NUL)
{
- emsg(_(e_missing_sign_name));
+ emsg(_(e_missing_sign_name));
}
else
{
- // Isolate the sign name. If it's a number skip leading zeroes,
- // so that "099" and "99" are the same sign. But keep "0".
- p = skiptowhite(arg);
- if (*p != NUL)
- *p++ = NUL;
+ // Isolate the sign name. If it's a number skip leading zeroes,
+ // so that "099" and "99" are the same sign. But keep "0".
+ p = skiptowhite(arg);
+ if (*p != NUL)
+ *p++ = NUL;
- while (arg[0] == '0' && arg[1] != NUL)
- ++arg;
+ while (arg[0] == '0' && arg[1] != NUL)
+ ++arg;
- char_u *name = vim_strsave(arg);
+ char_u *name = vim_strsave(arg);
- if (idx == SIGNCMD_DEFINE)
- sign_define_cmd(name, p);
- else if (idx == SIGNCMD_LIST)
- // ":sign list {name}"
- sign_list_by_name(name);
- else
- // ":sign undefine {name}"
- sign_undefine_by_name(name, TRUE);
+ if (idx == SIGNCMD_DEFINE)
+ sign_define_cmd(name, p);
+ else if (idx == SIGNCMD_LIST)
+ // ":sign list {name}"
+ sign_list_by_name(name);
+ else
+ // ":sign undefine {name}"
+ sign_undefine_by_name(name, TRUE);
- vim_free(name);
+ vim_free(name);
}
}
@@ -1759,44 +1759,44 @@
dict_add_string(retdict, "name", sp->sn_name);
if (sp->sn_icon != NULL)
- dict_add_string(retdict, "icon", sp->sn_icon);
+ dict_add_string(retdict, "icon", sp->sn_icon);
if (sp->sn_text != NULL)
- dict_add_string(retdict, "text", sp->sn_text);
+ dict_add_string(retdict, "text", sp->sn_text);
if (sp->sn_priority > 0)
- dict_add_number(retdict, "priority", sp->sn_priority);
+ dict_add_number(retdict, "priority", sp->sn_priority);
if (sp->sn_line_hl > 0)
{
- char_u *p = get_highlight_name_ext(NULL, sp->sn_line_hl - 1, FALSE);
- if (p == NULL)
- p = (char_u *)"NONE";
- dict_add_string(retdict, "linehl", p);
+ char_u *p = get_highlight_name_ext(NULL, sp->sn_line_hl - 1, FALSE);
+ if (p == NULL)
+ p = (char_u *)"NONE";
+ dict_add_string(retdict, "linehl", p);
}
if (sp->sn_text_hl > 0)
{
- char_u *p = get_highlight_name_ext(NULL, sp->sn_text_hl - 1, FALSE);
- if (p == NULL)
- p = (char_u *)"NONE";
- dict_add_string(retdict, "texthl", p);
+ char_u *p = get_highlight_name_ext(NULL, sp->sn_text_hl - 1, FALSE);
+ if (p == NULL)
+ p = (char_u *)"NONE";
+ dict_add_string(retdict, "texthl", p);
}
if (sp->sn_cul_hl > 0)
{
- char_u *p = get_highlight_name_ext(NULL, sp->sn_cul_hl - 1, FALSE);
- if (p == NULL)
- p = (char_u *)"NONE";
- dict_add_string(retdict, "culhl", p);
+ char_u *p = get_highlight_name_ext(NULL, sp->sn_cul_hl - 1, FALSE);
+ if (p == NULL)
+ p = (char_u *)"NONE";
+ dict_add_string(retdict, "culhl", p);
}
if (sp->sn_num_hl > 0)
{
- char_u *p = get_highlight_name_ext(NULL, sp->sn_num_hl - 1, FALSE);
- if (p == NULL)
- p = (char_u *)"NONE";
- dict_add_string(retdict, "numhl", p);
+ char_u *p = get_highlight_name_ext(NULL, sp->sn_num_hl - 1, FALSE);
+ if (p == NULL)
+ p = (char_u *)"NONE";
+ dict_add_string(retdict, "numhl", p);
}
}
@@ -1811,24 +1811,24 @@
if (name != NULL)
{
- sp = sign_find(name, NULL);
- if (sp == NULL)
- return;
+ sp = sign_find(name, NULL);
+ if (sp == NULL)
+ return;
}
for (; sp != NULL && !got_int; sp = sp->sn_next)
{
- dict_T *dict = dict_alloc_id(aid_sign_getlist);
- if (dict == NULL)
- return;
+ dict_T *dict = dict_alloc_id(aid_sign_getlist);
+ if (dict == NULL)
+ return;
- if (list_append_dict(retlist, dict) == FAIL)
- return;
+ if (list_append_dict(retlist, dict) == FAIL)
+ return;
- sign_getinfo(sp, dict);
+ sign_getinfo(sp, dict);
- if (name != NULL) // handle only the specified sign
- break;
+ if (name != NULL) // handle only the specified sign
+ break;
}
}
@@ -1841,9 +1841,9 @@
sign_entry_T *sign = NULL;
FOR_ALL_SIGNS_IN_BUF(buf, sign)
{
- dict_T *d = sign_get_info(sign);
- if (d != NULL)
- list_append_dict(l, d);
+ dict_T *d = sign_get_info(sign);
+ if (d != NULL)
+ list_append_dict(l, d);
}
}
@@ -1852,14 +1852,14 @@
*/
static void
sign_get_placed_in_buf(buf_T *buf,
- linenr_T lnum,
- int sign_id,
- char_u *sign_group,
- list_T *retlist)
+ linenr_T lnum,
+ int sign_id,
+ char_u *sign_group,
+ list_T *retlist)
{
dict_T *d = dict_alloc_id(aid_sign_getplaced_dict);
if (d == NULL)
- return;
+ return;
list_append_dict(retlist, d);
@@ -1867,25 +1867,25 @@
list_T *l = list_alloc_id(aid_sign_getplaced_list);
if (l == NULL)
- return;
+ return;
dict_add_list(d, "signs", l);
sign_entry_T *sign = NULL;
FOR_ALL_SIGNS_IN_BUF(buf, sign)
{
- if (!sign_in_group(sign, sign_group))
- continue;
+ if (!sign_in_group(sign, sign_group))
+ continue;
- if ((lnum == 0 && sign_id == 0) ||
- (sign_id == 0 && lnum == sign->se_lnum) ||
- (lnum == 0 && sign_id == sign->se_id) ||
- (lnum == sign->se_lnum && sign_id == sign->se_id))
- {
- dict_T *sdict = sign_get_info(sign);
- if (sdict != NULL)
- list_append_dict(l, sdict);
- }
+ if ((lnum == 0 && sign_id == 0) ||
+ (sign_id == 0 && lnum == sign->se_lnum) ||
+ (lnum == 0 && sign_id == sign->se_id) ||
+ (lnum == sign->se_lnum && sign_id == sign->se_id))
+ {
+ dict_T *sdict = sign_get_info(sign);
+ if (sdict != NULL)
+ list_append_dict(l, sdict);
+ }
}
}
@@ -1896,22 +1896,22 @@
*/
static void
sign_get_placed(buf_T *buf,
- linenr_T lnum,
- int sign_id,
- char_u *sign_group,
- list_T *retlist)
+ linenr_T lnum,
+ int sign_id,
+ char_u *sign_group,
+ list_T *retlist)
{
if (buf != NULL)
{
- sign_get_placed_in_buf(buf, lnum, sign_id, sign_group, retlist);
+ sign_get_placed_in_buf(buf, lnum, sign_id, sign_group, retlist);
}
else
{
- FOR_ALL_BUFFERS(buf)
- {
- if (buf->b_signlist != NULL)
- sign_get_placed_in_buf(buf, 0, sign_id, sign_group, retlist);
- }
+ FOR_ALL_BUFFERS(buf)
+ {
+ if (buf->b_signlist != NULL)
+ sign_get_placed_in_buf(buf, 0, sign_id, sign_group, retlist);
+ }
}
}
@@ -1926,8 +1926,8 @@
sign_T *sp = NULL;
FOR_ALL_SIGNS(sp)
{
- if (sp->sn_icon != NULL)
- sp->sn_image = gui_mch_register_sign(sp->sn_icon);
+ if (sp->sn_icon != NULL)
+ sp->sn_image = gui_mch_register_sign(sp->sn_icon);
}
}
# endif
@@ -1944,70 +1944,70 @@
if (sp->sn_icon != NULL)
{
- msg_puts(" icon=");
- msg_outtrans(sp->sn_icon);
+ msg_puts(" icon=");
+ msg_outtrans(sp->sn_icon);
# ifdef FEAT_SIGN_ICONS
- if (sp->sn_image == NULL)
- msg_puts(_(" (NOT FOUND)"));
+ if (sp->sn_image == NULL)
+ msg_puts(_(" (NOT FOUND)"));
# else
- msg_puts(_(" (not supported)"));
+ msg_puts(_(" (not supported)"));
# endif
}
if (sp->sn_text != NULL)
{
- msg_puts(" text=");
- msg_outtrans(sp->sn_text);
+ msg_puts(" text=");
+ msg_outtrans(sp->sn_text);
}
if (sp->sn_priority > 0)
{
- vim_snprintf(lbuf, MSG_BUF_LEN, " priority=%d", sp->sn_priority);
- msg_puts(lbuf);
+ vim_snprintf(lbuf, MSG_BUF_LEN, " priority=%d", sp->sn_priority);
+ msg_puts(lbuf);
}
if (sp->sn_line_hl > 0)
{
- msg_puts(" linehl=");
+ msg_puts(" linehl=");
- char_u *p = get_highlight_name_ext(NULL, sp->sn_line_hl - 1, FALSE);
- if (p == NULL)
- msg_puts("NONE");
- else
- msg_puts((char *)p);
+ char_u *p = get_highlight_name_ext(NULL, sp->sn_line_hl - 1, FALSE);
+ if (p == NULL)
+ msg_puts("NONE");
+ else
+ msg_puts((char *)p);
}
if (sp->sn_text_hl > 0)
{
- msg_puts(" texthl=");
+ msg_puts(" texthl=");
- char_u *p = get_highlight_name_ext(NULL, sp->sn_text_hl - 1, FALSE);
- if (p == NULL)
- msg_puts("NONE");
- else
- msg_puts((char *)p);
+ char_u *p = get_highlight_name_ext(NULL, sp->sn_text_hl - 1, FALSE);
+ if (p == NULL)
+ msg_puts("NONE");
+ else
+ msg_puts((char *)p);
}
if (sp->sn_cul_hl > 0)
{
- msg_puts(" culhl=");
+ msg_puts(" culhl=");
- char_u *p = get_highlight_name_ext(NULL, sp->sn_cul_hl - 1, FALSE);
- if (p == NULL)
- msg_puts("NONE");
- else
- msg_puts((char *)p);
+ char_u *p = get_highlight_name_ext(NULL, sp->sn_cul_hl - 1, FALSE);
+ if (p == NULL)
+ msg_puts("NONE");
+ else
+ msg_puts((char *)p);
}
if (sp->sn_num_hl > 0)
{
- msg_puts(" numhl=");
+ msg_puts(" numhl=");
- char_u *p = get_highlight_name_ext(NULL, sp->sn_num_hl - 1, FALSE);
- if (p == NULL)
- msg_puts("NONE");
- else
- msg_puts((char *)p);
+ char_u *p = get_highlight_name_ext(NULL, sp->sn_num_hl - 1, FALSE);
+ if (p == NULL)
+ msg_puts("NONE");
+ else
+ msg_puts((char *)p);
}
}
@@ -2022,16 +2022,16 @@
# ifdef FEAT_SIGN_ICONS
if (sp->sn_image != NULL)
{
- out_flush();
- gui_mch_destroy_sign(sp->sn_image);
+ out_flush();
+ gui_mch_destroy_sign(sp->sn_image);
}
# endif
vim_free(sp->sn_text);
if (sp_prev == NULL)
- first_sign = sp->sn_next;
+ first_sign = sp->sn_next;
else
- sp_prev->sn_next = sp->sn_next;
+ sp_prev->sn_next = sp->sn_next;
vim_free(sp);
}
@@ -2043,8 +2043,8 @@
sign_T *sp = NULL;
FOR_ALL_SIGNS(sp)
{
- if (sp->sn_typenr == typenr)
- return sp->sn_image;
+ if (sp->sn_typenr == typenr)
+ return sp->sn_image;
}
return NULL;
}
@@ -2057,7 +2057,7 @@
free_signs(void)
{
while (first_sign != NULL)
- sign_undefine(first_sign, NULL);
+ sign_undefine(first_sign, NULL);
}
static enum
@@ -2083,8 +2083,8 @@
// Complete with name of signs already defined
FOR_ALL_SIGNS(sp)
{
- if (current_idx++ == idx)
- return sp->sn_name;
+ if (current_idx++ == idx)
+ return sp->sn_name;
}
return NULL;
}
@@ -2102,15 +2102,15 @@
// Complete with name of sign groups already defined
FOR_ALL_HASHTAB_ITEMS(&sg_table, hi, todo)
{
- if (!HASHITEM_EMPTY(hi))
- {
- --todo;
- if (current_idx++ == idx)
- {
- signgroup_T *group = HI2SG(hi);
- return group->sg_name;
- }
- }
+ if (!HASHITEM_EMPTY(hi))
+ {
+ --todo;
+ if (current_idx++ == idx)
+ {
+ signgroup_T *group = HI2SG(hi);
+ return group->sg_name;
+ }
+ }
}
return NULL;
}
@@ -2124,36 +2124,36 @@
{
switch (expand_what)
{
- case EXP_SUBCMD:
- return (char_u *)cmds[idx];
- case EXP_DEFINE:
- {
- char *define_arg[] = { "culhl=", "icon=", "linehl=", "numhl=",
- "text=", "texthl=", "priority=", NULL };
- return (char_u *)define_arg[idx];
- }
- case EXP_PLACE:
- {
- char *place_arg[] = { "line=", "name=", "group=", "priority=",
- "file=", "buffer=", NULL };
- return (char_u *)place_arg[idx];
- }
- case EXP_LIST:
- {
- char *list_arg[] = { "group=", "file=", "buffer=", NULL };
- return (char_u *)list_arg[idx];
- }
- case EXP_UNPLACE:
- {
- char *unplace_arg[] = { "group=", "file=", "buffer=", NULL };
- return (char_u *)unplace_arg[idx];
- }
- case EXP_SIGN_NAMES:
- return get_nth_sign_name(idx);
- case EXP_SIGN_GROUPS:
- return get_nth_sign_group_name(idx);
- default:
- return NULL;
+ case EXP_SUBCMD:
+ return (char_u *)cmds[idx];
+ case EXP_DEFINE:
+ {
+ char *define_arg[] = { "culhl=", "icon=", "linehl=", "numhl=",
+ "text=", "texthl=", "priority=", NULL };
+ return (char_u *)define_arg[idx];
+ }
+ case EXP_PLACE:
+ {
+ char *place_arg[] = { "line=", "name=", "group=", "priority=",
+ "file=", "buffer=", NULL };
+ return (char_u *)place_arg[idx];
+ }
+ case EXP_LIST:
+ {
+ char *list_arg[] = { "group=", "file=", "buffer=", NULL };
+ return (char_u *)list_arg[idx];
+ }
+ case EXP_UNPLACE:
+ {
+ char *unplace_arg[] = { "group=", "file=", "buffer=", NULL };
+ return (char_u *)unplace_arg[idx];
+ }
+ case EXP_SIGN_NAMES:
+ return get_nth_sign_name(idx);
+ case EXP_SIGN_GROUPS:
+ return get_nth_sign_group_name(idx);
+ default:
+ return NULL;
}
}
@@ -2178,7 +2178,7 @@
// expand subcmd name
// :sign {subcmd}<CTRL-D>
if (*end_subcmd == NUL)
- return;
+ return;
cmd_idx = sign_cmd_idx(arg, end_subcmd);
@@ -2197,9 +2197,9 @@
p = begin_subcmd_args;
do
{
- p = skipwhite(p);
- last = p;
- p = skiptowhite(p);
+ p = skipwhite(p);
+ last = p;
+ p = skiptowhite(p);
}
while (*p != NUL);
@@ -2210,75 +2210,75 @@
// last p
if (p == NULL)
{
- // Expand last argument name (before equal sign).
- xp->xp_pattern = last;
- switch (cmd_idx)
- {
- case SIGNCMD_DEFINE:
- expand_what = EXP_DEFINE;
- break;
- case SIGNCMD_PLACE:
- // List placed signs
- if (VIM_ISDIGIT(*begin_subcmd_args))
- // :sign place {id} {args}...
- expand_what = EXP_PLACE;
- else
- // :sign place {args}...
- expand_what = EXP_LIST;
- break;
- case SIGNCMD_LIST:
- case SIGNCMD_UNDEFINE:
- // :sign list <CTRL-D>
- // :sign undefine <CTRL-D>
- expand_what = EXP_SIGN_NAMES;
- break;
- case SIGNCMD_JUMP:
- case SIGNCMD_UNPLACE:
- expand_what = EXP_UNPLACE;
- break;
- default:
- xp->xp_context = EXPAND_NOTHING;
- }
+ // Expand last argument name (before equal sign).
+ xp->xp_pattern = last;
+ switch (cmd_idx)
+ {
+ case SIGNCMD_DEFINE:
+ expand_what = EXP_DEFINE;
+ break;
+ case SIGNCMD_PLACE:
+ // List placed signs
+ if (VIM_ISDIGIT(*begin_subcmd_args))
+ // :sign place {id} {args}...
+ expand_what = EXP_PLACE;
+ else
+ // :sign place {args}...
+ expand_what = EXP_LIST;
+ break;
+ case SIGNCMD_LIST:
+ case SIGNCMD_UNDEFINE:
+ // :sign list <CTRL-D>
+ // :sign undefine <CTRL-D>
+ expand_what = EXP_SIGN_NAMES;
+ break;
+ case SIGNCMD_JUMP:
+ case SIGNCMD_UNPLACE:
+ expand_what = EXP_UNPLACE;
+ break;
+ default:
+ xp->xp_context = EXPAND_NOTHING;
+ }
}
else
{
- // Expand last argument value (after equal sign).
- xp->xp_pattern = p + 1;
- switch (cmd_idx)
- {
- case SIGNCMD_DEFINE:
- if (STRNCMP(last, "texthl", 6) == 0 ||
- STRNCMP(last, "linehl", 6) == 0 ||
- STRNCMP(last, "culhl", 5) == 0 ||
- STRNCMP(last, "numhl", 5) == 0)
- xp->xp_context = EXPAND_HIGHLIGHT;
- else if (STRNCMP(last, "icon", 4) == 0)
- xp->xp_context = EXPAND_FILES;
- else
- xp->xp_context = EXPAND_NOTHING;
- break;
- case SIGNCMD_PLACE:
- if (STRNCMP(last, "name", 4) == 0)
- expand_what = EXP_SIGN_NAMES;
- else if (STRNCMP(last, "group", 5) == 0)
- expand_what = EXP_SIGN_GROUPS;
- else if (STRNCMP(last, "file", 4) == 0)
- xp->xp_context = EXPAND_BUFFERS;
- else
- xp->xp_context = EXPAND_NOTHING;
- break;
- case SIGNCMD_UNPLACE:
- case SIGNCMD_JUMP:
- if (STRNCMP(last, "group", 5) == 0)
- expand_what = EXP_SIGN_GROUPS;
- else if (STRNCMP(last, "file", 4) == 0)
- xp->xp_context = EXPAND_BUFFERS;
- else
- xp->xp_context = EXPAND_NOTHING;
- break;
- default:
- xp->xp_context = EXPAND_NOTHING;
- }
+ // Expand last argument value (after equal sign).
+ xp->xp_pattern = p + 1;
+ switch (cmd_idx)
+ {
+ case SIGNCMD_DEFINE:
+ if (STRNCMP(last, "texthl", 6) == 0 ||
+ STRNCMP(last, "linehl", 6) == 0 ||
+ STRNCMP(last, "culhl", 5) == 0 ||
+ STRNCMP(last, "numhl", 5) == 0)
+ xp->xp_context = EXPAND_HIGHLIGHT;
+ else if (STRNCMP(last, "icon", 4) == 0)
+ xp->xp_context = EXPAND_FILES;
+ else
+ xp->xp_context = EXPAND_NOTHING;
+ break;
+ case SIGNCMD_PLACE:
+ if (STRNCMP(last, "name", 4) == 0)
+ expand_what = EXP_SIGN_NAMES;
+ else if (STRNCMP(last, "group", 5) == 0)
+ expand_what = EXP_SIGN_GROUPS;
+ else if (STRNCMP(last, "file", 4) == 0)
+ xp->xp_context = EXPAND_BUFFERS;
+ else
+ xp->xp_context = EXPAND_NOTHING;
+ break;
+ case SIGNCMD_UNPLACE:
+ case SIGNCMD_JUMP:
+ if (STRNCMP(last, "group", 5) == 0)
+ expand_what = EXP_SIGN_GROUPS;
+ else if (STRNCMP(last, "file", 4) == 0)
+ xp->xp_context = EXPAND_BUFFERS;
+ else
+ xp->xp_context = EXPAND_NOTHING;
+ break;
+ default:
+ xp->xp_context = EXPAND_NOTHING;
+ }
}
}
@@ -2300,30 +2300,30 @@
int retval = -1;
if (name_arg == NULL && dict == NULL)
- return retval;
+ return retval;
if (name_arg == NULL)
- name = dict_get_string(dict, "name", TRUE);
+ name = dict_get_string(dict, "name", TRUE);
else
- name = vim_strsave(name_arg);
+ name = vim_strsave(name_arg);
if (name == NULL || name[0] == NUL)
- goto cleanup;
+ goto cleanup;
if (dict != NULL)
{
- icon = dict_get_string(dict, "icon", TRUE);
- linehl = dict_get_string(dict, "linehl", TRUE);
- text = dict_get_string(dict, "text", TRUE);
- texthl = dict_get_string(dict, "texthl", TRUE);
- culhl = dict_get_string(dict, "culhl", TRUE);
- numhl = dict_get_string(dict, "numhl", TRUE);
- prio = dict_get_number_def(dict, "priority", -1);
+ icon = dict_get_string(dict, "icon", TRUE);
+ linehl = dict_get_string(dict, "linehl", TRUE);
+ text = dict_get_string(dict, "text", TRUE);
+ texthl = dict_get_string(dict, "texthl", TRUE);
+ culhl = dict_get_string(dict, "culhl", TRUE);
+ numhl = dict_get_string(dict, "numhl", TRUE);
+ prio = dict_get_number_def(dict, "priority", -1);
}
if (sign_define_by_name(name, icon, linehl, text, texthl, culhl, numhl,
- prio) == OK)
- retval = 0;
+ prio) == OK)
+ retval = 0;
cleanup:
vim_free(name);
@@ -2347,14 +2347,14 @@
listitem_T *li = NULL;
FOR_ALL_LIST_ITEMS(l, li)
{
- int retval = -1;
+ int retval = -1;
- if (li->li_tv.v_type == VAR_DICT)
- retval = sign_define_from_dict(NULL, li->li_tv.vval.v_dict);
- else
- emsg(_(e_dictionary_required));
+ if (li->li_tv.v_type == VAR_DICT)
+ retval = sign_define_from_dict(NULL, li->li_tv.vval.v_dict);
+ else
+ emsg(_(e_dictionary_required));
- list_append_number(retlist, retval);
+ list_append_number(retlist, retval);
}
}
@@ -2365,17 +2365,17 @@
f_sign_define(typval_T *argvars, typval_T *rettv)
{
if (in_vim9script() && (check_for_string_or_list_arg(argvars, 0) == FAIL ||
- check_for_opt_dict_arg(argvars, 1) == FAIL))
- return;
+ check_for_opt_dict_arg(argvars, 1) == FAIL))
+ return;
if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_UNKNOWN)
{
- // Define multiple signs
- if (rettv_list_alloc(rettv) == FAIL)
- return;
+ // Define multiple signs
+ if (rettv_list_alloc(rettv) == FAIL)
+ return;
- sign_define_multiple(argvars[0].vval.v_list, rettv->vval.v_list);
- return;
+ sign_define_multiple(argvars[0].vval.v_list, rettv->vval.v_list);
+ return;
}
// Define a single sign
@@ -2383,13 +2383,13 @@
char_u *name = tv_get_string_chk(&argvars[0]);
if (name == NULL)
- return;
+ return;
if (check_for_opt_dict_arg(argvars, 1) == FAIL)
- return;
+ return;
rettv->vval.v_number = sign_define_from_dict(
- name, argvars[1].v_type == VAR_DICT ? argvars[1].vval.v_dict : NULL);
+ name, argvars[1].v_type == VAR_DICT ? argvars[1].vval.v_dict : NULL);
}
/*
@@ -2399,14 +2399,14 @@
f_sign_getdefined(typval_T *argvars, typval_T *rettv)
{
if (rettv_list_alloc_id(rettv, aid_sign_getdefined) == FAIL)
- return;
+ return;
if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL)
- return;
+ return;
char_u *name = NULL;
if (argvars[0].v_type != VAR_UNKNOWN)
- name = tv_get_string(&argvars[0]);
+ name = tv_get_string(&argvars[0]);
sign_getlist(name, rettv->vval.v_list);
}
@@ -2423,58 +2423,58 @@
char_u *group = NULL;
if (rettv_list_alloc_id(rettv, aid_sign_getplaced) == FAIL)
- return;
+ return;
if (in_vim9script() && (check_for_opt_buffer_arg(argvars, 0) == FAIL ||
- (argvars[0].v_type != VAR_UNKNOWN &&
- check_for_opt_dict_arg(argvars, 1) == FAIL)))
- return;
+ (argvars[0].v_type != VAR_UNKNOWN &&
+ check_for_opt_dict_arg(argvars, 1) == FAIL)))
+ return;
if (argvars[0].v_type != VAR_UNKNOWN)
{
- // get signs placed in the specified buffer
- buf = get_buf_arg(&argvars[0]);
- if (buf == NULL)
- return;
+ // get signs placed in the specified buffer
+ buf = get_buf_arg(&argvars[0]);
+ if (buf == NULL)
+ return;
- if (argvars[1].v_type != VAR_UNKNOWN)
- {
- if (check_for_nonnull_dict_arg(argvars, 1) == FAIL)
- return;
+ if (argvars[1].v_type != VAR_UNKNOWN)
+ {
+ if (check_for_nonnull_dict_arg(argvars, 1) == FAIL)
+ return;
- dictitem_T *di = NULL;
- dict_T *dict = argvars[1].vval.v_dict;
+ dictitem_T *di = NULL;
+ dict_T *dict = argvars[1].vval.v_dict;
- if ((di = dict_find(dict, (char_u *)"lnum", -1)) != NULL)
- {
- // get signs placed at this line
- int notanum = FALSE;
- tv_get_number_chk(&di->di_tv, ¬anum);
- if (notanum)
- return;
+ if ((di = dict_find(dict, (char_u *)"lnum", -1)) != NULL)
+ {
+ // get signs placed at this line
+ int notanum = FALSE;
+ tv_get_number_chk(&di->di_tv, ¬anum);
+ if (notanum)
+ return;
- lnum = tv_get_lnum(&di->di_tv);
- }
+ lnum = tv_get_lnum(&di->di_tv);
+ }
- if ((di = dict_find(dict, (char_u *)"id", -1)) != NULL)
- {
- // get sign placed with this identifier
- int notanum = FALSE;
- sign_id = (int)tv_get_number_chk(&di->di_tv, ¬anum);
- if (notanum)
- return;
- }
+ if ((di = dict_find(dict, (char_u *)"id", -1)) != NULL)
+ {
+ // get sign placed with this identifier
+ int notanum = FALSE;
+ sign_id = (int)tv_get_number_chk(&di->di_tv, ¬anum);
+ if (notanum)
+ return;
+ }
- if ((di = dict_find(dict, (char_u *)"group", -1)) != NULL)
- {
- group = tv_get_string_chk(&di->di_tv);
- if (group == NULL)
- return;
+ if ((di = dict_find(dict, (char_u *)"group", -1)) != NULL)
+ {
+ group = tv_get_string_chk(&di->di_tv);
+ if (group == NULL)
+ return;
- if (*group == '\0') // empty string means global group
- group = NULL;
- }
- }
+ if (*group == '\0') // empty string means global group
+ group = NULL;
+ }
+ }
}
sign_get_placed(buf, lnum, sign_id, group, rettv->vval.v_list);
@@ -2490,42 +2490,42 @@
rettv->vval.v_number = -1;
if (in_vim9script() && (check_for_number_arg(argvars, 0) == FAIL ||
- check_for_string_arg(argvars, 1) == FAIL ||
- check_for_buffer_arg(argvars, 2) == FAIL))
- return;
+ check_for_string_arg(argvars, 1) == FAIL ||
+ check_for_buffer_arg(argvars, 2) == FAIL))
+ return;
int notanum = FALSE;
// Sign identifier
int sign_id = (int)tv_get_number_chk(&argvars[0], ¬anum);
if (notanum)
- return;
+ return;
if (sign_id <= 0)
{
- emsg(_(e_invalid_argument));
- return;
+ emsg(_(e_invalid_argument));
+ return;
}
// Sign group
sign_group = tv_get_string_chk(&argvars[1]);
if (sign_group == NULL)
- return;
+ return;
if (sign_group[0] == '\0')
{
- sign_group = NULL; // global sign group
+ sign_group = NULL; // global sign group
}
else
{
- sign_group = vim_strsave(sign_group);
- if (sign_group == NULL)
- return;
+ sign_group = vim_strsave(sign_group);
+ if (sign_group == NULL)
+ return;
}
// Buffer to place the sign
buf_T *buf = get_buf_arg(&argvars[2]);
if (buf == NULL)
- goto cleanup;
+ goto cleanup;
rettv->vval.v_number = sign_jump(sign_id, sign_group, buf);
@@ -2539,10 +2539,10 @@
*/
static int
sign_place_from_dict(typval_T *id_tv,
- typval_T *group_tv,
- typval_T *name_tv,
- typval_T *buf_tv,
- dict_T *dict)
+ typval_T *group_tv,
+ typval_T *name_tv,
+ typval_T *buf_tv,
+ dict_T *dict)
{
int sign_id = 0;
char_u *group = NULL;
@@ -2556,114 +2556,114 @@
// sign identifier
if (id_tv == NULL)
{
- di = dict_find(dict, (char_u *)"id", -1);
- if (di != NULL)
- id_tv = &di->di_tv;
+ di = dict_find(dict, (char_u *)"id", -1);
+ if (di != NULL)
+ id_tv = &di->di_tv;
}
if (id_tv == NULL)
{
- sign_id = 0;
+ sign_id = 0;
}
else
{
- int notanum = FALSE;
- sign_id = tv_get_number_chk(id_tv, ¬anum);
+ int notanum = FALSE;
+ sign_id = tv_get_number_chk(id_tv, ¬anum);
- if (notanum)
- return -1;
+ if (notanum)
+ return -1;
- if (sign_id < 0)
- {
- emsg(_(e_invalid_argument));
- return -1;
- }
+ if (sign_id < 0)
+ {
+ emsg(_(e_invalid_argument));
+ return -1;
+ }
}
// sign group
if (group_tv == NULL)
{
- di = dict_find(dict, (char_u *)"group", -1);
- if (di != NULL)
- group_tv = &di->di_tv;
+ di = dict_find(dict, (char_u *)"group", -1);
+ if (di != NULL)
+ group_tv = &di->di_tv;
}
if (group_tv == NULL)
{
- group = NULL; // global group
+ group = NULL; // global group
}
else
{
- group = tv_get_string_chk(group_tv);
- if (group == NULL)
- goto cleanup;
+ group = tv_get_string_chk(group_tv);
+ if (group == NULL)
+ goto cleanup;
- if (group[0] == '\0') // global sign group
- {
- group = NULL;
- }
- else
- {
- group = vim_strsave(group);
- if (group == NULL)
- return -1;
- }
+ if (group[0] == '\0') // global sign group
+ {
+ group = NULL;
+ }
+ else
+ {
+ group = vim_strsave(group);
+ if (group == NULL)
+ return -1;
+ }
}
// sign name
if (name_tv == NULL)
{
- di = dict_find(dict, (char_u *)"name", -1);
- if (di != NULL)
- name_tv = &di->di_tv;
+ di = dict_find(dict, (char_u *)"name", -1);
+ if (di != NULL)
+ name_tv = &di->di_tv;
}
if (name_tv == NULL)
- goto cleanup;
+ goto cleanup;
sign_name = tv_get_string_chk(name_tv);
if (sign_name == NULL)
- goto cleanup;
+ goto cleanup;
// buffer to place the sign
if (buf_tv == NULL)
{
- di = dict_find(dict, (char_u *)"buffer", -1);
- if (di != NULL)
- buf_tv = &di->di_tv;
+ di = dict_find(dict, (char_u *)"buffer", -1);
+ if (di != NULL)
+ buf_tv = &di->di_tv;
}
if (buf_tv == NULL)
- goto cleanup;
+ goto cleanup;
buf = get_buf_arg(buf_tv);
if (buf == NULL)
- goto cleanup;
+ goto cleanup;
// line number of the sign
di = dict_find(dict, (char_u *)"lnum", -1);
if (di != NULL)
{
- lnum = tv_get_lnum(&di->di_tv);
- if (lnum <= 0)
- {
- emsg(_(e_invalid_argument));
- goto cleanup;
- }
+ lnum = tv_get_lnum(&di->di_tv);
+ if (lnum <= 0)
+ {
+ emsg(_(e_invalid_argument));
+ goto cleanup;
+ }
}
// sign priority
di = dict_find(dict, (char_u *)"priority", -1);
if (di != NULL)
{
- int notanum = FALSE;
- prio = (int)tv_get_number_chk(&di->di_tv, ¬anum);
- if (notanum)
- goto cleanup;
+ int notanum = FALSE;
+ prio = (int)tv_get_number_chk(&di->di_tv, ¬anum);
+ if (notanum)
+ goto cleanup;
}
if (sign_place(&sign_id, group, sign_name, buf, lnum, prio) == OK)
- ret_sign_id = sign_id;
+ ret_sign_id = sign_id;
cleanup:
vim_free(group);
@@ -2681,21 +2681,21 @@
rettv->vval.v_number = -1;
if (in_vim9script() && (check_for_number_arg(argvars, 0) == FAIL ||
- check_for_string_arg(argvars, 1) == FAIL ||
- check_for_string_arg(argvars, 2) == FAIL ||
- check_for_buffer_arg(argvars, 3) == FAIL ||
- check_for_opt_dict_arg(argvars, 4) == FAIL))
- return;
+ check_for_string_arg(argvars, 1) == FAIL ||
+ check_for_string_arg(argvars, 2) == FAIL ||
+ check_for_buffer_arg(argvars, 3) == FAIL ||
+ check_for_opt_dict_arg(argvars, 4) == FAIL))
+ return;
if (argvars[4].v_type != VAR_UNKNOWN)
{
- if (check_for_nonnull_dict_arg(argvars, 4) == FAIL)
- return;
- dict = argvars[4].vval.v_dict;
+ if (check_for_nonnull_dict_arg(argvars, 4) == FAIL)
+ return;
+ dict = argvars[4].vval.v_dict;
}
rettv->vval.v_number = sign_place_from_dict(&argvars[0], &argvars[1],
- &argvars[2], &argvars[3], dict);
+ &argvars[2], &argvars[3], dict);
}
/*
@@ -2705,27 +2705,27 @@
f_sign_placelist(typval_T *argvars, typval_T *rettv)
{
if (rettv_list_alloc(rettv) == FAIL)
- return;
+ return;
if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
- return;
+ return;
if (check_for_list_arg(argvars, 0) == FAIL)
- return;
+ return;
// Process the List of sign attributes
listitem_T *li = NULL;
FOR_ALL_LIST_ITEMS(argvars[0].vval.v_list, li)
{
- int sign_id = -1;
+ int sign_id = -1;
- if (li->li_tv.v_type == VAR_DICT)
- sign_id = sign_place_from_dict(NULL, NULL, NULL, NULL,
- li->li_tv.vval.v_dict);
- else
- emsg(_(e_dictionary_required));
+ if (li->li_tv.v_type == VAR_DICT)
+ sign_id = sign_place_from_dict(NULL, NULL, NULL, NULL,
+ li->li_tv.vval.v_dict);
+ else
+ emsg(_(e_dictionary_required));
- list_append_number(rettv->vval.v_list, sign_id);
+ list_append_number(rettv->vval.v_list, sign_id);
}
}
@@ -2738,12 +2738,12 @@
listitem_T *li = NULL;
FOR_ALL_LIST_ITEMS(l, li)
{
- int retval = -1;
- char_u *name = tv_get_string_chk(&li->li_tv);
- if (name != NULL && (sign_undefine_by_name(name, TRUE) == OK))
- retval = 0;
+ int retval = -1;
+ char_u *name = tv_get_string_chk(&li->li_tv);
+ if (name != NULL && (sign_undefine_by_name(name, TRUE) == OK))
+ retval = 0;
- list_append_number(retlist, retval);
+ list_append_number(retlist, retval);
}
}
@@ -2755,35 +2755,35 @@
{
if (in_vim9script() && check_for_opt_string_or_list_arg(argvars, 0) == FAIL)
- return;
+ return;
if (argvars[0].v_type == VAR_LIST && argvars[1].v_type == VAR_UNKNOWN)
{
- // Undefine multiple signs
- if (rettv_list_alloc(rettv) == FAIL)
- return;
+ // Undefine multiple signs
+ if (rettv_list_alloc(rettv) == FAIL)
+ return;
- sign_undefine_multiple(argvars[0].vval.v_list, rettv->vval.v_list);
- return;
+ sign_undefine_multiple(argvars[0].vval.v_list, rettv->vval.v_list);
+ return;
}
rettv->vval.v_number = -1;
if (argvars[0].v_type == VAR_UNKNOWN)
{
- // Free all the signs
- free_signs();
- rettv->vval.v_number = 0;
+ // Free all the signs
+ free_signs();
+ rettv->vval.v_number = 0;
}
else
{
- // Free only the specified sign
- char_u *name = tv_get_string_chk(&argvars[0]);
- if (name == NULL)
- return;
+ // Free only the specified sign
+ char_u *name = tv_get_string_chk(&argvars[0]);
+ if (name == NULL)
+ return;
- if (sign_undefine_by_name(name, TRUE) == OK)
- rettv->vval.v_number = 0;
+ if (sign_undefine_by_name(name, TRUE) == OK)
+ rettv->vval.v_number = 0;
}
}
@@ -2801,53 +2801,53 @@
// sign group
group = (group_tv != NULL) ? tv_get_string(group_tv)
- : dict_get_string(dict, "group", FALSE);
+ : dict_get_string(dict, "group", FALSE);
if (group != NULL)
{
- if (group[0] == '\0') // global sign group
- {
- group = NULL;
- }
- else
- {
- group = vim_strsave(group);
- if (group == NULL)
- return retval;
- }
+ if (group[0] == '\0') // global sign group
+ {
+ group = NULL;
+ }
+ else
+ {
+ group = vim_strsave(group);
+ if (group == NULL)
+ return retval;
+ }
}
if (dict != NULL)
{
- dictitem_T *di = dict_find(dict, (char_u *)"buffer", -1);
- if (di != NULL)
- {
- buf = get_buf_arg(&di->di_tv);
- if (buf == NULL)
- goto cleanup;
- }
+ dictitem_T *di = dict_find(dict, (char_u *)"buffer", -1);
+ if (di != NULL)
+ {
+ buf = get_buf_arg(&di->di_tv);
+ if (buf == NULL)
+ goto cleanup;
+ }
- if (dict_has_key(dict, "id"))
- {
- sign_id = dict_get_number(dict, "id");
- if (sign_id <= 0)
- {
- emsg(_(e_invalid_argument));
- goto cleanup;
- }
- }
+ if (dict_has_key(dict, "id"))
+ {
+ sign_id = dict_get_number(dict, "id");
+ if (sign_id <= 0)
+ {
+ emsg(_(e_invalid_argument));
+ goto cleanup;
+ }
+ }
}
if (buf == NULL)
{
- // Delete the sign in all the buffers
- retval = 0;
- FOR_ALL_BUFFERS(buf)
- if (sign_unplace(sign_id, group, buf, 0) != OK)
- retval = -1;
+ // Delete the sign in all the buffers
+ retval = 0;
+ FOR_ALL_BUFFERS(buf)
+ if (sign_unplace(sign_id, group, buf, 0) != OK)
+ retval = -1;
}
else if (sign_unplace(sign_id, group, buf, 0) == OK)
- retval = 0;
+ retval = 0;
cleanup:
vim_free(group);
@@ -2862,7 +2862,7 @@
# ifdef FEAT_PROP_POPUP
while (sign != NULL && !sign_group_for_window(sign, wp))
- sign = sign->se_next;
+ sign = sign->se_next;
# endif
return sign;
}
@@ -2877,17 +2877,17 @@
// column (if present). Otherwise signs are to be displayed in the sign
// column.
if (*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u')
- return get_first_valid_sign(wp) != NULL && !wp->w_p_nu && !wp->w_p_rnu;
+ return get_first_valid_sign(wp) != NULL && !wp->w_p_nu && !wp->w_p_rnu;
if (*wp->w_p_scl == 'n')
- return FALSE;
+ return FALSE;
if (*wp->w_p_scl == 'y')
- return TRUE;
+ return TRUE;
return (get_first_valid_sign(wp) != NULL
# ifdef FEAT_NETBEANS_INTG
- || wp->w_buffer->b_has_sign_column
+ || wp->w_buffer->b_has_sign_column
# endif
);
}
@@ -2902,11 +2902,11 @@
rettv->vval.v_number = -1;
if ((check_for_string_arg(argvars, 0) == FAIL ||
- check_for_opt_dict_arg(argvars, 1) == FAIL))
- return;
+ check_for_opt_dict_arg(argvars, 1) == FAIL))
+ return;
if (argvars[1].v_type != VAR_UNKNOWN)
- dict = argvars[1].vval.v_dict;
+ dict = argvars[1].vval.v_dict;
rettv->vval.v_number = sign_unplace_from_dict(&argvars[0], dict);
}
@@ -2918,25 +2918,25 @@
f_sign_unplacelist(typval_T *argvars, typval_T *rettv)
{
if (rettv_list_alloc(rettv) == FAIL)
- return;
+ return;
if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL)
- return;
+ return;
if (check_for_list_arg(argvars, 0) == FAIL)
- return;
+ return;
listitem_T *li = NULL;
FOR_ALL_LIST_ITEMS(argvars[0].vval.v_list, li)
{
- int retval = -1;
+ int retval = -1;
- if (li->li_tv.v_type == VAR_DICT)
- retval = sign_unplace_from_dict(NULL, li->li_tv.vval.v_dict);
- else
- emsg(_(e_dictionary_required));
+ if (li->li_tv.v_type == VAR_DICT)
+ retval = sign_unplace_from_dict(NULL, li->li_tv.vval.v_dict);
+ else
+ emsg(_(e_dictionary_required));
- list_append_number(rettv->vval.v_list, retval);
+ list_append_number(rettv->vval.v_list, retval);
}
}
diff --git a/src/sound.c b/src/sound.c
index 7b4d984..99c9868 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -48,23 +48,23 @@
soundcb_T *soundcb;
if (arg->v_type == VAR_UNKNOWN)
- return NULL;
+ return NULL;
callback = get_callback(arg);
if (callback.cb_name == NULL)
- return NULL;
+ return NULL;
soundcb = ALLOC_ONE(soundcb_T);
if (soundcb == NULL)
{
- free_callback(&callback);
- return NULL;
+ free_callback(&callback);
+ return NULL;
}
soundcb->snd_next = first_callback;
first_callback = soundcb;
set_callback(&soundcb->snd_callback, &callback);
if (callback.cb_free_name)
- vim_free(callback.cb_name);
+ vim_free(callback.cb_name);
return soundcb;
}
@@ -97,16 +97,16 @@
soundcb_T *prev = NULL;
for (p = first_callback; p != NULL; prev = p, p = p->snd_next)
- if (p == soundcb)
- {
- if (prev == NULL)
- first_callback = p->snd_next;
- else
- prev->snd_next = p->snd_next;
- free_callback(&p->snd_callback);
- vim_free(p);
- break;
- }
+ if (p == soundcb)
+ {
+ if (prev == NULL)
+ first_callback = p->snd_next;
+ else
+ prev->snd_next = p->snd_next;
+ free_callback(&p->snd_callback);
+ vim_free(p);
+ break;
+ }
}
# if defined(HAVE_CANBERRA) || defined(PROTO)
@@ -139,24 +139,24 @@
*/
static void
sound_callback(ca_context *c UNUSED,
- uint32_t id,
- int error_code,
- void *userdata)
+ uint32_t id,
+ int error_code,
+ void *userdata)
{
soundcb_T *soundcb = (soundcb_T *)userdata;
soundcb_queue_T *scb;
scb = ALLOC_ONE(soundcb_queue_T);
if (scb == NULL)
- return;
+ return;
scb->scb_next = callback_queue;
callback_queue = scb;
scb->scb_id = id;
scb->scb_result = error_code == CA_SUCCESS ? 0
- : error_code == CA_ERROR_CANCELED ||
- error_code == CA_ERROR_DESTROYED
- ? 1
- : 2;
+ : error_code == CA_ERROR_CANCELED ||
+ error_code == CA_ERROR_DESTROYED
+ ? 1
+ : 2;
scb->scb_callback = soundcb;
}
@@ -179,13 +179,13 @@
while (callback_queue != NULL)
{
- scb = callback_queue;
- callback_queue = scb->scb_next;
+ scb = callback_queue;
+ callback_queue = scb->scb_next;
- call_sound_callback(scb->scb_callback, scb->scb_id, scb->scb_result);
+ call_sound_callback(scb->scb_callback, scb->scb_id, scb->scb_result);
- delete_sound_callback(scb->scb_callback);
- vim_free(scb);
+ delete_sound_callback(scb->scb_callback);
+ vim_free(scb);
}
redraw_after_callback(TRUE, FALSE);
}
@@ -194,12 +194,12 @@
sound_play_common(typval_T *argvars, typval_T *rettv, int playfile)
{
if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
- return;
+ return;
if (context == NULL)
- ca_context_create(&context);
+ ca_context_create(&context);
if (context == NULL)
- return;
+ return;
soundcb_T *soundcb = get_sound_callback(&argvars[1]);
int res = CA_ERROR_INVALID;
@@ -207,34 +207,34 @@
++sound_id;
if (soundcb == NULL)
{
- res = ca_context_play(context, sound_id,
- playfile ? CA_PROP_MEDIA_FILENAME
- : CA_PROP_EVENT_ID,
- tv_get_string(&argvars[0]),
- CA_PROP_CANBERRA_CACHE_CONTROL, "volatile", NULL);
+ res = ca_context_play(context, sound_id,
+ playfile ? CA_PROP_MEDIA_FILENAME
+ : CA_PROP_EVENT_ID,
+ tv_get_string(&argvars[0]),
+ CA_PROP_CANBERRA_CACHE_CONTROL, "volatile", NULL);
}
else
{
- static ca_proplist *proplist = NULL;
+ static ca_proplist *proplist = NULL;
- ca_proplist_create(&proplist);
- if (proplist != NULL)
- {
- if (playfile)
- ca_proplist_sets(proplist, CA_PROP_MEDIA_FILENAME,
- (char *)tv_get_string(&argvars[0]));
- else
- ca_proplist_sets(proplist, CA_PROP_EVENT_ID,
- (char *)tv_get_string(&argvars[0]));
- ca_proplist_sets(proplist, CA_PROP_CANBERRA_CACHE_CONTROL,
- "volatile");
- res = ca_context_play_full(context, sound_id, proplist,
- sound_callback, soundcb);
- if (res != CA_SUCCESS)
- delete_sound_callback(soundcb);
+ ca_proplist_create(&proplist);
+ if (proplist != NULL)
+ {
+ if (playfile)
+ ca_proplist_sets(proplist, CA_PROP_MEDIA_FILENAME,
+ (char *)tv_get_string(&argvars[0]));
+ else
+ ca_proplist_sets(proplist, CA_PROP_EVENT_ID,
+ (char *)tv_get_string(&argvars[0]));
+ ca_proplist_sets(proplist, CA_PROP_CANBERRA_CACHE_CONTROL,
+ "volatile");
+ res = ca_context_play_full(context, sound_id, proplist,
+ sound_callback, soundcb);
+ if (res != CA_SUCCESS)
+ delete_sound_callback(soundcb);
- ca_proplist_destroy(proplist);
- }
+ ca_proplist_destroy(proplist);
+ }
}
rettv->vval.v_number = res == CA_SUCCESS ? sound_id : 0;
}
@@ -261,10 +261,10 @@
f_sound_stop(typval_T *argvars, typval_T *rettv UNUSED)
{
if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
- return;
+ return;
if (context != NULL)
- ca_context_cancel(context, tv_get_number(&argvars[0]));
+ ca_context_cancel(context, tv_get_number(&argvars[0]));
}
/*
@@ -274,7 +274,7 @@
f_sound_clear(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
if (context == NULL)
- return;
+ return;
ca_context_destroy(context);
context = NULL;
}
@@ -286,17 +286,17 @@
soundcb_queue_T *scb;
if (context != NULL)
- ca_context_destroy(context);
+ ca_context_destroy(context);
while (first_callback != NULL)
- delete_sound_callback(first_callback);
+ delete_sound_callback(first_callback);
while (callback_queue != NULL)
{
- scb = callback_queue;
- callback_queue = scb->scb_next;
- delete_sound_callback(scb->scb_callback);
- vim_free(scb);
+ scb = callback_queue;
+ callback_queue = scb->scb_next;
+ delete_sound_callback(scb->scb_callback);
+ vim_free(scb);
}
}
# endif
@@ -316,25 +316,25 @@
switch (message)
{
- case MM_MCINOTIFY:
- for (p = first_callback; p != NULL; p = p->snd_next)
- if (p->snd_device_id == (MCIDEVICEID)lParam)
- {
- char buf[32];
+ case MM_MCINOTIFY:
+ for (p = first_callback; p != NULL; p = p->snd_next)
+ if (p->snd_device_id == (MCIDEVICEID)lParam)
+ {
+ char buf[32];
- vim_snprintf(buf, sizeof(buf), "close sound%06ld",
- p->snd_id);
- mciSendStringA(buf, NULL, 0, 0);
+ vim_snprintf(buf, sizeof(buf), "close sound%06ld",
+ p->snd_id);
+ mciSendStringA(buf, NULL, 0, 0);
- long result = wParam == MCI_NOTIFY_SUCCESSFUL ? 0
- : wParam == MCI_NOTIFY_ABORTED ? 1
- : 2;
- call_sound_callback(p, p->snd_id, result);
+ long result = wParam == MCI_NOTIFY_SUCCESSFUL ? 0
+ : wParam == MCI_NOTIFY_ABORTED ? 1
+ : 2;
+ call_sound_callback(p, p->snd_id, result);
- delete_sound_callback(p);
- redraw_after_callback(TRUE, FALSE);
- }
- break;
+ delete_sound_callback(p);
+ redraw_after_callback(TRUE, FALSE);
+ }
+ break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
@@ -345,12 +345,12 @@
{
if (g_hWndSound == NULL)
{
- LPCSTR clazz = "VimSound";
- WNDCLASS wndclass = { 0, sound_wndproc, 0, 0, g_hinst, NULL, 0,
- 0, NULL, clazz };
- RegisterClass(&wndclass);
- g_hWndSound = CreateWindow(clazz, NULL, 0, 0, 0, 0, 0, HWND_MESSAGE,
- NULL, g_hinst, NULL);
+ LPCSTR clazz = "VimSound";
+ WNDCLASS wndclass = { 0, sound_wndproc, 0, 0, g_hinst, NULL, 0,
+ 0, NULL, clazz };
+ RegisterClass(&wndclass);
+ g_hWndSound = CreateWindow(clazz, NULL, 0, 0, 0, 0, 0, HWND_MESSAGE,
+ NULL, g_hinst, NULL);
}
return g_hWndSound;
@@ -362,14 +362,14 @@
WCHAR *wp;
if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
- return;
+ return;
wp = enc_to_utf16(tv_get_string(&argvars[0]), NULL);
if (wp == NULL)
- return;
+ return;
if (PlaySoundW(wp, NULL, SND_ASYNC | SND_ALIAS))
- rettv->vval.v_number = ++sound_id;
+ rettv->vval.v_number = ++sound_id;
free(wp);
}
@@ -385,7 +385,7 @@
MCIERROR err;
if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
- return;
+ return;
filename = tv_get_string(&argvars[0]);
@@ -393,25 +393,25 @@
p = alloc(len);
if (p == NULL)
{
- return;
+ return;
}
vim_snprintf((char *)p, len, "open \"%s\" alias sound%06ld", filename,
- newid);
+ newid);
wp = enc_to_utf16((char_u *)p, NULL);
free(p);
if (wp == NULL)
- return;
+ return;
err = mciSendStringW(wp, NULL, 0, sound_window());
free(wp);
if (err != 0)
- return;
+ return;
vim_snprintf(buf, sizeof(buf), "play sound%06ld notify", newid);
err = mciSendStringA(buf, NULL, 0, sound_window());
if (err != 0)
- goto failure;
+ goto failure;
sound_id = newid;
rettv->vval.v_number = sound_id;
@@ -419,9 +419,9 @@
soundcb = get_sound_callback(&argvars[1]);
if (soundcb != NULL)
{
- vim_snprintf(buf, sizeof(buf), "sound%06ld", newid);
- soundcb->snd_id = newid;
- soundcb->snd_device_id = mciGetDeviceID(buf);
+ vim_snprintf(buf, sizeof(buf), "sound%06ld", newid);
+ soundcb->snd_id = newid;
+ soundcb->snd_device_id = mciGetDeviceID(buf);
}
return;
@@ -437,7 +437,7 @@
char buf[32];
if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
- return;
+ return;
id = tv_get_number(&argvars[0]);
vim_snprintf(buf, sizeof(buf), "stop sound%06ld", id);
@@ -458,7 +458,7 @@
CloseWindow(g_hWndSound);
while (first_callback != NULL)
- delete_sound_callback(first_callback);
+ delete_sound_callback(first_callback);
}
# endif
@@ -469,7 +469,7 @@
sound_play_common(typval_T *argvars, typval_T *rettv, bool playfile)
{
if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
- return;
+ return;
char_u *sound_name = tv_get_string(&argvars[0]);
soundcb_T *soundcb = get_sound_callback(&argvars[1]);
@@ -479,7 +479,7 @@
bool play_success = sound_mch_play(sound_name, sound_id, soundcb, playfile);
if (!play_success && soundcb)
{
- delete_sound_callback(soundcb);
+ delete_sound_callback(soundcb);
}
rettv->vval.v_number = play_success ? sound_id : 0;
}
@@ -500,7 +500,7 @@
f_sound_stop(typval_T *argvars, typval_T *rettv UNUSED)
{
if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
- return;
+ return;
sound_mch_stop(tv_get_number(&argvars[0]));
}
@@ -516,7 +516,7 @@
{
sound_mch_free();
while (first_callback != NULL)
- delete_sound_callback(first_callback);
+ delete_sound_callback(first_callback);
}
# endif
diff --git a/src/strings.c b/src/strings.c
index 84bec92..16a09f8 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -603,9 +603,9 @@
{
i = TOLOWER_ASC(*s1) - TOLOWER_ASC(*s2);
if (i != 0)
- break; // this character is different
+ break; // this character is different
if (*s1 == NUL)
- break; // strings match until NUL
+ break; // strings match until NUL
++s1;
++s2;
--len;
diff --git a/src/testdir/test_codestyle.vim b/src/testdir/test_codestyle.vim
index 51c1209..1d2717c 100644
--- a/src/testdir/test_codestyle.vim
+++ b/src/testdir/test_codestyle.vim
@@ -163,5 +163,27 @@
bwipe!
enddef
+def Test_indent_of_source_files()
+ for fname in glob('../*.[ch]', 0, 1) + ['../xxd/xxd.c']
+ execute 'tabnew ' .. fname
+ for lnum in range(1, line('$'))
+ var name: string = synIDattr(synID(lnum, 1, 0), 'name')
+ if -1 == index(['cComment', 'cCommentStart'], name)
+ var line: string = getline(lnum)
+ var indent: string = matchstr(line, '^\s*')
+ var tailing: string = matchstr(line, '\s*$')
+ if !empty(indent)
+ if indent !~# '^\t* \{0,7\}$'
+ ReportError('testdir/' .. fname, lnum, 'invalid indent')
+ endif
+ endif
+ if !empty(tailing)
+ ReportError('testdir/' .. fname, lnum, 'tailing spaces')
+ endif
+ endif
+ endfor
+ close
+ endfor
+enddef
" vim: shiftwidth=2 sts=2 expandtab nofoldenable
diff --git a/src/version.c b/src/version.c
index 4dc628f..7a67afd 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1363,
+/**/
1362,
/**/
1361,
diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c
index 9031d71..072ef63 100644
--- a/src/xxd/xxd.c
+++ b/src/xxd/xxd.c
@@ -357,7 +357,7 @@
parse_bin_digit(int c)
{
return (c >= '0' && c <= '1') ? c - '0'
- : -1;
+ : -1;
}
/*
@@ -405,53 +405,53 @@
continue;
if (hextype == HEX_NORMAL || hextype == HEX_POSTSCRIPT)
- {
+ {
n3 = n2;
n2 = n1;
n1 = parse_hex_digit(c);
if (n1 == -1 && ign_garb)
continue;
- }
+ }
else /* HEX_BITS */
- {
+ {
n1 = parse_hex_digit(c);
if (n1 == -1 && ign_garb)
continue;
- bt = parse_bin_digit(c);
- if (bt != -1)
- {
- b = ((b << 1) | bt);
- ++bcnt;
- }
- }
+ bt = parse_bin_digit(c);
+ if (bt != -1)
+ {
+ b = ((b << 1) | bt);
+ ++bcnt;
+ }
+ }
ign_garb = 0;
if ((hextype != HEX_POSTSCRIPT) && (p >= cols))
{
- if (hextype == HEX_NORMAL)
- {
+ if (hextype == HEX_NORMAL)
+ {
if (n1 < 0)
- {
- p = 0;
- continue;
- }
+ {
+ p = 0;
+ continue;
+ }
want_off = (want_off << 4) | n1;
- }
- else /* HEX_BITS */
- {
+ }
+ else /* HEX_BITS */
+ {
if (n1 < 0)
- {
- p = 0;
- bcnt = 0;
- continue;
- }
+ {
+ p = 0;
+ bcnt = 0;
+ continue;
+ }
want_off = (want_off << 4) | n1;
- }
- continue;
- }
+ }
+ continue;
+ }
if (base_off + want_off != have_off)
{
@@ -468,35 +468,35 @@
}
if (hextype == HEX_NORMAL || hextype == HEX_POSTSCRIPT)
- {
- if (n2 >= 0 && n1 >= 0)
- {
- putc_or_die((n2 << 4) | n1, fpo);
- have_off++;
- want_off++;
- n1 = -1;
- if (!hextype && (++p >= cols))
- /* skip the rest of the line as garbage */
- c = skip_to_eol(fpi, c);
- }
- else if (n1 < 0 && n2 < 0 && n3 < 0)
- /* already stumbled into garbage, skip line, wait and see */
- c = skip_to_eol(fpi, c);
- }
+ {
+ if (n2 >= 0 && n1 >= 0)
+ {
+ putc_or_die((n2 << 4) | n1, fpo);
+ have_off++;
+ want_off++;
+ n1 = -1;
+ if (!hextype && (++p >= cols))
+ /* skip the rest of the line as garbage */
+ c = skip_to_eol(fpi, c);
+ }
+ else if (n1 < 0 && n2 < 0 && n3 < 0)
+ /* already stumbled into garbage, skip line, wait and see */
+ c = skip_to_eol(fpi, c);
+ }
else /* HEX_BITS */
- {
- if (bcnt == 8)
- {
- putc_or_die(b, fpo);
- have_off++;
- want_off++;
- b = 0;
- bcnt = 0;
- if (++p >= cols)
- /* skip the rest of the line as garbage */
- c = skip_to_eol(fpi, c);
- }
- }
+ {
+ if (bcnt == 8)
+ {
+ putc_or_die(b, fpo);
+ have_off++;
+ want_off++;
+ b = 0;
+ bcnt = 0;
+ if (++p >= cols)
+ /* skip the rest of the line as garbage */
+ c = skip_to_eol(fpi, c);
+ }
+ }
if (c == '\n')
{
@@ -595,41 +595,41 @@
if (ebcdic)
{
if ((e >= 75 && e <= 80) || (e >= 90 && e <= 97) ||
- (e >= 107 && e <= 111) || (e >= 121 && e <= 127) ||
- (e >= 129 && e <= 137) || (e >= 145 && e <= 154) ||
- (e >= 162 && e <= 169) || (e >= 192 && e <= 201) ||
- (e >= 208 && e <= 217) || (e >= 226 && e <= 233) ||
- (e >= 240 && e <= 249) || (e == 189) || (e == 64) ||
- (e == 173) || (e == 224) )
- l[(*c)++] = COLOR_GREEN;
+ (e >= 107 && e <= 111) || (e >= 121 && e <= 127) ||
+ (e >= 129 && e <= 137) || (e >= 145 && e <= 154) ||
+ (e >= 162 && e <= 169) || (e >= 192 && e <= 201) ||
+ (e >= 208 && e <= 217) || (e >= 226 && e <= 233) ||
+ (e >= 240 && e <= 249) || (e == 189) || (e == 64) ||
+ (e == 173) || (e == 224) )
+ l[(*c)++] = COLOR_GREEN;
else if (e == 37 || e == 13 || e == 5)
- l[(*c)++] = COLOR_YELLOW;
+ l[(*c)++] = COLOR_YELLOW;
else if (e == 0)
- l[(*c)++] = COLOR_WHITE;
+ l[(*c)++] = COLOR_WHITE;
else if (e == 255)
- l[(*c)++] = COLOR_BLUE;
+ l[(*c)++] = COLOR_BLUE;
else
- l[(*c)++] = COLOR_RED;
+ l[(*c)++] = COLOR_RED;
}
else /* ASCII */
{
#if defined(__MVS__) && __CHARSET_LIB == 0
if (e >= 64)
- l[(*c)++] = COLOR_GREEN;
+ l[(*c)++] = COLOR_GREEN;
#else
if (e > 31 && e < 127)
- l[(*c)++] = COLOR_GREEN;
+ l[(*c)++] = COLOR_GREEN;
#endif
else if (e == 9 || e == 10 || e == 13)
- l[(*c)++] = COLOR_YELLOW;
+ l[(*c)++] = COLOR_YELLOW;
else if (e == 0)
- l[(*c)++] = COLOR_WHITE;
+ l[(*c)++] = COLOR_WHITE;
else if (e == 255)
- l[(*c)++] = COLOR_BLUE;
+ l[(*c)++] = COLOR_BLUE;
else
- l[(*c)++] = COLOR_RED;
+ l[(*c)++] = COLOR_RED;
}
l[(*c)++] = 'm';
}
@@ -815,20 +815,20 @@
}
}
else if (!STRNCMP(pp, "-n", 2))
- {
- if (pp[2] && STRNCMP("ame", pp + 2, 3))
- varname = pp + 2;
- else
- {
- if (!argv[2])
- exit_with_usage();
- varname = argv[2];
- argv++;
- argc--;
- }
- }
+ {
+ if (pp[2] && STRNCMP("ame", pp + 2, 3))
+ varname = pp + 2;
+ else
+ {
+ if (!argv[2])
+ exit_with_usage();
+ varname = argv[2];
+ argv++;
+ argc--;
+ }
+ }
else if (!STRNCMP(pp, "-R", 2))
- {
+ {
char *pw = pp + 2;
if (!pw[0])
{
@@ -849,7 +849,7 @@
color = enable_color();
else
exit_with_usage();
- }
+ }
else if (!strcmp(argv[1], "--")) /* end of options */
{
argv++;
@@ -867,9 +867,9 @@
if (hextype != (HEX_CINCLUDE | HEX_BITS))
{
- /* Allow at most one bit to be set in hextype */
- if (hextype & (hextype - 1))
- error_exit(1, "only one of -b, -e, -u, -p, -i can be used");
+ /* Allow at most one bit to be set in hextype */
+ if (hextype & (hextype - 1))
+ error_exit(1, "only one of -b, -e, -u, -p, -i can be used");
}
if (!colsgiven || (!cols && hextype != HEX_POSTSCRIPT))
@@ -952,11 +952,11 @@
case HEX_NORMAL:
case HEX_POSTSCRIPT:
case HEX_BITS:
- return huntype(fp, fpo, cols, hextype,
- negseek ? -seekoff : seekoff);
- break;
+ return huntype(fp, fpo, cols, hextype,
+ negseek ? -seekoff : seekoff);
+ break;
default:
- error_exit(-1, "Sorry, cannot revert this type of hexdump");
+ error_exit(-1, "Sorry, cannot revert this type of hexdump");
}
if (seekoff || negseek || !relseek)
@@ -988,7 +988,7 @@
{
/* A user-set variable name overrides fp == stdin */
if (varname == NULL && fp != stdin)
- varname = argv[1];
+ varname = argv[1];
if (varname != NULL)
{
@@ -1000,28 +1000,28 @@
p = 0;
while ((length < 0 || p < length) && (c = getc_or_die(fp)) != EOF)
- {
- if (hextype & HEX_BITS)
+ {
+ if (hextype & HEX_BITS)
{
- if (p == 0)
- fputs_or_die(" ", fpo);
- else if (p % cols == 0)
- fputs_or_die(",\n ", fpo);
- else
- fputs_or_die(", ", fpo);
+ if (p == 0)
+ fputs_or_die(" ", fpo);
+ else if (p % cols == 0)
+ fputs_or_die(",\n ", fpo);
+ else
+ fputs_or_die(", ", fpo);
- FPRINTF_OR_DIE((fpo, "0b"));
- for (int j = 7; j >= 0; j--)
- putc_or_die((c & (1 << j)) ? '1' : '0', fpo);
- p++;
+ FPRINTF_OR_DIE((fpo, "0b"));
+ for (int j = 7; j >= 0; j--)
+ putc_or_die((c & (1 << j)) ? '1' : '0', fpo);
+ p++;
}
- else
+ else
{
FPRINTF_OR_DIE((fpo, (hexx == hexxa) ? "%s0x%02x" : "%s0X%02X",
(p % cols) ? ", " : (!p ? " " : ",\n "), c));
p++;
}
- }
+ }
if (p)
fputs_or_die("\n", fpo);
@@ -1065,7 +1065,7 @@
{
grplen = octspergrp + octspergrp + 1; /* chars per octet group */
if (color)
- grplen += 11 * octspergrp; /* color-code needs 11 extra characters */
+ grplen += 11 * octspergrp; /* color-code needs 11 extra characters */
}
else /* hextype == HEX_BITS */
grplen = 8 * octspergrp + 1;
@@ -1083,15 +1083,15 @@
c = addrlen + 1 + (grplen * x) / octspergrp;
if (hextype == HEX_NORMAL || hextype == HEX_LITTLEENDIAN)
{
- if (color)
- {
+ if (color)
+ {
COLOR_PROLOGUE
begin_coloring_char(l,&c,e,ebcdic);
l[c++] = hexx[(e >> 4) & 0xf];
l[c++] = hexx[e & 0xf];
COLOR_EPILOGUE
}
- else /*No colors*/
+ else /*No colors*/
{
l[c] = hexx[(e >> 4) & 0xf];
l[++c] = hexx[e & 0xf];
@@ -1112,95 +1112,95 @@
c = (grplen * cols - 1) / octspergrp;
if (color)
- {
- if (hextype == HEX_BITS)
- c += addrlen + 3 + p*12;
- else
- c = addrlen + 3 + (grplen * cols - 1)/octspergrp + p*12;
+ {
+ if (hextype == HEX_BITS)
+ c += addrlen + 3 + p*12;
+ else
+ c = addrlen + 3 + (grplen * cols - 1)/octspergrp + p*12;
- COLOR_PROLOGUE
- begin_coloring_char(l,&c,e,ebcdic);
+ COLOR_PROLOGUE
+ begin_coloring_char(l,&c,e,ebcdic);
#if defined(__MVS__) && __CHARSET_LIB == 0
- if (e >= 64)
- l[c++] = e;
- else
- l[c++] = '.';
+ if (e >= 64)
+ l[c++] = e;
+ else
+ l[c++] = '.';
#else
- if (ebcdic)
- e = (e < 64) ? '.' : etoa64[e-64];
- l[c++] = (e > 31 && e < 127) ? e : '.';
+ if (ebcdic)
+ e = (e < 64) ? '.' : etoa64[e-64];
+ l[c++] = (e > 31 && e < 127) ? e : '.';
#endif
- COLOR_EPILOGUE
- }
+ COLOR_EPILOGUE
+ }
else /*no colors*/
- {
- if (ebcdic)
- e = (e < 64) ? '.' : etoa64[e-64];
+ {
+ if (ebcdic)
+ e = (e < 64) ? '.' : etoa64[e-64];
- if (hextype == HEX_LITTLEENDIAN)
- c -= 1;
+ if (hextype == HEX_LITTLEENDIAN)
+ c -= 1;
- c += addrlen + 3 + p;
- l[c++] =
+ c += addrlen + 3 + p;
+ l[c++] =
#if defined(__MVS__) && __CHARSET_LIB == 0
- (e >= 64)
+ (e >= 64)
#else
- (e > 31 && e < 127)
+ (e > 31 && e < 127)
#endif
- ? e : '.';
- }
- n++;
- if (++p == cols)
- {
- l[c++] = '\n';
- l[c] = '\0';
- xxdline(fpo, l, autoskip ? nonzero : 1);
- nonzero = 0;
- p = 0;
- }
+ ? e : '.';
+ }
+ n++;
+ if (++p == cols)
+ {
+ l[c++] = '\n';
+ l[c] = '\0';
+ xxdline(fpo, l, autoskip ? nonzero : 1);
+ nonzero = 0;
+ p = 0;
+ }
}
if (p)
{
l[c++] = '\n';
l[c] = '\0';
if (color)
- {
- x = p;
- if (hextype == HEX_LITTLEENDIAN)
- {
- int fill = octspergrp - (p % octspergrp);
- if (fill == octspergrp) fill = 0;
+ {
+ x = p;
+ if (hextype == HEX_LITTLEENDIAN)
+ {
+ int fill = octspergrp - (p % octspergrp);
+ if (fill == octspergrp) fill = 0;
- c = addrlen + 1 + (grplen * (x - (octspergrp-fill))) / octspergrp;
+ c = addrlen + 1 + (grplen * (x - (octspergrp-fill))) / octspergrp;
- for (i = 0; i < fill;i++)
- {
- COLOR_PROLOGUE
- l[c++] = COLOR_RED;
- l[c++] = 'm';
- l[c++] = ' '; /* empty space */
- COLOR_EPILOGUE
- x++;
- p++;
- }
- }
+ for (i = 0; i < fill;i++)
+ {
+ COLOR_PROLOGUE
+ l[c++] = COLOR_RED;
+ l[c++] = 'm';
+ l[c++] = ' '; /* empty space */
+ COLOR_EPILOGUE
+ x++;
+ p++;
+ }
+ }
- if (hextype != HEX_BITS)
- {
- c = addrlen + 1 + (grplen * x) / octspergrp;
- c += cols - p;
- c += (cols - p) / octspergrp;
+ if (hextype != HEX_BITS)
+ {
+ c = addrlen + 1 + (grplen * x) / octspergrp;
+ c += cols - p;
+ c += (cols - p) / octspergrp;
- for (i = cols - p; i > 0;i--)
- {
- COLOR_PROLOGUE
- l[c++] = COLOR_RED;
- l[c++] = 'm';
- l[c++] = ' '; /* empty space */
- COLOR_EPILOGUE
- }
- }
- }
+ for (i = cols - p; i > 0;i--)
+ {
+ COLOR_PROLOGUE
+ l[c++] = COLOR_RED;
+ l[c++] = 'm';
+ l[c++] = ' '; /* empty space */
+ COLOR_EPILOGUE
+ }
+ }
+ }
xxdline(fpo, l, 1);
}
else if (autoskip)