aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/buffer.c17
-rw-r--r--src/nvim/api/ui_events.in.h3
-rw-r--r--src/nvim/api/vim.c8
-rw-r--r--src/nvim/edit.c58
-rw-r--r--src/nvim/po/tr.po759
-rw-r--r--src/nvim/syntax.c2169
-rw-r--r--src/nvim/testdir/test_ins_complete.vim127
-rw-r--r--src/nvim/window.c7
8 files changed, 1862 insertions, 1286 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index 878ffdf06f..3808f601d9 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -1232,7 +1232,7 @@ static Array extmark_to_array(ExtmarkInfo extmark, bool id, bool add_dict)
return rv;
}
-/// Returns position for a given extmark id
+/// Gets the position (0-indexed) of an extmark.
///
/// @param buffer Buffer handle, or 0 for current buffer
/// @param ns_id Namespace id from |nvim_create_namespace()|
@@ -1240,7 +1240,8 @@ static Array extmark_to_array(ExtmarkInfo extmark, bool id, bool add_dict)
/// @param opts Optional parameters. Keys:
/// - details: Whether to include the details dict
/// @param[out] err Error details, if any
-/// @return (row, col) tuple or empty list () if extmark id was absent
+/// @return 0-indexed (row, col) tuple or empty list () if extmark id was
+/// absent
ArrayOf(Integer) nvim_buf_get_extmark_by_id(Buffer buffer, Integer ns_id,
Integer id, Dictionary opts,
Error *err)
@@ -1320,10 +1321,10 @@ ArrayOf(Integer) nvim_buf_get_extmark_by_id(Buffer buffer, Integer ns_id,
///
/// @param buffer Buffer handle, or 0 for current buffer
/// @param ns_id Namespace id from |nvim_create_namespace()|
-/// @param start Start of range, given as (row, col) or valid extmark id
-/// (whose position defines the bound)
-/// @param end End of range, given as (row, col) or valid extmark id
-/// (whose position defines the bound)
+/// @param start Start of range: a 0-indexed (row, col) or valid extmark id
+/// (whose position defines the bound). |api-indexing|
+/// @param end End of range (inclusive): a 0-indexed (row, col) or valid
+/// extmark id (whose position defines the bound). |api-indexing|
/// @param opts Optional parameters. Keys:
/// - limit: Maximum number of marks to return
/// - details Whether to include the details dict
@@ -1424,8 +1425,8 @@ Array nvim_buf_get_extmarks(Buffer buffer, Integer ns_id,
///
/// @param buffer Buffer handle, or 0 for current buffer
/// @param ns_id Namespace id from |nvim_create_namespace()|
-/// @param line Line where to place the mark, 0-based
-/// @param col Column where to place the mark, 0-based
+/// @param line Line where to place the mark, 0-based. |api-indexing|
+/// @param col Column where to place the mark, 0-based. |api-indexing|
/// @param opts Optional parameters.
/// - id : id of the extmark to edit.
/// - end_line : ending line of the mark, 0-based inclusive.
diff --git a/src/nvim/api/ui_events.in.h b/src/nvim/api/ui_events.in.h
index 35d39a34d7..03fe5c5058 100644
--- a/src/nvim/api/ui_events.in.h
+++ b/src/nvim/api/ui_events.in.h
@@ -119,7 +119,8 @@ void msg_set_pos(Integer grid, Integer row, Boolean scrolled, String sep_char)
FUNC_API_SINCE(6) FUNC_API_BRIDGE_IMPL FUNC_API_COMPOSITOR_IMPL;
void win_viewport(Integer grid, Window win, Integer topline,
- Integer botline, Integer curline, Integer curcol)
+ Integer botline, Integer curline, Integer curcol,
+ Integer line_count)
FUNC_API_SINCE(7) FUNC_API_REMOTE_ONLY;
void popupmenu_show(Array items, Integer selected,
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 5f48a26a29..f65d5cc185 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -275,9 +275,9 @@ static void on_redraw_event(void **argv)
///
/// On execution error: does not fail, but updates v:errmsg.
///
-/// If you need to input sequences like <C-o> use |nvim_replace_termcodes| to
-/// replace the termcodes and then pass the resulting string to nvim_feedkeys.
-/// You'll also want to enable escape_csi.
+/// To input sequences like <C-o> use |nvim_replace_termcodes()| (typically
+/// with escape_csi=true) to replace |keycodes|, then pass the result to
+/// nvim_feedkeys().
///
/// Example:
/// <pre>
@@ -1551,7 +1551,7 @@ void nvim_set_current_tabpage(Tabpage tabpage, Error *err)
}
}
-/// Creates a new namespace, or gets an existing one.
+/// Creates a new *namespace*, or gets an existing one.
///
/// Namespaces are used for buffer highlights and virtual text, see
/// |nvim_buf_add_highlight()| and |nvim_buf_set_extmark()|.
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 8216987635..f39a6a281b 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -84,6 +84,7 @@
#define CTRL_X_SPELL 14
#define CTRL_X_LOCAL_MSG 15 ///< only used in "ctrl_x_msgs"
#define CTRL_X_EVAL 16 ///< for builtin function complete()
+#define CTRL_X_CMDLINE_CTRL_X 17 ///< CTRL-X typed in CTRL_X_CMDLINE
#define CTRL_X_MSG(i) ctrl_x_msgs[(i) & ~CTRL_X_WANT_IDENT]
#define CTRL_X_MODE_LINE_OR_EVAL(m) \
@@ -109,6 +110,7 @@ static char *ctrl_x_msgs[] =
N_(" Spelling suggestion (s^N^P)"),
N_(" Keyword Local completion (^N^P)"),
NULL, // CTRL_X_EVAL doesn't use msg.
+ N_(" Command-line completion (^V^N^P)"),
};
static char *ctrl_x_mode_names[] = {
@@ -128,7 +130,8 @@ static char *ctrl_x_mode_names[] = {
"omni",
"spell",
NULL, // CTRL_X_LOCAL_MSG only used in "ctrl_x_msgs"
- "eval"
+ "eval",
+ "cmdline",
};
static char e_hitend[] = N_("Hit end of paragraph");
@@ -762,7 +765,8 @@ static int insert_execute(VimState *state, int key)
s->c = do_digraph(s->c);
- if ((s->c == Ctrl_V || s->c == Ctrl_Q) && ctrl_x_mode == CTRL_X_CMDLINE) {
+ if ((s->c == Ctrl_V || s->c == Ctrl_Q)
+ && (ctrl_x_mode == CTRL_X_CMDLINE || ctrl_x_mode == CTRL_X_CMDLINE_CTRL_X)) {
insert_do_complete(s);
return 1;
}
@@ -2028,11 +2032,8 @@ static bool del_char_after_col(int limit_col)
*/
static void ins_ctrl_x(void)
{
- /* CTRL-X after CTRL-X CTRL-V doesn't do anything, so that CTRL-X
- * CTRL-V works like CTRL-N */
- if (ctrl_x_mode != CTRL_X_CMDLINE) {
- /* if the next ^X<> won't ADD nothing, then reset
- * compl_cont_status */
+ if (ctrl_x_mode != CTRL_X_CMDLINE && ctrl_x_mode != CTRL_X_CMDLINE_CTRL_X) {
+ // if the next ^X<> won't ADD nothing, then reset compl_cont_status
if (compl_cont_status & CONT_N_ADDS) {
compl_cont_status |= CONT_INTRPT;
} else {
@@ -2043,6 +2044,10 @@ static void ins_ctrl_x(void)
edit_submode = (char_u *)_(CTRL_X_MSG(ctrl_x_mode));
edit_submode_pre = NULL;
showmode();
+ } else {
+ // CTRL-X in CTRL-X CTRL-V mode behaves differently to make CTRL-X
+ // CTRL-V look like CTRL-N
+ ctrl_x_mode = CTRL_X_CMDLINE_CTRL_X;
}
}
@@ -2052,7 +2057,8 @@ bool ctrl_x_mode_not_default(void)
return ctrl_x_mode != CTRL_X_NORMAL;
}
-// Whether CTRL-X was typed without a following character.
+// Whether CTRL-X was typed without a following character,
+// not including when in CTRL-X CTRL-V mode.
bool ctrl_x_mode_not_defined_yet(void)
{
return ctrl_x_mode == CTRL_X_NOT_DEFINED_YET;
@@ -2104,12 +2110,14 @@ bool vim_is_ctrl_x_key(int c)
case 0: // Not in any CTRL-X mode
return c == Ctrl_N || c == Ctrl_P || c == Ctrl_X;
case CTRL_X_NOT_DEFINED_YET:
+ case CTRL_X_CMDLINE_CTRL_X:
return c == Ctrl_X || c == Ctrl_Y || c == Ctrl_E
|| c == Ctrl_L || c == Ctrl_F || c == Ctrl_RSB
|| c == Ctrl_I || c == Ctrl_D || c == Ctrl_P
|| c == Ctrl_N || c == Ctrl_T || c == Ctrl_V
|| c == Ctrl_Q || c == Ctrl_U || c == Ctrl_O
- || c == Ctrl_S || c == Ctrl_K || c == 's';
+ || c == Ctrl_S || c == Ctrl_K || c == 's'
+ || c == Ctrl_Z;
case CTRL_X_SCROLL:
return c == Ctrl_Y || c == Ctrl_E;
case CTRL_X_WHOLE_LINE:
@@ -2163,6 +2171,7 @@ static bool ins_compl_accept_char(int c)
return vim_isfilec(c) && !vim_ispathsep(c);
case CTRL_X_CMDLINE:
+ case CTRL_X_CMDLINE_CTRL_X:
case CTRL_X_OMNI:
// Command line and Omni completion can work with just about any
// printable character, but do stop at white space.
@@ -3567,6 +3576,26 @@ static bool ins_compl_prep(int c)
return retval;
}
+ if (ctrl_x_mode == CTRL_X_CMDLINE_CTRL_X && c != Ctrl_X) {
+ if (c == Ctrl_V || c == Ctrl_Q || c == Ctrl_Z || ins_compl_pum_key(c)
+ || !vim_is_ctrl_x_key(c)) {
+ // Not starting another completion mode.
+ ctrl_x_mode = CTRL_X_CMDLINE;
+
+ // CTRL-X CTRL-Z should stop completion without inserting anything
+ if (c == Ctrl_Z) {
+ retval = true;
+ }
+ } else {
+ ctrl_x_mode = CTRL_X_CMDLINE;
+
+ // Other CTRL-X keys first stop completion, then start another
+ // completion mode.
+ ins_compl_prep(' ');
+ ctrl_x_mode = CTRL_X_NOT_DEFINED_YET;
+ }
+ }
+
// Set "compl_get_longest" when finding the first matches.
if (ctrl_x_mode == CTRL_X_NOT_DEFINED_YET
|| (ctrl_x_mode == CTRL_X_NORMAL && !compl_started)) {
@@ -3633,6 +3662,12 @@ static bool ins_compl_prep(int c)
case Ctrl_Q:
ctrl_x_mode = CTRL_X_CMDLINE;
break;
+ case Ctrl_Z:
+ ctrl_x_mode = CTRL_X_NORMAL;
+ edit_submode = NULL;
+ showmode();
+ retval = true;
+ break;
case Ctrl_P:
case Ctrl_N:
/* ^X^P means LOCAL expansion if nothing interrupted (eg we
@@ -4292,10 +4327,11 @@ static int ins_compl_get_exp(pos_T *ini)
break;
case CTRL_X_CMDLINE:
+ case CTRL_X_CMDLINE_CTRL_X:
if (expand_cmdline(&compl_xp, compl_pattern,
(int)STRLEN(compl_pattern),
&num_matches, &matches) == EXPAND_OK) {
- ins_compl_add_matches(num_matches, matches, FALSE);
+ ins_compl_add_matches(num_matches, matches, false);
}
break;
@@ -5135,7 +5171,7 @@ static int ins_complete(int c, bool enable_pum)
compl_col += startcol;
compl_length = (int)curs_col - startcol;
compl_pattern = addstar(line + compl_col, compl_length, EXPAND_FILES);
- } else if (ctrl_x_mode == CTRL_X_CMDLINE) {
+ } else if (ctrl_x_mode == CTRL_X_CMDLINE || ctrl_x_mode == CTRL_X_CMDLINE_CTRL_X) {
compl_pattern = vim_strnsave(line, curs_col);
set_cmd_context(&compl_xp, compl_pattern,
(int)STRLEN(compl_pattern), curs_col, false);
diff --git a/src/nvim/po/tr.po b/src/nvim/po/tr.po
index 3db3cbfef0..e1fef00863 100644
--- a/src/nvim/po/tr.po
+++ b/src/nvim/po/tr.po
@@ -1,16 +1,16 @@
# Turkish translations for Vim
# Vim Türkçe çevirileri
-# Copyright (C) 2020 Emir SARI <bitigchi@me.com>
+# Copyright (C) 2021 Emir SARI <emir_sari@msn.com>
# This file is distributed under the same license as the Vim package.
-# Emir SARI <bitigchi@me.com>, 2019-2020
+# Emir SARI <emir_sari@msn.com>, 2019-2021
#
msgid ""
msgstr ""
"Project-Id-Version: Vim Turkish Localization Project\n"
-"Report-Msgid-Bugs-To: Emir SARI <bitigchi@me.com>\n"
-"POT-Creation-Date: 2020-11-29 00:20+0300\n"
-"PO-Revision-Date: 2020-11-29 20:00+0300\n"
-"Last-Translator: Emir SARI <bitigchi@me.com>\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-07-16 17:56+0300\n"
+"PO-Revision-Date: 2021-07-16 20:00+0300\n"
+"Last-Translator: Emir SARI <emir_sari@msn.com>\n"
"Language-Team: Turkish <https://github.com/bitigchi/vim>\n"
"Language: tr\n"
"MIME-Version: 1.0\n"
@@ -28,7 +28,7 @@ msgid "E165: Cannot go beyond last file"
msgstr "E165: Son dosyadan öteye gidilemez"
msgid "E610: No argument to delete"
-msgstr "E610: Silinecek bir değişken yok"
+msgstr "E610: Silinecek bir argüman yok"
msgid "E249: window layout changed unexpectedly"
msgstr "E249: Pencere yerleşimi beklenmedik bir biçimde değişti"
@@ -94,6 +94,9 @@ msgstr "%s çalıştırılıyor"
msgid "autocommand %s"
msgstr "%s otokomutu"
+msgid "E972: Blob value does not have the right number of bytes"
+msgstr "E972: İkili geniş nesne değeri doğru bayt sayısına sahip değil"
+
msgid "E831: bf_key_init() called with empty password"
msgstr "E831: bf_key_init() boş bir şifre ile çağrıldı"
@@ -131,6 +134,27 @@ msgstr "E931: Arabellek kaydedilemedi"
msgid "E937: Attempt to delete a buffer that is in use: %s"
msgstr "E937: Kullanımda olan bir arabellek silinmeye çalışılıyor: %s"
+msgid "E90: Cannot unload last buffer"
+msgstr "E90: Son arabellek bellekten kaldırılamıyor"
+
+msgid "E84: No modified buffer found"
+msgstr "E84: Değiştirilmiş bir arabellek bulunamadı"
+
+msgid "E85: There is no listed buffer"
+msgstr "E85: Listelenmiş bir arabellek yok"
+
+msgid "E87: Cannot go beyond last buffer"
+msgstr "E87: Son arabellekten öteye gidilemez"
+
+msgid "E88: Cannot go before first buffer"
+msgstr "E88: İlk arabellekten öncesine gidilemez"
+
+#, c-format
+msgid "E89: No write since last change for buffer %d (add ! to override)"
+msgstr ""
+"E89: %d numaralı arabellek son değişiklikten sonra yazılmadı (geçersiz "
+"kılmak için ! ekleyin)"
+
msgid "E515: No buffers were unloaded"
msgstr "E515: Hiçbir arabellek bellekten kaldırılmadı"
@@ -158,27 +182,6 @@ msgid_plural "%d buffers wiped out"
msgstr[0] "%d arabellek yok edildi"
msgstr[1] "%d arabellek yok edildi"
-msgid "E90: Cannot unload last buffer"
-msgstr "E90: Son arabellek bellekten kaldırılamıyor"
-
-msgid "E84: No modified buffer found"
-msgstr "E84: Değiştirilmiş bir arabellek bulunamadı"
-
-msgid "E85: There is no listed buffer"
-msgstr "E85: Listelenmiş bir arabellek yok"
-
-msgid "E87: Cannot go beyond last buffer"
-msgstr "E87: Son arabellekten öteye gidilemez"
-
-msgid "E88: Cannot go before first buffer"
-msgstr "E88: İlk arabellekten öncesine gidilemez"
-
-#, c-format
-msgid "E89: No write since last change for buffer %d (add ! to override)"
-msgstr ""
-"E89: %d numaralı arabellek son değişiklikten sonra yazılmadı (geçersiz "
-"kılmak için ! ekleyin)"
-
msgid "E948: Job still running (add ! to end the job)"
msgstr "E948: İş hâlâ sürüyor (bitirmek için ! ekleyin)"
@@ -424,13 +427,13 @@ msgid "E901: gethostbyname() in channel_open()"
msgstr "E901: channel_open() içinde gethostbyname()"
msgid "E903: received command with non-string argument"
-msgstr "E903: Dizi olmayan değişken içeren komut alındı"
+msgstr "E903: Dizi olmayan argüman içeren komut alındı"
msgid "E904: last argument for expr/call must be a number"
-msgstr "E904: İfadenin/çağrının son değişkeni bir sayı olmalıdır"
+msgstr "E904: İfadenin/çağrının son argüman bir sayı olmalıdır"
msgid "E904: third argument for call must be a list"
-msgstr "E904: Çağrının üçüncü değişkeni bir liste olmalıdır"
+msgstr "E904: Çağrının üçüncü argümanı bir liste olmalıdır"
#, c-format
msgid "E905: received unknown command: %s"
@@ -449,7 +452,7 @@ msgstr "E631: %s(): Yazma başarısız"
#, c-format
msgid "E917: Cannot use a callback with %s()"
-msgstr "E917: %s() ile geri çağırma kullanılamaz"
+msgstr "E917: %s() ile geri çağırma kullanılamıyor"
msgid "E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel"
msgstr "E912: ch_evalexpr()/ch_sendexpr() raw/nl kanalları ile kullanılamaz"
@@ -511,6 +514,11 @@ msgid "Warning: Using a weak encryption method; see :help 'cm'"
msgstr ""
"Uyarı: Zayıf bir şifreleme yöntemi kullanılıyor; bilgi için: :help 'cm'"
+msgid ""
+"Note: Encryption of swapfile not supported, disabling swap- and undofile"
+msgstr "Takas dosyası şifrelemesi desteklenmiyor, takas ve geri al dosyası "
+"devre dışı bırakılıyor"
+
msgid "Enter encryption key: "
msgstr "Şifreleme anahtarı girin: "
@@ -570,7 +578,7 @@ msgid "%3d expr %s"
msgstr "%3d ifade %s"
msgid "extend() argument"
-msgstr "extend() değişkeni"
+msgstr "extend() argümanı"
#, c-format
msgid "E737: Key already exists: %s"
@@ -728,9 +736,6 @@ msgstr "E708: [:] en son gelmelidir"
msgid "E709: [:] requires a List or Blob value"
msgstr "E709: [:] bir liste veya ikili geniş nesne değeri gerektirir"
-msgid "E972: Blob value does not have the right number of bytes"
-msgstr "E972: İkili geniş nesne değeri doğru bayt sayısına sahip değil"
-
msgid "E996: Cannot lock a range"
msgstr "E996: Erim kilitlenemiyor"
@@ -741,7 +746,7 @@ msgid "E260: Missing name after ->"
msgstr "E260: -> sonrası ad eksik"
msgid "E695: Cannot index a Funcref"
-msgstr "E695: Bir Funcref dizinlenemez"
+msgstr "E695: Bir Funcref dizinlenemiyor"
msgid "Not enough memory to set references, garbage collection aborted!"
msgstr "Referansları ayarlamak için yetersiz bellek, atık toplama durduruldu"
@@ -759,9 +764,6 @@ msgstr ""
"\n"
"\tEn son şuradan ayarlandı: "
-msgid "E808: Number or Float required"
-msgstr "E808: Sayı veya kayan noktalı değer gerekiyor"
-
#, c-format
msgid "E158: Invalid buffer name: %s"
msgstr "E158: Geçersiz arabellek adı: %s"
@@ -780,7 +782,7 @@ msgid "E922: expected a dict"
msgstr "E922: Bir sözlük bekleniyordu"
msgid "E923: Second argument of function() must be a list or a dict"
-msgstr "E923: function() ikinci değişkeni bir liste veya sözlük olmalıdır"
+msgstr "E923: function() ikinci argümanı bir liste veya sözlük olmalıdır"
msgid ""
"&OK\n"
@@ -882,7 +884,7 @@ msgid "E742: Cannot change value of %s"
msgstr "E742: %s değeri değiştirilemiyor"
msgid "E921: Invalid callback argument"
-msgstr "E921: Geçersiz geri çağırma değişkeni"
+msgstr "E921: Geçersiz geri çağırma argümanı"
#, c-format
msgid "<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s"
@@ -927,6 +929,10 @@ msgstr "E135: *Süzgeç* otokomutları şu anki arabelleği değiştirmemelidir"
msgid "[No write since last change]\n"
msgstr "[Son değişiklikten sonra yazılmadı]\n"
+#, c-format
+msgid "E503: \"%s\" is not a file or writable device"
+msgstr "E503: \"%s\", bir dosya veya yazılabilir aygıt değil"
+
msgid "Save As"
msgstr "Farklı Kaydet"
@@ -985,7 +991,7 @@ msgid "E143: Autocommands unexpectedly deleted new buffer %s"
msgstr "E143: yeni %s arabelleğini otokomutlar beklenmedik bir biçimde sildi"
msgid "E144: non-numeric argument to :z"
-msgstr "E144: :z için sayısal olmayan değişken"
+msgstr "E144: :z için sayısal olmayan argüman"
msgid "E145: Shell commands and some functionality not allowed in rvim"
msgstr "E145: rvim içinde kabuk komutları ve bazı işlevselliğe izin verilmez"
@@ -1091,9 +1097,6 @@ msgstr "Kaynak alınan dosyanın sonu"
msgid "End of function"
msgstr "İşlevin sonu"
-msgid "E464: Ambiguous use of user-defined command"
-msgstr "E464: Kullanıcı tanımlı komutun belirsiz kullanımı"
-
msgid "E492: Not an editor command"
msgstr "E492: Bir düzenleyici komutu değil"
@@ -1178,7 +1181,7 @@ msgid "E187: Unknown"
msgstr "E187: Bilinmeyen"
msgid "E465: :winsize requires two number arguments"
-msgstr "E465: :winsize iki adet sayı değişken gerektirir"
+msgstr "E465: :winsize iki adet sayı argüman gerektirir"
#, c-format
msgid "Window position: X %d, Y %d"
@@ -1188,7 +1191,7 @@ msgid "E188: Obtaining window position not implemented for this platform"
msgstr "E188: Pencere konumunu alma özelliği bu platformda mevcut değil"
msgid "E466: :winpos requires two number arguments"
-msgstr "E466: :winpos iki adet sayı değişken gerektirir"
+msgstr "E466: :winpos iki adet sayı argüman gerektirir"
msgid "E930: Cannot use :redir inside execute()"
msgstr "E930: :redir, execute() içinde kullanılamaz"
@@ -1340,6 +1343,9 @@ msgstr "E788: Şu anda başka bir arabellek düzenlenemez"
msgid "E811: Not allowed to change buffer information now"
msgstr "E811: Şu anda arabellek bilgisi değiştirilemez"
+msgid "[Command Line]"
+msgstr "[Komut Satırı]"
+
msgid "E199: Active window or buffer deleted"
msgstr "E199: Etkin pencere veya arabellek silinmiş"
@@ -1530,7 +1536,7 @@ msgid "E655: Too many symbolic links (cycle?)"
msgstr "E655: Çok fazla sembolik bağlantı (çevrim?)"
msgid "writefile() first argument must be a List or a Blob"
-msgstr "writefile() ilk değişkeni bir liste veya ikili geniş nesne olmalıdır"
+msgstr "writefile() ilk argümanı bir liste veya ikili geniş nesne olmalıdır"
msgid "Select Directory dialog"
msgstr "Dizin Seç iletişim kutusu"
@@ -1581,6 +1587,9 @@ msgstr "E446: İmleç altında bir dosya adı yok"
msgid "E447: Can't find file \"%s\" in path"
msgstr "E447: \"%s\" dosyası yol içinde bulunamadı"
+msgid "E808: Number or Float required"
+msgstr "E808: Sayı veya kayan noktalı değer gerekiyor"
+
msgid "E490: No fold found"
msgstr "E490: Kıvırma bulunamadı"
@@ -1805,7 +1814,7 @@ msgstr "E671: Pencere başlığı \"%s\" bulunamıyor"
#, c-format
msgid "E243: Argument not supported: \"-%s\"; Use the OLE version."
-msgstr "E243: \"-%s\" değişkeni desteklenmiyor; OLE sürümünü kullanın."
+msgstr "E243: \"-%s\" argümanı desteklenmiyor; OLE sürümünü kullanın."
msgid "E988: GUI cannot be used. Cannot execute gvim.exe."
msgstr "E988: Grafik arabirim kullanılamaz. gvim.exe çalıştırılamadı."
@@ -2042,11 +2051,11 @@ msgstr "E411: Vurgulama grubu bulunamadı: %s"
#, c-format
msgid "E412: Not enough arguments: \":highlight link %s\""
-msgstr "E412: Yetersiz sayıda değişken: \":highlight link %s\""
+msgstr "E412: Yetersiz sayıda argüman: \":highlight link %s\""
#, c-format
msgid "E413: Too many arguments: \":highlight link %s\""
-msgstr "E413: Çok fazla değişken: \":highlight link %s\""
+msgstr "E413: Çok fazla argüman: \":highlight link %s\""
msgid "E414: group has settings, highlight link ignored"
msgstr "E414: Grup ayarları mevcut, vurgulama bağlantısı yok sayıldı"
@@ -2061,7 +2070,7 @@ msgstr "E416: Eksik eşittir imi: %s"
#, c-format
msgid "E417: missing argument: %s"
-msgstr "E417: Eksik değişkenler: %s"
+msgstr "E417: Argüman eksik: %s"
#, c-format
msgid "E418: Illegal value: %s"
@@ -2086,7 +2095,7 @@ msgstr "E422: Uçbirim kodu çok uzun: %s"
#, c-format
msgid "E423: Illegal argument: %s"
-msgstr "E423: İzin verilmeyen değişken: %s"
+msgstr "E423: İzin verilmeyen argüman: %s"
msgid "E424: Too many different highlighting attributes in use"
msgstr "E424: Çok fazla değişik vurgulama kuralları kullanılıyor"
@@ -2295,7 +2304,7 @@ msgid "unknown option"
msgstr "bilinmeyen seçenek"
msgid "window index is out of range"
-msgstr "pencere dizini erimin dışında"
+msgstr "pencere sırası erimin dışında"
msgid "couldn't open buffer"
msgstr "arabellek açılamadı"
@@ -2513,9 +2522,6 @@ msgstr " Dahili anahtar sözcük tamamlaması (^N^P)"
msgid "Hit end of paragraph"
msgstr "Paragrafın sonuna varıldı"
-msgid "E839: Completion function changed window"
-msgstr "E839: Tamamlama işlevi pencereyi değiştirdi"
-
msgid "E840: Completion function deleted text"
msgstr "E840: Tamamlama işlevi metni sildi"
@@ -2594,23 +2600,23 @@ msgstr "E938: JSON'da yinelenmiş anahtar: \"%s\""
#, c-format
msgid "E899: Argument of %s must be a List or Blob"
-msgstr "E899: %s değişkeni bir liste veya ikili geniş nesne olmalıdır"
+msgstr "E899: %s argümanı bir liste veya ikili geniş nesne olmalıdır"
msgid "E900: maxdepth must be non-negative number"
msgstr "E900: maxdepth negatif olmayan bir sayı olmalı"
msgid "flatten() argument"
-msgstr "flatten() değişkeni"
+msgstr "flatten() argümanı"
#, c-format
msgid "E696: Missing comma in List: %s"
msgstr "E696: Listede virgül eksik: %s"
msgid "sort() argument"
-msgstr "sort() değişkeni"
+msgstr "sort() argümanı"
msgid "uniq() argument"
-msgstr "uniq() değişkeni"
+msgstr "uniq() argümanı"
msgid "E702: Sort compare function failed"
msgstr "E702: Sıralayıp karşılaştırma işlevi başarısız oldu"
@@ -2619,25 +2625,28 @@ msgid "E882: Uniq compare function failed"
msgstr "E882: Benzersizlik karşılaştırma işlevi başarısız oldu"
msgid "map() argument"
-msgstr "map() değişkeni"
+msgstr "map() argümanı"
msgid "mapnew() argument"
-msgstr "mapnew() değişkeni"
+msgstr "mapnew() argümanı"
msgid "filter() argument"
-msgstr "filter() değişkeni"
+msgstr "filter() argümanı"
msgid "add() argument"
-msgstr "add() değişkeni"
+msgstr "add() argümanı"
+
+msgid "extendnew() argument"
+msgstr "extendnew() argümanı"
msgid "insert() argument"
-msgstr "insert() değişkeni"
+msgstr "insert() argümanı"
msgid "remove() argument"
-msgstr "remove() değişkeni"
+msgstr "remove() argümanı"
msgid "reverse() argument"
-msgstr "reverse() değişkeni"
+msgstr "reverse() argümanı"
#, c-format
msgid "Current %slanguage: \"%s\""
@@ -2648,22 +2657,22 @@ msgid "E197: Cannot set language to \"%s\""
msgstr "E197: \"%s\" diline ayarlanamıyor"
msgid "Unknown option argument"
-msgstr "Bilinmeyen seçenek değişkeni"
+msgstr "Bilinmeyen seçenek argümanı"
msgid "Too many edit arguments"
-msgstr "Çok fazla düzenleme değişkeni"
+msgstr "Çok fazla düzenleme argümanı"
msgid "Argument missing after"
-msgstr "Şundan sonra değişken eksik:"
+msgstr "Şundan sonra argüman eksik:"
msgid "Garbage after option argument"
-msgstr "Seçenek değişkeninden sonra anlamsız veri"
+msgstr "Seçenek argümanından sonra anlamsız veri"
msgid "Too many \"+command\", \"-c command\" or \"--cmd command\" arguments"
-msgstr "Çok fazla \"+komut\", \"-c komut\" veya \"--cmd komut\" değişkeni"
+msgstr "Çok fazla \"+komut\", \"-c komut\" veya \"--cmd komut\" argümanı"
msgid "Invalid argument for"
-msgstr "Şunun için geçersiz değişken:"
+msgstr "Şunun için geçersiz argüman:"
#, c-format
msgid "%d files to edit\n"
@@ -2735,7 +2744,7 @@ msgstr ""
"Kullanım:"
msgid " vim [arguments] "
-msgstr " vim [değişkenler] "
+msgstr " vim [argümanlar] "
msgid ""
"\n"
@@ -2967,21 +2976,21 @@ msgid ""
"Arguments recognised by gvim (Motif version):\n"
msgstr ""
"\n"
-"gvim tarafından tanınan değişkenler (Motif sürümü):\n"
+"gvim tarafından tanınan argümanlar (Motif sürümü):\n"
msgid ""
"\n"
"Arguments recognised by gvim (neXtaw version):\n"
msgstr ""
"\n"
-"gvim tarafından tanınan değişkenler (neXtaw sürümü):\n"
+"gvim tarafından tanınan argümanlar (neXtaw sürümü):\n"
msgid ""
"\n"
"Arguments recognised by gvim (Athena version):\n"
msgstr ""
"\n"
-"gvim tarafından tanınan değişkenler (Athena sürümü):\n"
+"gvim tarafından tanınan argümanlar (Athena sürümü):\n"
msgid "-display <display>\tRun Vim on <display>"
msgstr "-display <ekran>\tVim'i <ekran>'da çalıştır"
@@ -3032,7 +3041,7 @@ msgid ""
"Arguments recognised by gvim (GTK+ version):\n"
msgstr ""
"\n"
-"gvim tarafından tanınan değişkenler (GTK+ sürümü):\n"
+"gvim tarafından tanınan argümanlar (GTK+ sürümü):\n"
msgid "-display <display>\tRun Vim on <display> (also: --display)"
msgstr "-display <ekran>\tVim'i <ekran>'da çalıştır (veya: --display)"
@@ -3078,7 +3087,7 @@ msgid "E228: makemap: Illegal mode"
msgstr "E228: makemap: İzin verilmeyen kip"
msgid "E460: entries missing in mapset() dict argument"
-msgstr "E460: mapset() sözlük değişkeninde eksik girdiler"
+msgstr "E460: mapset() sözlük argümanında eksik girdiler"
#, c-format
msgid "E357: 'langmap': Matching character missing for %s"
@@ -3716,13 +3725,13 @@ msgstr ""
"İ&ptal"
msgid "E766: Insufficient arguments for printf()"
-msgstr "E766: printf() için yetersiz değişkenler"
+msgstr "E766: printf() için yetersiz argüman"
msgid "E807: Expected Float argument for printf()"
-msgstr "E807: printf() için kayan noktalı değer türünde değişken bekleniyordu"
+msgstr "E807: printf() için kayan noktalı değer türünde argüman bekleniyordu"
msgid "E767: Too many arguments to printf()"
-msgstr "E767: printf() için çok fazla değişken"
+msgstr "E767: printf() için çok fazla argüman"
msgid "Type number and <Enter> or click with the mouse (q or empty cancels): "
msgstr ""
@@ -4014,12 +4023,12 @@ msgstr "E531: Grafik arabirimi başlatmak için \":gui\" yazın"
msgid "E589: 'backupext' and 'patchmode' are equal"
msgstr "E589: 'backupext' ve 'patchmode' birbirine eşit"
-msgid "E834: Conflicts with value of 'listchars'"
-msgstr "E834: 'listchars' değeriyle çakışmalar var"
-
msgid "E835: Conflicts with value of 'fillchars'"
msgstr "E835: 'fillchars' değeriyle çakışmalar var"
+msgid "E834: Conflicts with value of 'listchars'"
+msgstr "E834: 'listchars' değeriyle çakışmalar var"
+
msgid "E617: Cannot be changed in the GTK+ 2 GUI"
msgstr "E617: GTK+ 2 grafik arabiriminde değiştirilemez"
@@ -4392,7 +4401,7 @@ msgid "Cannot open file \"%s\""
msgstr "\"%s\" dosyası açılamıyor"
msgid "cannot have both a list and a \"what\" argument"
-msgstr "ya birinci ya da son değişken belirtilmelidir"
+msgstr "ya birinci ya da son argüman belirtilmelidir"
msgid "E681: Buffer is not loaded"
msgstr "E681: Arabellek yüklenemedi"
@@ -4725,10 +4734,10 @@ msgid "modeline"
msgstr "kip satırı"
msgid "--cmd argument"
-msgstr "--cmd değişkeni"
+msgstr "--cmd argümanı"
msgid "-c argument"
-msgstr "-c değişkeni"
+msgstr "-c argümanı"
msgid "environment variable"
msgstr "ortam değişkeni"
@@ -4736,6 +4745,9 @@ msgstr "ortam değişkeni"
msgid "error handler"
msgstr "hata işleyicisi"
+msgid "changed window size"
+msgstr "değiştirilen pencere boyutu"
+
msgid "W15: Warning: Wrong line separator, ^M may be missing"
msgstr "W15: Uyarı: Yanlış satır ayırıcısı, ^M eksik olabilir"
@@ -5215,6 +5227,9 @@ msgstr "E765: 'spellfile' içinde %d adet girdi yok"
msgid "Word '%.*s' removed from %s"
msgstr "'%.*s' sözcüğü %s içinden çıkartıldı"
+msgid "Seek error in spellfile"
+msgstr "Yazım dosyasında arama hatası"
+
#, c-format
msgid "Word '%.*s' added to %s"
msgstr "'%.*s' sözcüğü %s dosyasına eklendi"
@@ -5242,7 +5257,7 @@ msgstr " < \"%.*s\""
#, c-format
msgid "E390: Illegal argument: %s"
-msgstr "E390: İzin verilmeyen değişken: %s"
+msgstr "E390: İzin verilmeyen argüman: %s"
msgid "No Syntax items defined for this buffer"
msgstr "Bu arabellek için sözdizim ögeleri tanımlanmamış"
@@ -5343,7 +5358,7 @@ msgid " line breaks"
msgstr " satır sonu"
msgid "E395: contains argument not accepted here"
-msgstr "E395: Burada kabul edilmeyen bir değişken içeriyor"
+msgstr "E395: Burada kabul edilmeyen bir argüman içeriyor"
msgid "E844: invalid cchar value"
msgstr "E844: Geçersiz cchar değeri"
@@ -5375,7 +5390,7 @@ msgstr "E398: '=' eksik: %s"
#, c-format
msgid "E399: Not enough arguments: syntax region %s"
-msgstr "E399: Yetersiz değişken: %s sözdizim bölgesi"
+msgstr "E399: Yetersiz sayıda argüman: %s sözdizim bölgesi"
msgid "E848: Too many syntax clusters"
msgstr "E848: Çok fazla sözdizim kümesi"
@@ -5396,7 +5411,7 @@ msgstr "E403: Sözdizim eşitlemesi: Satır devamları dizgisi iki kez tanımlan
#, c-format
msgid "E404: Illegal arguments: %s"
-msgstr "E404: İzin verilmeyen değişkenler: %s"
+msgstr "E404: İzin verilmeyen argümanlar: %s"
#, c-format
msgid "E405: Missing equal sign: %s"
@@ -5404,7 +5419,7 @@ msgstr "E405: Eşittir imi eksik: %s"
#, c-format
msgid "E406: Empty argument: %s"
-msgstr "E406: Boş değişken: %s"
+msgstr "E406: Boş argüman: %s"
#, c-format
msgid "E407: %s not allowed here"
@@ -5539,7 +5554,7 @@ msgid "E436: No \"%s\" entry in termcap"
msgstr "E436: termcap içinde \"%s\" girdisi yok"
msgid "E437: terminal capability \"cm\" required"
-msgstr "E437: \"cm\" uçbirim kabiliyeti gerekiyor"
+msgstr "E437: \"cm\" uçbirim yeteneği gerekiyor"
msgid ""
"\n"
@@ -5688,16 +5703,16 @@ msgstr "E914: Bir Kanal, Kayan Noktalı Değer yerine kullanılıyor"
msgid "E975: Using a Blob as a Float"
msgstr "E975: Bir İkili Geniş Nesne, Kayan Noktalı Değer yerine kullanılıyor"
-msgid "E729: using Funcref as a String"
+msgid "E729: Using a Funcref as a String"
msgstr "E729: Funcref bir Dizi yerine kullanılıyor"
-msgid "E730: using List as a String"
+msgid "E730: Using a List as a String"
msgstr "E730: Liste bir Dizi yerine kullanılıyor"
-msgid "E731: using Dictionary as a String"
+msgid "E731: Using a Dictionary as a String"
msgstr "E731: Sözlük bir Dizi yerine kullanılıyor"
-msgid "E976: using Blob as a String"
+msgid "E976: Using a Blob as a String"
msgstr "E976: İkili Geniş Nesne bir Dizi yerine kullanılıyor"
msgid "E977: Can only compare Blob with Blob"
@@ -5892,16 +5907,16 @@ msgid "E180: Invalid complete value: %s"
msgstr "E180: Geçersiz tam değer: %s"
msgid "E468: Completion argument only allowed for custom completion"
-msgstr "E468: Tamamlama değişkenine yalnızca özel tamamlamalarda izin verilir"
+msgstr "E468: Tamamlama argümanına yalnızca özel tamamlamalarda izin verilir"
msgid "E467: Custom completion requires a function argument"
-msgstr "E467: Özel tamamlama bir işlev değişkeni gerektirir"
+msgstr "E467: Özel tamamlama bir işlev argümanı gerektirir"
msgid "E175: No attribute specified"
msgstr "E175: Bir öznitelik belirtilmemiş"
msgid "E176: Invalid number of arguments"
-msgstr "E176: Geçersiz değişken sayısı"
+msgstr "E176: Geçersiz argüman sayısı"
msgid "E177: Count cannot be specified twice"
msgstr "E177: Sayım iki defa belirtilemez"
@@ -5910,10 +5925,10 @@ msgid "E178: Invalid default value for count"
msgstr "E178: Sayım için geçersiz öntanımlı değer"
msgid "E179: argument required for -complete"
-msgstr "E179: -complete için değişken gerekiyor"
+msgstr "E179: -complete için argüman gerekiyor"
msgid "E179: argument required for -addr"
-msgstr "E179: -addr için değişken gerekiyor"
+msgstr "E179: -addr için argüman gerekiyor"
#, c-format
msgid "E174: Command already exists: add ! to replace it: %s"
@@ -5948,14 +5963,21 @@ msgstr "E130: Bilinmeyen işlev: %s"
#, c-format
msgid "E125: Illegal argument: %s"
-msgstr "E125: İzin verilmeyen değişken: %s"
+msgstr "E125: İzin verilmeyen argüman: %s"
#, c-format
msgid "E853: Duplicate argument name: %s"
-msgstr "E853: Yinelenen değişken adı: %s"
+msgstr "E853: Yinelenen argüman adı: %s"
msgid "E989: Non-default argument follows default argument"
-msgstr "E989: Öntanımlı olmayan değişken öntanımlı değişkenden sonra"
+msgstr "E989: Öntanımlı olmayan argüman öntanımlı argümandan sonra"
+
+msgid "E126: Missing :endfunction"
+msgstr "E126: :endfunction eksik"
+
+#, c-format
+msgid "W22: Text found after :endfunction: %s"
+msgstr "W22: :endfunction sonrası metin bulundu: %s"
#, c-format
msgid "E451: Expected }: %s"
@@ -5963,11 +5985,11 @@ msgstr "E451: } bekleniyordu: %s"
#, c-format
msgid "E740: Too many arguments for function %s"
-msgstr "E740: %s işlevi için çok fazla değişken"
+msgstr "E740: %s işlevi için çok fazla argüman"
#, c-format
msgid "E116: Invalid arguments for function %s"
-msgstr "E116: %s işlevi için geçersiz değişkenler"
+msgstr "E116: %s işlevi için geçersiz argümanlar"
msgid "E132: Function call depth is higher than 'maxfuncdepth'"
msgstr "E132: İşlevin çağırdığı derinlik 'maxfuncdepth'ten daha yüksek"
@@ -5989,7 +6011,7 @@ msgid "%s returning %s"
msgstr "%s, %s döndürüyor"
msgid "E699: Too many arguments"
-msgstr "E699: Çok fazla değişken"
+msgstr "E699: Çok fazla argüman"
#, c-format
msgid "E276: Cannot use function as a method: %s"
@@ -6032,17 +6054,6 @@ msgstr "E862: g: burada kullanılamaz"
msgid "E932: Closure function should not be at top level: %s"
msgstr "E932: Kapatma işlevi en üst düzeyde olmamalıdır: %s"
-msgid "E126: Missing :endfunction"
-msgstr "E126: :endfunction eksik"
-
-#, c-format
-msgid "W1001: Text found after :enddef: %s"
-msgstr "W1001: :enddef sonrası metin bulundu: %s"
-
-#, c-format
-msgid "W22: Text found after :endfunction: %s"
-msgstr "W22: :endfunction sonrası metin bulundu: %s"
-
#, c-format
msgid "E707: Function name conflicts with variable: %s"
msgstr "E707: İşlev adı şu değişken ile çakışıyor: %s"
@@ -6605,6 +6616,55 @@ msgstr "gvimext.dll hatası"
msgid "Path length too long!"
msgstr "Yol çok uzun!"
+msgid "E10: \\ should be followed by /, ? or &"
+msgstr "E10: \\ sonrasında /, ? veya & gelmeli"
+
+msgid "E11: Invalid in command-line window; <CR> executes, CTRL-C quits"
+msgstr "E11: Komut satırı penceresinde geçersiz; <CR> çalıştırır, CTRL-C çıkar"
+
+msgid "E12: Command not allowed from exrc/vimrc in current dir or tag search"
+msgstr ""
+"E12: Geçerli dizin veya etiket aramasında exrc veya vimrc'den komutlara izin "
+"verilmiyor"
+
+msgid "E13: File exists (add ! to override)"
+msgstr "E13: Dosya mevcut (geçersiz kılmak için ! ekleyin)"
+
+#, c-format
+msgid "E15: Invalid expression: \"%s\""
+msgstr "E15: Geçersiz ifade: \"%s\""
+
+msgid "E16: Invalid range"
+msgstr "E16: Geçersiz erim"
+
+#, c-format
+msgid "E17: \"%s\" is a directory"
+msgstr "E17: \"%s\" bir dizin"
+
+msgid "E18: Unexpected characters in :let"
+msgstr "E18: :let içinde beklenmeyen karakter"
+
+msgid "E18: Unexpected characters in assignment"
+msgstr "E18: Atama içerisinde beklenmedik karakterler"
+
+msgid "E19: Mark has invalid line number"
+msgstr "E19: İm satır numarası geçersiz"
+
+msgid "E20: Mark not set"
+msgstr "E20: İm ayarlanmamış"
+
+msgid "E21: Cannot make changes, 'modifiable' is off"
+msgstr "E21: Değişiklik yapılamıyor, 'modifiable' kapalı"
+
+msgid "E22: Scripts nested too deep"
+msgstr "E22: Betikler çok iç içe geçmiş"
+
+msgid "E23: No alternate file"
+msgstr "E23: Başka bir dosya yok"
+
+msgid "E24: No such abbreviation"
+msgstr "E24: Böyle bir kısaltma yok"
+
#, c-format
msgid "E121: Undefined variable: %s"
msgstr "E121: Tanımlanmamış değişken: %s"
@@ -6613,6 +6673,9 @@ msgstr "E121: Tanımlanmamış değişken: %s"
msgid "E121: Undefined variable: %c:%s"
msgstr "E121: Tanımlanmamış değişken: %c:%s"
+msgid "E464: Ambiguous use of user-defined command"
+msgstr "E464: Kullanıcı tanımlı komutun belirsiz kullanımı"
+
msgid "E476: Invalid command"
msgstr "E476: Geçersiz komut"
@@ -6633,15 +6696,19 @@ msgid ""
"E856: \"assert_fails()\" second argument must be a string or a list with one "
"or two strings"
msgstr ""
-"E856: \"assert_fails()\" ikinci değişkeni bir dizi veya bir veya iki dizili "
+"E856: \"assert_fails()\" ikinci argüman bir dizi veya bir veya iki dizili "
"bir liste olmalıdır"
+#, c-format
+msgid "E908: using an invalid value as a String: %s"
+msgstr "E908: Geçersiz bir değer bir Dizi yerine kullanılıyor: %s"
+
msgid "E909: Cannot index a special variable"
msgstr "E909: Özel bir değişken dizinlenemiyor"
#, c-format
-msgid "E1100: Missing :var: %s"
-msgstr "E1100: :var eksik: %s"
+msgid "E1100: Command not supported in Vim9 script (missing :var?): %s"
+msgstr "E1100: Komut Vim9 betiğinde desteklenmiyor (:var? eksik): %s"
#, c-format
msgid "E1001: Variable not found: %s"
@@ -6655,18 +6722,18 @@ msgid "E1003: Missing return value"
msgstr "E1003: Dönüş değeri eksik"
#, c-format
-msgid "E1004: White space required before and after '%s'"
-msgstr "E1004: '%s' öncesinde ve sonrasında boşluk gerekiyor"
+msgid "E1004: White space required before and after '%s' at \"%s\""
+msgstr "E1004: Şu konumda '%s' öncesinde ve sonrasında boşluk gerekiyor: \"%s\""
msgid "E1005: Too many argument types"
-msgstr "E1005: Çok fazla değişken türü"
+msgstr "E1005: Çok fazla argüman türü"
#, c-format
msgid "E1006: %s is used as an argument"
-msgstr "E1006: %s bir değişken olarak kullanılıyor"
+msgstr "E1006: %s bir argüman olarak kullanılıyor"
msgid "E1007: Mandatory argument after optional argument"
-msgstr "E1007: İsteğe bağlı değişken sonrasında zorunlu değişken"
+msgstr "E1007: İsteğe bağlı argüman sonrasında zorunlu argüman"
msgid "E1008: Missing <type>"
msgstr "E1008: <tür> eksik"
@@ -6688,7 +6755,7 @@ msgstr "E1012: Tür uyumsuzluğu, %s bekleniyordu, ancak %s alındı"
#, c-format
msgid "E1013: Argument %d: type mismatch, expected %s but got %s"
-msgstr "E1013: %d değişkeni: Tür uyumsuzluğu, %s bekleniyordu, ancak %s alındı"
+msgstr "E1013: %d argümanı: Tür uyumsuzluğu, %s bekleniyordu, ancak %s alındı"
#, c-format
msgid "E1014: Invalid key: %s"
@@ -6728,8 +6795,8 @@ msgid "E1022: Type or initialization required"
msgstr "E1022: Tür veya ilklendirme gerekiyor"
#, c-format
-msgid "E1023: Using a Number as a Bool: %d"
-msgstr "E1023: Bir Sayı, bir Bool yerine kullanılıyor: %d"
+msgid "E1023: Using a Number as a Bool: %lld"
+msgstr "E1023: Bir Sayı, bir Boole yerine kullanılıyor: %lld"
msgid "E1024: Using a Number as a String"
msgstr "E1024: Bir Sayı, bir Dizi yerine kullanılıyor"
@@ -6768,11 +6835,11 @@ msgid "E1034: Cannot use reserved name %s"
msgstr "E1034: Ayrılmış ad %s kullanılamaz"
msgid "E1035: % requires number arguments"
-msgstr "E1035: %, sayı değişkenler gerektirir"
+msgstr "E1035: %, sayı argümanları gerektirir"
#, c-format
msgid "E1036: %c requires number or float arguments"
-msgstr "E1036: %c, sayı veya kayan noktalı değer değişkenler gerektirir"
+msgstr "E1036: %c, sayı veya kayan noktalı değer argümanları gerektirir"
#, c-format
msgid "E1037: Cannot use \"%s\" with %s"
@@ -6798,7 +6865,7 @@ msgid "E1043: Invalid command after :export"
msgstr "E1043: :export sonrası geçersiz komut"
msgid "E1044: Export with invalid argument"
-msgstr "E1044: Geçersiz değişkenle dışa aktarım"
+msgstr "E1044: Geçersiz argümanla dışa aktarım"
msgid "E1045: Missing \"as\" after *"
msgstr "E1045: * sonrası \"as\" eksik"
@@ -6817,11 +6884,12 @@ msgstr "E1048: Betikte öge bulunamadı: %s"
msgid "E1049: Item not exported in script: %s"
msgstr "E1049: Betikte öge dışa aktarılmadı: %s"
-msgid "E1050: Colon required before a range"
-msgstr "E1050: Bir erim öncesi iki nokta gerekiyor"
+#, c-format
+msgid "E1050: Colon required before a range: %s"
+msgstr "E1050: Bir erim öncesi iki nokta gerekiyor: %s"
msgid "E1051: Wrong argument type for +"
-msgstr "E1051: + için hatalı değişken türü"
+msgstr "E1051: + için hatalı argüman türü"
#, c-format
msgid "E1052: Cannot declare an option: %s"
@@ -6875,12 +6943,12 @@ msgid "E1067: Separator mismatch: %s"
msgstr "E1067: Ayırıcı uyumsuzluğu: %s"
#, c-format
-msgid "E1068: No white space allowed before '%s'"
-msgstr "E1068: '%s' önce boşluğa izin verilmiyor"
+msgid "E1068: No white space allowed before '%s': %s"
+msgstr "E1068: '%s' önce boşluğa izin verilmiyor: %s"
#, c-format
-msgid "E1069: White space required after '%s'"
-msgstr "E1069: '%s' sonrası boşluk gerekiyor"
+msgid "E1069: White space required after '%s': %s"
+msgstr "E1069: '%s' sonrası boşluk gerekiyor: %s"
msgid "E1070: Missing \"from\""
msgstr "E1070: \"from\" eksik"
@@ -6908,7 +6976,7 @@ msgstr "E1076: Bu Vim kayan noktalı değer desteği ile derlenmemiş"
#, c-format
msgid "E1077: Missing argument type for %s"
-msgstr "E1077: %s için değişken türü eksik"
+msgstr "E1077: %s için argüman türü eksik"
#, c-format
msgid "E1081: Cannot unlet %s"
@@ -6933,7 +7001,7 @@ msgid "E1086: Cannot use :function inside :def"
msgstr "E1086: :def içinde :function kullanılamaz"
msgid "E1087: Cannot use an index when declaring a variable"
-msgstr "E1087: Bir değişken tanımlarken indeks kullanılamaz"
+msgstr "E1087: Bir değişken tanımlarken dizinleme kullanılamaz"
#, c-format
msgid "E1089: Unknown variable: %s"
@@ -6941,7 +7009,7 @@ msgstr "E1089: Bilinmeyen değişken: %s"
#, c-format
msgid "E1090: Cannot assign to argument %s"
-msgstr "E1090: %s değişkenine atanamıyor"
+msgstr "E1090: %s argümanına atanamıyor"
#, c-format
msgid "E1091: Function is not compiled: %s"
@@ -6989,11 +7057,11 @@ msgid "E1105: Cannot convert %s to string"
msgstr "E1105: %s bir diziye dönüştürülemiyor"
msgid "E1106: One argument too many"
-msgstr "E1106: Bir değişken fazladan"
+msgstr "E1106: Bir argüman fazladan"
#, c-format
msgid "E1106: %d arguments too many"
-msgstr "E1106: %d değişken fazladan"
+msgstr "E1106: %d argüman fazladan"
msgid "E1107: String, List, Dict or Blob required"
msgstr "E1107: Dizi, Liste, Sözlük veya İkili Nesne gerekiyor"
@@ -7026,10 +7094,10 @@ msgid "E1114: Only values of 0x100 and higher supported"
msgstr "E1114: Yalnızca 0x100 ve daha yüksek değerler destekleniyor"
msgid "E1115: \"assert_fails()\" fourth argument must be a number"
-msgstr "E1115: \"assert_fails()\" dördüncü değişkeni bir sayı olmalıdır"
+msgstr "E1115: \"assert_fails()\" dördüncü argüman bir sayı olmalıdır"
msgid "E1116: \"assert_fails()\" fifth argument must be a string"
-msgstr "E1116: \"assert_fails()\" beşinci değişkeni bir dizi olmalıdır"
+msgstr "E1116: \"assert_fails()\" beşinci argüman bir dizi olmalıdır"
msgid "E1117: Cannot use ! with nested :def"
msgstr "E1117: !, iç içe geçmiş :def ile kullanılamaz"
@@ -7080,7 +7148,7 @@ msgid "E1131: Cannot add to null blob"
msgstr "E1131: Null ikili geniş nesnesine ekleme yapılamaz"
msgid "E1132: Missing function argument"
-msgstr "E1132: İşlev değişkeni eksik"
+msgstr "E1132: İşlev argümanı eksik"
msgid "E1133: Cannot extend a null dict"
msgstr "E1133: Bir null sözlük genişletilemez"
@@ -7108,12 +7176,259 @@ msgstr "E1138: Bir Boole, Sayı yerine kullanılıyor"
msgid "E1139: Missing matching bracket after dict key"
msgstr "E1139: Sözlük anahtarı sonrası eşleşen ayraç eksik"
-msgid "E1140: For argument must be a sequence of lists"
-msgstr "E1140: For değişkeni listelerin bir sıralaması olmalıdır"
+msgid "E1140: :for argument must be a sequence of lists"
+msgstr "E1140: :for argümanı listelerin bir sıralaması olmalıdır"
msgid "E1141: Indexable type required"
msgstr "E1141: İndekslenebilir tür gerekiyor"
+msgid "E1142: Non-empty string required"
+msgstr "E1142: Boş olmayan dizi gerekiyor"
+
+#, c-format
+msgid "E1143: Empty expression: \"%s\""
+msgstr "E1143: Boş ifade: \"%s\""
+
+#, c-format
+msgid "E1144: Command \"%s\" is not followed by white space: %s"
+msgstr "E1144: \"%s\" komutu sonrasında boşluk gelmiyor: %s"
+
+#, c-format
+msgid "E1145: Missing heredoc end marker: %s"
+msgstr "E1145: Son imleyicisi eksik: %s"
+
+#, c-format
+msgid "E1146: Command not recognized: %s"
+msgstr "E1146: Komut tanınamadı: %s"
+
+msgid "E1147: List not set"
+msgstr "E1147: Liste ayarlanmamış"
+
+#, c-format
+msgid "E1148: Cannot index a %s"
+msgstr "E1148: Bir %s dizinlenemiyor"
+
+#, c-format
+msgid "E1149: Script variable is invalid after reload in function %s"
+msgstr "E1149: %s işlevindeki yeniden yüklemeden sonra betik değişkeni geçersiz"
+
+msgid "E1150: Script variable type changed"
+msgstr "E1150: Betik değişkeni türü değiştirildi"
+
+msgid "E1151: Mismatched endfunction"
+msgstr "E1151: Eşleşmeyen endfunction"
+
+msgid "E1152: Mismatched enddef"
+msgstr "E1152: Eşleşmeyen enddef"
+
+msgid "E1153: Invalid operation for bool"
+msgstr "E1153: Boole için geçersiz işlem"
+
+msgid "E1154: Divide by zero"
+msgstr "E1154: Sıfır ile bölüm"
+
+msgid "E1155: Cannot define autocommands for ALL events"
+msgstr "E1155: Otokomutlar TÜM olaylar için tanımlanamıyor"
+
+msgid "E1156: Cannot change the argument list recursively"
+msgstr "E1156: Değişken listesi özyineli olarak değiştirilemiyor"
+
+msgid "E1157: Missing return type"
+msgstr "E1157: Dönüş türü eksik"
+
+msgid "E1158: Cannot use flatten() in Vim9 script"
+msgstr "E1158: flatten(), Vim9 betiğinde kullanılamaz"
+
+msgid "E1159: Cannot split a window when closing the buffer"
+msgstr "E1159: Arabellek kapatılırken bir pencere bölünemez"
+
+msgid "E1160: Cannot use a default for variable arguments"
+msgstr "E1160: Değişken argümanları için bir öntanımlı kullanılamaz"
+
+#, c-format
+msgid "E1161: Cannot json encode a %s"
+msgstr "E1161: Bir %s JSON olarak kodlanamıyor"
+
+#, c-format
+msgid "E1162: Register name must be one character: %s"
+msgstr "E1162: Yazmaç adı tek bir karakter olmalıdır: %s"
+
+#, c-format
+msgid "E1163: Variable %d: type mismatch, expected %s but got %s"
+msgstr "E1163: %d değişkeni: Tür uyumsuzluğu, %s bekleniyordu, ancak %s alındı"
+
+msgid "E1164: vim9cmd must be followed by a command"
+msgstr "E1164: vim9cmd sonrasında bir komut gelmelidir"
+
+#, c-format
+msgid "E1165: Cannot use a range with an assignment: %s"
+msgstr "E1165: Bir atama ile bir erim kullanılamıyor: %s"
+
+msgid "E1166: Cannot use a range with a dictionary"
+msgstr "E1166: Bir sözlük ile bir erim kullanılamıyor"
+
+#, c-format
+msgid "E1167: Argument name shadows existing variable: %s"
+msgstr "E1167: Argüman adı var olan değişkeni gölgeliyor: %s"
+
+#, c-format
+msgid "E1168: Argument already declared in the script: %s"
+msgstr "E1168: Betikte argüman halihazırda tanımlanmış: %s"
+
+msgid "E1169: 'import * as {name}' not supported here"
+msgstr "E1169: 'import * as {name} burada desteklenmiyor"
+
+msgid "E1170: Cannot use #{ to start a comment"
+msgstr "E1170: Bir yorum başlatmak için #{ kullanılamaz"
+
+msgid "E1171: Missing } after inline function"
+msgstr "E1171: Satıriçi işlevden sonra } eksik"
+
+msgid "E1172: Cannot use default values in a lambda"
+msgstr "E1172: Bir lambda içerisinde öntanımlı değerler kullanılamıyor"
+
+#, c-format
+msgid "E1173: Text found after enddef: %s"
+msgstr "E1173: :enddef sonrası metin bulundu: %s"
+
+#, c-format
+msgid "E1174: String required for argument %d"
+msgstr "E1174: %d argümanı için dizi gerekiyor"
+
+#, c-format
+msgid "E1175: Non-empty string required for argument %d"
+msgstr "E1175: %d argümanı için boş olmayan dizi gerekiyor"
+
+msgid "E1176: Misplaced command modifier"
+msgstr "E1176: Yanlış yere konulmuş komut değiştiricisi"
+
+#, c-format
+msgid "E1177: For loop on %s not supported"
+msgstr "E1177: %s üzerinde for döngüsü desteklenmiyor"
+
+msgid "E1178: Cannot lock or unlock a local variable"
+msgstr "E1178: Bir yerel değişken kilitlenemiyor/kilidi açılamıyor"
+
+#, c-format
+msgid ""
+"E1179: Failed to extract PWD from %s, check your shell's config related to "
+"OSC 7"
+msgstr ""
+"E1179: %s içinden PWD çıkarılamadı, kabuğunuzun OSC 7 ile ilgili "
+"yapılandırmasını denetleyin"
+
+#, c-format
+msgid "E1180: Variable arguments type must be a list: %s"
+msgstr "E1180: Değişken argümanları türü bir liste olmalıdır: %s"
+
+msgid "E1181: Cannot use an underscore here"
+msgstr "E1181: Alt çizgi burada kullanılamaz"
+
+msgid "E1182: Blob required"
+msgstr "E1182: İkili geniş nesne gerekiyor"
+
+#, c-format
+msgid "E1183: Cannot use a range with an assignment operator: %s"
+msgstr "E1183: Bir atama işleci ile bir erim kullanılamıyor: %s"
+
+msgid "E1184: Blob not set"
+msgstr "E1184: İkili geniş nesne ayarlanmamış"
+
+msgid "E1185: Cannot nest :redir"
+msgstr "E1185: :redir içe geçirilemiyor"
+
+msgid "E1185: Missing :redir END"
+msgstr "E1185: :redir END eksik"
+
+#, c-format
+msgid "E1186: Expression does not result in a value: %s"
+msgstr "E1186: İfade bir değer sonucu vermiyor: %s"
+
+msgid "E1187: Failed to source defaults.vim"
+msgstr "E1187: defaults.vim kaynaklanamadı"
+
+msgid "E1188: Cannot open a terminal from the command line window"
+msgstr "E1188: Komut satırı penceresinden bir uçbirim açılamıyor"
+
+#, c-format
+msgid "E1189: Cannot use :legacy with this command: %s"
+msgstr "E1189: :legacy, bu komut ile kullanılamıyor: %s"
+
+msgid "E1190: One argument too few"
+msgstr "E1190: Bir argüman daha gerekiyor"
+
+#, c-format
+msgid "E1190: %d arguments too few"
+msgstr "E1190: %d argüman daha gerekiyor"
+
+#, c-format
+msgid "E1191: Call to function that failed to compile: %s"
+msgstr "E1191: Derlenemeyen işlev çağrısı: %s"
+
+msgid "E1192: Empty function name"
+msgstr "E1192: Boş işlev adı"
+
+msgid "E1193: cryptmethod xchacha20 not built into this Vim"
+msgstr "E1193: cryptmethod xchacha20 bu Vim ile kullanılamıyor"
+
+msgid "E1194: Cannot encrypt header, not enough space"
+msgstr "E1194: Üstbilgi şifrelenemiyor, yetersiz alan"
+
+msgid "E1195: Cannot encrypt buffer, not enough space"
+msgstr "E1195: Arabellek şifrelenemiyor, yetersiz alan"
+
+msgid "E1196: Cannot decrypt header, not enough space"
+msgstr "E1196: Üstbilgi şifresi çözülemiyor, yetersiz alan"
+
+msgid "E1197: Cannot allocate_buffer for encryption"
+msgstr "E1197: Şifreleme için allocate_buffer yapılamıyor"
+
+msgid "E1198: Decryption failed: Header incomplete!"
+msgstr "E1198: Şifre çözümü başarısız: Üstbilgi tam değil!"
+
+msgid "E1199: Cannot decrypt buffer, not enough space"
+msgstr "E1199: Arabellek şifresi çözülemiyor, yetersiz alan"
+
+msgid "E1200: Decryption failed!"
+msgstr "E1200: Şifre çözümü başarısız!"
+
+msgid "E1201: Decryption failed: pre-mature end of file!"
+msgstr "E1201: Şifre çözümü başarısız: Beklenmedik dosya sonu!"
+
+#, c-format
+msgid "E1202: No white space allowed after '%s': %s"
+msgstr "E1202: '%s' sonrası boşluğa izin verilmiyor: %s"
+
+#, c-format
+msgid "E1203: Dot can only be used on a dictionary: %s"
+msgstr "E1203: Nokta yalnızca bir sözlükte kullanılabilir: %s"
+
+#, c-format
+msgid "E1204: No Number allowed after .: '\\%%%c'"
+msgstr "E1204: . sonrası Sayıya izin verilmiyor: '\\%%%c'"
+
+msgid "E1205: No white space allowed between option and"
+msgstr "E1205: and seçeneği arasında boşluğa izin verilmiyor"
+
+#, c-format
+msgid "E1206: Dictionary required for argument %d"
+msgstr "E1206: %d argümanı için sözlük gerekiyor"
+
+#, c-format
+msgid "E1207: Expression without an effect: %s"
+msgstr "E1207: Bir efekt olmadan ifade: %s"
+
+msgid "E1208: -complete used without -nargs"
+msgstr "E1208: -complete, -nargs olmadan kullanıldı"
+
+#, c-format
+msgid "E1209: Invalid value for a line number: \"%s\""
+msgstr "E1209: Satır numarası için geçersiz değer: \"%s\""
+
+#, c-format
+msgid "E1210: Number required for argument %d"
+msgstr "E1210: %d argümanı için sayı gerekiyor"
+
msgid "--No lines in buffer--"
msgstr "--Arabellek içinde satır yok--"
@@ -7123,17 +7438,6 @@ msgstr "E470: Komut durduruldu"
msgid "E471: Argument required"
msgstr "E471: Değişken gerekiyor"
-msgid "E10: \\ should be followed by /, ? or &"
-msgstr "E10: \\ sonrasında /, ? veya & gelmeli"
-
-msgid "E11: Invalid in command-line window; <CR> executes, CTRL-C quits"
-msgstr "E11: Komut satırı penceresinde geçersiz; <CR> çalıştırır, CTRL-C çıkar"
-
-msgid "E12: Command not allowed from exrc/vimrc in current dir or tag search"
-msgstr ""
-"E12: Geçerli dizin veya etiket aramasında exrc veya vimrc'den komutlara izin "
-"verilmiyor"
-
msgid "E171: Missing :endif"
msgstr "E171: :endif eksik"
@@ -7164,9 +7468,6 @@ msgstr "E588: :while olmadan :endwhile"
msgid "E588: :endfor without :for"
msgstr "E588: :for olmadan :endfor"
-msgid "E13: File exists (add ! to override)"
-msgstr "E13: Dosya mevcut (geçersiz kılmak için ! ekleyin)"
-
msgid "E472: Command failed"
msgstr "E472: Komut başarısız oldu"
@@ -7193,34 +7494,23 @@ msgid "Interrupted"
msgstr "Yarıda kesildi"
msgid "E474: Invalid argument"
-msgstr "E474: Geçersiz değişken"
+msgstr "E474: Geçersiz argüman"
#, c-format
msgid "E475: Invalid argument: %s"
-msgstr "E475: Geçersiz değişken: %s"
+msgstr "E475: Geçersiz argüman: %s"
#, c-format
msgid "E983: Duplicate argument: %s"
-msgstr "E983: Yinelenen değişken: %s"
+msgstr "E983: Yinelenen argüman: %s"
#, c-format
msgid "E475: Invalid value for argument %s"
-msgstr "E475: %s değişkeni için geçersiz değer"
+msgstr "E475: %s argümanı için geçersiz değer"
#, c-format
msgid "E475: Invalid value for argument %s: %s"
-msgstr "E475: %s değişkeni için geçersiz değer: %s"
-
-#, c-format
-msgid "E15: Invalid expression: %s"
-msgstr "E15: Geçersiz ifade: %s"
-
-msgid "E16: Invalid range"
-msgstr "E16: Geçersiz erim"
-
-#, c-format
-msgid "E17: \"%s\" is a directory"
-msgstr "E17: \"%s\" bir dizin"
+msgstr "E475: %s argümanı için geçersiz değer: %s"
msgid "E756: Spell checking is not possible"
msgstr "E756: Yazım denetimi olanaklı değil"
@@ -7236,24 +7526,6 @@ msgstr "E667: Fsync başarısız oldu"
msgid "E448: Could not load library function %s"
msgstr "E448: %s kitaplık işlevi yüklenemedi"
-msgid "E19: Mark has invalid line number"
-msgstr "E19: İm satır numarası geçersiz"
-
-msgid "E20: Mark not set"
-msgstr "E20: İm ayarlanmamış"
-
-msgid "E21: Cannot make changes, 'modifiable' is off"
-msgstr "E21: Değişiklik yapılamıyor, 'modifiable' kapalı"
-
-msgid "E22: Scripts nested too deep"
-msgstr "E22: Betikler çok iç içe geçmiş"
-
-msgid "E23: No alternate file"
-msgstr "E23: Başka bir dosya yok"
-
-msgid "E24: No such abbreviation"
-msgstr "E24: Böyle bir kısaltma yok"
-
msgid "E477: No ! allowed"
msgstr "E477: ! imine izin verilmiyor"
@@ -7327,7 +7599,7 @@ msgid "E485: Can't read file %s"
msgstr "E485: %s dosyası okunamıyor"
msgid "E38: Null argument"
-msgstr "E38: Anlamsız değişken"
+msgstr "E38: Anlamsız argüman"
msgid "E39: Number expected"
msgstr "E39: Sayı bekleniyordu"
@@ -7392,6 +7664,9 @@ msgstr "E794: Değişken kum havuzunda ayarlanamıyor: \"%s\""
msgid "E928: String required"
msgstr "E928: Dizi gerekiyor"
+msgid "E889: Number required"
+msgstr "E889: Sayı gerekiyor"
+
msgid "E713: Cannot use empty key for Dictionary"
msgstr "E713: Sözlük için boş anahtar kullanılamaz"
@@ -7411,11 +7686,11 @@ msgstr "E978: İkili geniş nesne için geçersiz işlem"
#, c-format
msgid "E118: Too many arguments for function: %s"
-msgstr "E118: İşlev için çok fazla değişken: %s"
+msgstr "E118: İşlev için çok fazla argüman: %s"
#, c-format
msgid "E119: Not enough arguments for function: %s"
-msgstr "E119: Şu işlev için yetersiz sayıda değişken: %s"
+msgstr "E119: Şu işlev için yetersiz sayıda argüman: %s"
#, c-format
msgid "E933: Function was deleted: %s"
@@ -7437,18 +7712,15 @@ msgstr "E697: Liste sonunda ']' eksik: %s"
#, c-format
msgid "E712: Argument of %s must be a List or Dictionary"
-msgstr "E712: %s ögesinin değişkeni bir liste veya sözlük olmalıdır"
+msgstr "E712: %s ögesinin argümanı bir liste veya sözlük olmalıdır"
#, c-format
msgid "E896: Argument of %s must be a List, Dictionary or Blob"
-msgstr "E896: %s değişkeni bir liste, sözlük veya ikili geniş nesne olmalıdır"
+msgstr "E896: %s argümanı bir liste, sözlük veya ikili geniş nesne olmalıdır"
msgid "E804: Cannot use '%' with Float"
msgstr "E804: Bir kayan noktalı değer ile '%' kullanılamaz"
-msgid "E908: using an invalid value as a String"
-msgstr "E908: Geçersiz bir değer bir Dizi yerine kullanılıyor"
-
msgid "E996: Cannot lock an option"
msgstr "E996: Seçenek kilitlenemiyor"
@@ -7456,9 +7728,6 @@ msgstr "E996: Seçenek kilitlenemiyor"
msgid "E113: Unknown option: %s"
msgstr "E113: Bilinmeyen seçenek: %s"
-msgid "E18: Unexpected characters in :let"
-msgstr "E18: :let içinde beklenmeyen karakter"
-
#, c-format
msgid "E998: Reduce of an empty %s with no initial value"
msgstr "E998: Başlangıç değeri olmayan boş bir %s için reduce() yapılamıyor"
@@ -7616,7 +7885,7 @@ msgstr "E957: Geçersiz pencere numarası"
#, c-format
msgid "E686: Argument of %s must be a List"
-msgstr "E686: %s değişkeni bir liste olmalı"
+msgstr "E686: %s argümanı bir liste olmalı"
msgid "E109: Missing ':' after '?'"
msgstr "E109: '?' sonrası ':' eksik"
@@ -7685,7 +7954,7 @@ msgstr "'%s' anahtarı sözlüğe eklenemedi"
#, c-format
msgid "index must be int or slice, not %s"
-msgstr "dizin bir tamsayı veya dilim olmalıdır, %s olamaz"
+msgstr "sıra bir tamsayı veya dilim olmalıdır, %s olamaz"
#, c-format
msgid "expected str() or unicode() instance, but got %s"
@@ -7762,10 +8031,10 @@ msgid "expected sequence element of size 2, but got sequence of size %d"
msgstr "2 boyut bir sıralama bekleniyordu, ancak %d boyut bir sıralama geldi"
msgid "list constructor does not accept keyword arguments"
-msgstr "liste yapıcısı anahtar sözcük değişkenleri kabul etmez"
+msgstr "liste yapıcısı anahtar sözcük argümanları kabul etmez"
msgid "list index out of range"
-msgstr "liste dizini erimin dışında"
+msgstr "liste sırası erimin dışında"
#, c-format
msgid "internal error: failed to get Vim list item %d"
@@ -8013,8 +8282,7 @@ msgstr ""
"düzenleyebilirsiniz."
msgid "\" Hit <Enter> on a help line to open a help window on this option."
-msgstr ""
-"\" Yardım penceresini açmak için seçenek adı üzerinde <Enter>'a basın."
+msgstr "\" Yardım penceresini açmak için seçenek adı üzerinde <Enter>'a basın."
msgid "\" Hit <Enter> on an index line to jump there."
msgstr ""
@@ -8056,7 +8324,8 @@ msgid "moving around, searching and patterns"
msgstr "dolaşma, arama ve dizgeler"
msgid "list of flags specifying which commands wrap to another line"
-msgstr "hangi komutların diğer satıra kaydırıldığını belirleyen bayraklar\n"
+msgstr ""
+"hangi komutların diğer satıra kaydırıldığını belirleyen bayraklar\n"
"listesi"
msgid ""
@@ -8081,6 +8350,9 @@ msgstr ":cd için kullanılan dizin adları listesi"
msgid "change to directory of file in buffer"
msgstr "arabellekteki dosyanın olduğu dizine değiştir"
+msgid "change to pwd of shell in terminal buffer"
+msgstr "uçbirim arabelleğindeki kabuğun pwd'sine geç"
+
msgid "search commands wrap around the end of the buffer"
msgstr "arama komutları, arabelleğin sonunda kaydırılır"
@@ -8320,7 +8592,8 @@ msgid "multiple windows"
msgstr "çoklu pencereler"
msgid "0, 1 or 2; when to use a status line for the last window"
-msgstr "0, 1 veya 2; son pencere için ne zaman bir durum satırı\n"
+msgstr ""
+"0, 1 veya 2; son pencere için ne zaman bir durum satırı\n"
"kullanılacağı"
msgid "alternate format to be used for a status line"
@@ -8382,7 +8655,8 @@ msgid "this window scrolls together with other bound windows"
msgstr "bu pencere, bağlı diğer pencerelerle birlikte kayar"
msgid "\"ver\", \"hor\" and/or \"jump\"; list of options for 'scrollbind'"
-msgstr "\"ver\", \"hor\" ve/veya \"jump\"; 'scrollbind' için seçenekler listesi"
+msgstr ""
+"\"ver\", \"hor\" ve/veya \"jump\"; 'scrollbind' için seçenekler listesi"
msgid "this window's cursor moves together with other bound windows"
msgstr "bu pencerenin imleci bağlı diğer pencerelerle birlikte kayar"
@@ -8394,7 +8668,8 @@ msgid "key that precedes Vim commands in a terminal window"
msgstr "bir uçbirim penceresinde Vim komutlarından önce gelen düğme"
msgid "max number of lines to keep for scrollback in a terminal window"
-msgstr "bir uçbirim penceresinde geri kaydırma için kullanılacak\n"
+msgstr ""
+"bir uçbirim penceresinde geri kaydırma için kullanılacak\n"
"en çok satır sayısı"
msgid "type of pty to use for a terminal window"
@@ -8522,8 +8797,7 @@ msgid "list of flags that specify how the GUI works"
msgstr "grafik arabirimin nice çalıştığını belirleyen bayraklar listesi"
msgid "\"icons\", \"text\" and/or \"tooltips\"; how to show the toolbar"
-msgstr ""
-"\"icons\", \"text\" ve/veya \"tooltips\"; araç çubuğu kipleri "
+msgstr "\"icons\", \"text\" ve/veya \"tooltips\"; araç çubuğu kipleri "
msgid "size of toolbar icons"
msgstr "araç çubuğu simgelerinin boyutu"
@@ -8679,7 +8953,8 @@ msgid "list of directories for undo files"
msgstr "geri al dosyaları için dizinler listesi"
msgid "maximum number lines to save for undo on a buffer reload"
-msgstr "arabellek yeniden yüklemesinde geri al için kaydedilecek\n"
+msgstr ""
+"arabellek yeniden yüklemesinde geri al için kaydedilecek\n"
"en çok satır sayısı"
msgid "changes have been made and not written to a file"
@@ -8704,7 +8979,8 @@ msgid "definition of what comment lines look like"
msgstr "yorum satırlarının nice görüneceğinin tanımı"
msgid "list of flags that tell how automatic formatting works"
-msgstr "kendiliğinden biçimlendirmenin nice çalıştığını anlatan\n"
+msgstr ""
+"kendiliğinden biçimlendirmenin nice çalıştığını anlatan\n"
"bayraklar listesi"
msgid "pattern to recognize a numbered list"
@@ -8714,7 +8990,8 @@ msgid "expression used for \"gq\" to format lines"
msgstr "satırları biçimlendirmek için \"gq\" için kullanılan ifade"
msgid "specifies how Insert mode completion works for CTRL-N and CTRL-P"
-msgstr "Ekleme kipi tamamlamasının CTRL-N ve CTRL-P için nice çalıştığını\n"
+msgstr ""
+"Ekleme kipi tamamlamasının CTRL-N ve CTRL-P için nice çalıştığını\n"
"belirler"
msgid "whether to use a popup menu for Insert mode completion"
@@ -8739,7 +9016,8 @@ msgid "list of dictionary files for keyword completion"
msgstr "anahtar sözcük tamamlaması için sözlük dosyaları listesi"
msgid "list of thesaurus files for keyword completion"
-msgstr "anahtar sözcük tamamlaması için eşanlamlılar sözlüğü dosyaları\n"
+msgstr ""
+"anahtar sözcük tamamlaması için eşanlamlılar sözlüğü dosyaları\n"
"listesi"
msgid "adjust case of a keyword completion match"
@@ -8883,7 +9161,8 @@ msgid "markers used when 'foldmethod' is \"marker\""
msgstr "'foldmethod' \"marker\" olduğunda kullanılan imleyiciler"
msgid "maximum fold depth for when 'foldmethod' is \"indent\" or \"syntax\""
-msgstr "'foldmethod' \"indent\" veya \"syntax\" olduğunda kullanılan en çok\n"
+msgstr ""
+"'foldmethod' \"indent\" veya \"syntax\" olduğunda kullanılan en çok\n"
"kıvırma derinliği"
msgid "diff mode"
@@ -9013,7 +9292,8 @@ msgid "use a swap file for this buffer"
msgstr "bu arabellek için bir takas dosyası kullan"
msgid "\"sync\", \"fsync\" or empty; how to flush a swap file to disk"
-msgstr "\"sync\", \"fsync\", veya boş; bir takas dosyasının diske\n"
+msgstr ""
+"\"sync\", \"fsync\", veya boş; bir takas dosyasının diske\n"
"nice floşlanacağı"
msgid "number of characters typed to cause a swap file update"
@@ -9089,13 +9369,14 @@ msgid "characters to escape when 'shellxquote' is ("
msgstr "'shellxquote' ( iken kaçırılacak karakterler"
msgid "argument for 'shell' to execute a command"
-msgstr "bir komut çalıştırmak için 'shell' için değişken"
+msgstr "bir komut çalıştırmak için 'shell' için argüman"
msgid "used to redirect command output to a file"
msgstr "komut çıktısını bir dosyaya yeniden yönlendirmek için kullanılır"
msgid "use a temp file for shell commands instead of using a pipe"
-msgstr "bir veri yolu kullanımı yerine kabuk komutları için geçici\n"
+msgstr ""
+"bir veri yolu kullanımı yerine kabuk komutları için geçici\n"
"bir dosya kullan"
msgid "program used for \"=\" command"
@@ -9108,7 +9389,8 @@ msgid "program used for the \"K\" command"
msgstr "\"K\" komutu için kullanılan program"
msgid "warn when using a shell command and a buffer has changes"
-msgstr "bir kabuk komutu kullanılıyorsa ve arabellekte değişiklikler\n"
+msgstr ""
+"bir kabuk komutu kullanılıyorsa ve arabellekte değişiklikler\n"
"varsa uyar"
msgid "running make and jumping to errors (quickfix)"
@@ -9124,7 +9406,8 @@ msgid "program used for the \":make\" command"
msgstr "\":make\" komutu için kullanılan program"
msgid "string used to put the output of \":make\" in the error file"
-msgstr "\":make\" komutunun çıktısını hata dosyasına koymak için\n"
+msgstr ""
+"\":make\" komutunun çıktısını hata dosyasına koymak için\n"
"kullanılan dizi"
msgid "name of the errorfile for the 'makeprg' command"
@@ -9179,7 +9462,8 @@ msgid "insert characters backwards"
msgstr "karakterleri geriye doğru ekle"
msgid "allow CTRL-_ in Insert and Command-line mode to toggle 'revins'"
-msgstr "'revins' açıp kapatmak için Ekleme ve Komut Satırı kipinde\n"
+msgstr ""
+"'revins' açıp kapatmak için Ekleme ve Komut Satırı kipinde\n"
"CTRL-_ izin ver"
msgid "the ASCII code for the first letter of the Hebrew alphabet"
@@ -9210,8 +9494,9 @@ msgid "apply 'langmap' to mapped characters"
msgstr "eşlemlenen karakterlere 'langmap' uygula"
msgid "when set never use IM; overrules following IM options"
-msgstr "ayarlandığında hiçbir zaman IM kullanma; aşağıdaki IM seçeneklerini "
-"geçersiz kılar"
+msgstr ""
+"ayarlandığında hiçbir zaman IM kullanma; aşağıdaki IM seçeneklerini geçersiz "
+"kılar"
msgid "in Insert mode: 1: use :lmap; 2: use IM; 0: neither"
msgstr "Ekleme kipinde: 1: :lmap kullan; 2; IM kullan; 0: hiçbiri"
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index e5d4752760..77d2b21a7a 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -9,13 +9,12 @@
#include <ctype.h>
#include <inttypes.h>
#include <stdbool.h>
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
-#include "nvim/vim.h"
-#include "nvim/ascii.h"
#include "nvim/api/private/helpers.h"
-#include "nvim/syntax.h"
+#include "nvim/ascii.h"
+#include "nvim/buffer.h"
#include "nvim/charset.h"
#include "nvim/cursor_shape.h"
#include "nvim/eval.h"
@@ -23,30 +22,31 @@
#include "nvim/ex_docmd.h"
#include "nvim/fileio.h"
#include "nvim/fold.h"
+#include "nvim/garray.h"
#include "nvim/hashtab.h"
#include "nvim/highlight.h"
#include "nvim/indent_c.h"
+#include "nvim/keymap.h"
+#include "nvim/macros.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
-#include "nvim/keymap.h"
-#include "nvim/garray.h"
#include "nvim/option.h"
+#include "nvim/os/os.h"
+#include "nvim/os/time.h"
#include "nvim/os_unix.h"
#include "nvim/path.h"
-#include "nvim/macros.h"
#include "nvim/regexp.h"
#include "nvim/screen.h"
#include "nvim/sign.h"
#include "nvim/strings.h"
+#include "nvim/syntax.h"
#include "nvim/syntax_defs.h"
#include "nvim/terminal.h"
#include "nvim/ui.h"
-#include "nvim/os/os.h"
-#include "nvim/os/time.h"
-#include "nvim/buffer.h"
+#include "nvim/vim.h"
static bool did_syntax_onoff = false;
@@ -54,8 +54,8 @@ static bool did_syntax_onoff = false;
/// The ID of a highlight group is also called group ID. It is the index in
/// the highlight_ga array PLUS ONE.
typedef struct hl_group {
- char_u *sg_name; ///< highlight group name
- char *sg_name_u; ///< uppercase of sg_name
+ char_u *sg_name; ///< highlight group name
+ char *sg_name_u; ///< uppercase of sg_name
bool sg_cleared; ///< "hi clear" was used
int sg_attr; ///< Screen attr @see ATTR_ENTRY
int sg_link; ///< link to this highlight group ID
@@ -98,22 +98,22 @@ static inline struct hl_group * HL_TABLE(void)
return ((struct hl_group *)((highlight_ga.ga_data)));
}
-#define MAX_HL_ID 20000 /* maximum value for a highlight ID. */
+#define MAX_HL_ID 20000 // maximum value for a highlight ID.
-/* different types of offsets that are possible */
-#define SPO_MS_OFF 0 /* match start offset */
-#define SPO_ME_OFF 1 /* match end offset */
-#define SPO_HS_OFF 2 /* highl. start offset */
-#define SPO_HE_OFF 3 /* highl. end offset */
-#define SPO_RS_OFF 4 /* region start offset */
-#define SPO_RE_OFF 5 /* region end offset */
-#define SPO_LC_OFF 6 /* leading context offset */
+// different types of offsets that are possible
+#define SPO_MS_OFF 0 // match start offset
+#define SPO_ME_OFF 1 // match end offset
+#define SPO_HS_OFF 2 // highl. start offset
+#define SPO_HE_OFF 3 // highl. end offset
+#define SPO_RS_OFF 4 // region start offset
+#define SPO_RE_OFF 5 // region end offset
+#define SPO_LC_OFF 6 // leading context offset
#define SPO_COUNT 7
-/* Flags to indicate an additional string for highlight name completion. */
-static int include_none = 0; /* when 1 include "nvim/None" */
-static int include_default = 0; /* when 1 include "nvim/default" */
-static int include_link = 0; /* when 2 include "nvim/link" and "clear" */
+// Flags to indicate an additional string for highlight name completion.
+static int include_none = 0; // when 1 include "nvim/None"
+static int include_default = 0; // when 1 include "nvim/default"
+static int include_link = 0; // when 2 include "nvim/link" and "clear"
/// The "term", "cterm" and "gui" arguments can be any combination of the
/// following names, separated by commas (but no spaces!).
@@ -215,12 +215,12 @@ typedef struct {
proftime_T slowest;
proftime_T average;
int id;
- char_u *pattern;
+ char_u *pattern;
} time_entry_T;
struct name_list {
int flag;
- char *name;
+ char *name;
};
#ifdef INCLUDE_GENERATED_DECLARATIONS
@@ -228,40 +228,40 @@ struct name_list {
#endif
static char *(spo_name_tab[SPO_COUNT]) =
-{"ms=", "me=", "hs=", "he=", "rs=", "re=", "lc="};
+{ "ms=", "me=", "hs=", "he=", "rs=", "re=", "lc=" };
/* The sp_off_flags are computed like this:
* offset from the start of the matched text: (1 << SPO_XX_OFF)
- * offset from the end of the matched text: (1 << (SPO_XX_OFF + SPO_COUNT))
+ * offset from the end of the matched text: (1 << (SPO_XX_OFF + SPO_COUNT))
* When both are present, only one is used.
*/
-#define SPTYPE_MATCH 1 /* match keyword with this group ID */
-#define SPTYPE_START 2 /* match a regexp, start of item */
-#define SPTYPE_END 3 /* match a regexp, end of item */
-#define SPTYPE_SKIP 4 /* match a regexp, skip within item */
+#define SPTYPE_MATCH 1 // match keyword with this group ID
+#define SPTYPE_START 2 // match a regexp, start of item
+#define SPTYPE_END 3 // match a regexp, end of item
+#define SPTYPE_SKIP 4 // match a regexp, skip within item
#define SYN_ITEMS(buf) ((synpat_T *)((buf)->b_syn_patterns.ga_data))
-#define NONE_IDX -2 /* value of sp_sync_idx for "NONE" */
+#define NONE_IDX -2 // value of sp_sync_idx for "NONE"
/*
* Flags for b_syn_sync_flags:
*/
-#define SF_CCOMMENT 0x01 /* sync on a C-style comment */
-#define SF_MATCH 0x02 /* sync by matching a pattern */
+#define SF_CCOMMENT 0x01 // sync on a C-style comment
+#define SF_MATCH 0x02 // sync by matching a pattern
#define SYN_STATE_P(ssp) ((bufstate_T *)((ssp)->ga_data))
-#define MAXKEYWLEN 80 /* maximum length of a keyword */
+#define MAXKEYWLEN 80 // maximum length of a keyword
/*
* The attributes of the syntax item that has been recognized.
*/
-static int current_attr = 0; /* attr of current syntax word */
-static int current_id = 0; /* ID of current char for syn_get_id() */
-static int current_trans_id = 0; /* idem, transparency removed */
+static int current_attr = 0; // attr of current syntax word
+static int current_id = 0; // ID of current char for syn_get_id()
+static int current_trans_id = 0; // idem, transparency removed
static int current_flags = 0;
static int current_seqnr = 0;
static int current_sub_char = 0;
@@ -269,9 +269,9 @@ static int current_sub_char = 0;
/*
* Methods of combining two clusters
*/
-#define CLUSTER_REPLACE 1 /* replace first list with second */
-#define CLUSTER_ADD 2 /* add second list to first */
-#define CLUSTER_SUBTRACT 3 /* subtract second list from first */
+#define CLUSTER_REPLACE 1 // replace first list with second
+#define CLUSTER_ADD 2 // add second list to first
+#define CLUSTER_SUBTRACT 3 // subtract second list from first
#define SYN_CLSTR(buf) ((syn_cluster_T *)((buf)->b_syn_clusters.ga_data))
@@ -283,12 +283,12 @@ static int current_sub_char = 0;
* 22000 - 22999 CONTAINED indicator (current_syn_inc_tag added)
* 23000 - 32767 cluster IDs (subtract SYNID_CLUSTER for the cluster ID)
*/
-#define SYNID_ALLBUT MAX_HL_ID /* syntax group ID for contains=ALLBUT */
-#define SYNID_TOP 21000 /* syntax group ID for contains=TOP */
-#define SYNID_CONTAINED 22000 /* syntax group ID for contains=CONTAINED */
-#define SYNID_CLUSTER 23000 /* first syntax group ID for clusters */
+#define SYNID_ALLBUT MAX_HL_ID // syntax group ID for contains=ALLBUT
+#define SYNID_TOP 21000 // syntax group ID for contains=TOP
+#define SYNID_CONTAINED 22000 // syntax group ID for contains=CONTAINED
+#define SYNID_CLUSTER 23000 // first syntax group ID for clusters
-#define MAX_SYN_INC_TAG 999 /* maximum before the above overflow */
+#define MAX_SYN_INC_TAG 999 // maximum before the above overflow
#define MAX_CLUSTER_ID (32767 - SYNID_CLUSTER)
/*
@@ -334,7 +334,7 @@ static char msg_no_items[] = N_("No Syntax items defined for this buffer");
// valid of si_cont_list for containing all but contained groups
#define ID_LIST_ALL (int16_t *)-1
-static int next_seqnr = 1; /* value to use for si_seqnr */
+static int next_seqnr = 1; // value to use for si_seqnr
/*
* The next possible match in the current line for any pattern is remembered,
@@ -343,15 +343,15 @@ static int next_seqnr = 1; /* value to use for si_seqnr */
* If next_match_col == MAXCOL, no match found in this line.
* (All end positions have the column of the char after the end)
*/
-static int next_match_col; /* column for start of next match */
-static lpos_T next_match_m_endpos; /* position for end of next match */
-static lpos_T next_match_h_startpos; /* pos. for highl. start of next match */
-static lpos_T next_match_h_endpos; /* pos. for highl. end of next match */
-static int next_match_idx; /* index of matched item */
-static long next_match_flags; /* flags for next match */
-static lpos_T next_match_eos_pos; /* end of start pattn (start region) */
-static lpos_T next_match_eoe_pos; /* pos. for end of end pattern */
-static int next_match_end_idx; /* ID of group for end pattn or zero */
+static int next_match_col; // column for start of next match
+static lpos_T next_match_m_endpos; // position for end of next match
+static lpos_T next_match_h_startpos; // pos. for highl. start of next match
+static lpos_T next_match_h_endpos; // pos. for highl. end of next match
+static int next_match_idx; // index of matched item
+static long next_match_flags; // flags for next match
+static lpos_T next_match_eos_pos; // end of start pattn (start region)
+static lpos_T next_match_eoe_pos; // pos. for end of end pattern
+static int next_match_end_idx; // ID of group for end pattn or zero
static reg_extmatch_T *next_match_extmatch = NULL;
/*
@@ -365,8 +365,8 @@ static reg_extmatch_T *next_match_extmatch = NULL;
* The current state (within the line) of the recognition engine.
* When current_state.ga_itemsize is 0 the current state is invalid.
*/
-static win_T *syn_win; // current window for highlighting
-static buf_T *syn_buf; // current buffer for highlighting
+static win_T *syn_win; // current window for highlighting
+static buf_T *syn_buf; // current buffer for highlighting
static synblock_T *syn_block; // current buffer for highlighting
static proftime_T *syn_tm; // timeout limit
static linenr_T current_lnum = 0; // lnum of current state
@@ -396,19 +396,19 @@ void syn_set_timeout(proftime_T *tm)
* Start the syntax recognition for a line. This function is normally called
* from the screen updating, once for each displayed line.
* The buffer is remembered in syn_buf, because get_syntax_attr() doesn't get
- * it. Careful: curbuf and curwin are likely to point to another buffer and
+ * it. Careful: curbuf and curwin are likely to point to another buffer and
* window.
*/
void syntax_start(win_T *wp, linenr_T lnum)
{
- synstate_T *p;
- synstate_T *last_valid = NULL;
- synstate_T *last_min_valid = NULL;
- synstate_T *sp, *prev = NULL;
+ synstate_T *p;
+ synstate_T *last_valid = NULL;
+ synstate_T *last_min_valid = NULL;
+ synstate_T *sp, *prev = NULL;
linenr_T parsed_lnum;
linenr_T first_stored;
int dist;
- static int changedtick = 0; /* remember the last change ID */
+ static int changedtick = 0; // remember the last change ID
current_sub_char = NUL;
@@ -431,8 +431,9 @@ void syntax_start(win_T *wp, linenr_T lnum)
* Allocate syntax stack when needed.
*/
syn_stack_alloc();
- if (syn_block->b_sst_array == NULL)
- return; /* out of memory */
+ if (syn_block->b_sst_array == NULL) {
+ return; // out of memory
+ }
syn_block->b_sst_lasttick = display_tick;
/*
@@ -452,29 +453,33 @@ void syntax_start(win_T *wp, linenr_T lnum)
* state (this happens very often!). Otherwise invalidate
* current_state and figure it out below.
*/
- if (current_lnum != lnum)
+ if (current_lnum != lnum) {
invalidate_current_state();
- } else
+ }
+ } else {
invalidate_current_state();
+ }
/*
* Try to synchronize from a saved state in b_sst_array[].
* Only do this if lnum is not before and not to far beyond a saved state.
*/
if (INVALID_STATE(&current_state) && syn_block->b_sst_array != NULL) {
- /* Find last valid saved state before start_lnum. */
+ // Find last valid saved state before start_lnum.
for (p = syn_block->b_sst_first; p != NULL; p = p->sst_next) {
if (p->sst_lnum > lnum) {
break;
}
if (p->sst_change_lnum == 0) {
last_valid = p;
- if (p->sst_lnum >= lnum - syn_block->b_syn_sync_minlines)
+ if (p->sst_lnum >= lnum - syn_block->b_syn_sync_minlines) {
last_min_valid = p;
+ }
}
}
- if (last_min_valid != NULL)
+ if (last_min_valid != NULL) {
load_current_state(last_min_valid);
+ }
}
/*
@@ -483,24 +488,27 @@ void syntax_start(win_T *wp, linenr_T lnum)
*/
if (INVALID_STATE(&current_state)) {
syn_sync(wp, lnum, last_valid);
- if (current_lnum == 1)
- /* First line is always valid, no matter "minlines". */
+ if (current_lnum == 1) {
+ // First line is always valid, no matter "minlines".
first_stored = 1;
- else
+ } else {
/* Need to parse "minlines" lines before state can be considered
* valid to store. */
first_stored = current_lnum + syn_block->b_syn_sync_minlines;
- } else
+ }
+ } else {
first_stored = current_lnum;
+ }
/*
* Advance from the sync point or saved state until the current line.
* Save some entries for syncing with later on.
*/
- if (syn_block->b_sst_len <= Rows)
+ if (syn_block->b_sst_len <= Rows) {
dist = 999999;
- else
+ } else {
dist = syn_buf->b_ml.ml_line_count / (syn_block->b_sst_len - Rows) + 1;
+ }
while (current_lnum < lnum) {
syn_start_line();
(void)syn_finish_line(false);
@@ -512,26 +520,30 @@ void syntax_start(win_T *wp, linenr_T lnum)
/* Check if the saved state entry is for the current line and is
* equal to the current state. If so, then validate all saved
* states that depended on a change before the parsed line. */
- if (prev == NULL)
+ if (prev == NULL) {
prev = syn_stack_find_entry(current_lnum - 1);
- if (prev == NULL)
+ }
+ if (prev == NULL) {
sp = syn_block->b_sst_first;
- else
+ } else {
sp = prev;
- while (sp != NULL && sp->sst_lnum < current_lnum)
+ }
+ while (sp != NULL && sp->sst_lnum < current_lnum) {
sp = sp->sst_next;
+ }
if (sp != NULL
&& sp->sst_lnum == current_lnum
&& syn_stack_equal(sp)) {
parsed_lnum = current_lnum;
prev = sp;
while (sp != NULL && sp->sst_change_lnum <= parsed_lnum) {
- if (sp->sst_lnum <= lnum)
- /* valid state before desired line, use this one */
+ if (sp->sst_lnum <= lnum) {
+ // valid state before desired line, use this one
prev = sp;
- else if (sp->sst_change_lnum == 0)
- /* past saved states depending on change, break here. */
+ } else if (sp->sst_change_lnum == 0) {
+ // past saved states depending on change, break here.
break;
+ }
sp->sst_change_lnum = 0;
sp = sp->sst_next;
}
@@ -542,8 +554,9 @@ void syntax_start(win_T *wp, linenr_T lnum)
* saved state. But only when parsed at least 'minlines'. */
else if (prev == NULL
|| current_lnum == lnum
- || current_lnum >= prev->sst_lnum + dist)
+ || current_lnum >= prev->sst_lnum + dist) {
prev = store_current_state();
+ }
}
/* This can take a long time: break when CTRL-C pressed. The current
@@ -594,8 +607,8 @@ static void clear_current_state(void)
*/
static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
{
- buf_T *curbuf_save;
- win_T *curwin_save;
+ buf_T *curbuf_save;
+ win_T *curwin_save;
pos_T cursor_save;
int idx;
linenr_T lnum;
@@ -603,8 +616,8 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
linenr_T break_lnum;
bool had_sync_point;
stateitem_T *cur_si;
- synpat_T *spp;
- char_u *line;
+ synpat_T *spp;
+ char_u *line;
int found_flags = 0;
int found_match_idx = 0;
linenr_T found_current_lnum = 0;
@@ -625,22 +638,25 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
* where N is minlines * 1.5, or minlines * 2 if minlines is small.
* Watch out for overflow when minlines is MAXLNUM.
*/
- if (syn_block->b_syn_sync_minlines > start_lnum)
+ if (syn_block->b_syn_sync_minlines > start_lnum) {
start_lnum = 1;
- else {
- if (syn_block->b_syn_sync_minlines == 1)
+ } else {
+ if (syn_block->b_syn_sync_minlines == 1) {
lnum = 1;
- else if (syn_block->b_syn_sync_minlines < 10)
+ } else if (syn_block->b_syn_sync_minlines < 10) {
lnum = syn_block->b_syn_sync_minlines * 2;
- else
+ } else {
lnum = syn_block->b_syn_sync_minlines * 3 / 2;
+ }
if (syn_block->b_syn_sync_maxlines != 0
- && lnum > syn_block->b_syn_sync_maxlines)
+ && lnum > syn_block->b_syn_sync_maxlines) {
lnum = syn_block->b_syn_sync_maxlines;
- if (lnum >= start_lnum)
+ }
+ if (lnum >= start_lnum) {
start_lnum = 1;
- else
+ } else {
start_lnum -= lnum;
+ }
}
current_lnum = start_lnum;
@@ -660,12 +676,13 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
*/
for (; start_lnum > 1; --start_lnum) {
line = ml_get(start_lnum - 1);
- if (*line == NUL || *(line + STRLEN(line) - 1) != '\\')
+ if (*line == NUL || *(line + STRLEN(line) - 1) != '\\') {
break;
+ }
}
current_lnum = start_lnum;
- /* set cursor to start of search */
+ // set cursor to start of search
cursor_save = wp->w_cursor;
wp->w_cursor.lnum = start_lnum;
wp->w_cursor.col = 0;
@@ -676,7 +693,7 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
* Restrict the search for the end of a comment to b_syn_sync_maxlines.
*/
if (find_start_comment((int)syn_block->b_syn_sync_maxlines) != NULL) {
- for (idx = syn_block->b_syn_patterns.ga_len; --idx >= 0; )
+ for (idx = syn_block->b_syn_patterns.ga_len; --idx >= 0; ) {
if (SYN_ITEMS(syn_block)[idx].sp_syn.id
== syn_block->b_syn_sync_id
&& SYN_ITEMS(syn_block)[idx].sp_type == SPTYPE_START) {
@@ -685,9 +702,10 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
update_si_attr(current_state.ga_len - 1);
break;
}
+ }
}
- /* restore cursor and buffer */
+ // restore cursor and buffer
wp->w_cursor = cursor_save;
curwin = curwin_save;
curbuf = curbuf_save;
@@ -697,17 +715,18 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
*/
else if (syn_block->b_syn_sync_flags & SF_MATCH) {
if (syn_block->b_syn_sync_maxlines != 0
- && start_lnum > syn_block->b_syn_sync_maxlines)
+ && start_lnum > syn_block->b_syn_sync_maxlines) {
break_lnum = start_lnum - syn_block->b_syn_sync_maxlines;
- else
+ } else {
break_lnum = 0;
+ }
found_m_endpos.lnum = 0;
found_m_endpos.col = 0;
end_lnum = start_lnum;
lnum = start_lnum;
while (--lnum > break_lnum) {
- /* This can take a long time: break when CTRL-C pressed. */
+ // This can take a long time: break when CTRL-C pressed.
line_breakcheck();
if (got_int) {
invalidate_current_state();
@@ -715,7 +734,7 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
break;
}
- /* Check if we have run into a valid saved state stack now. */
+ // Check if we have run into a valid saved state stack now.
if (last_valid != NULL && lnum == last_valid->sst_lnum) {
load_current_state(last_valid);
break;
@@ -724,8 +743,9 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
/*
* Check if the previous line has the line-continuation pattern.
*/
- if (lnum > 1 && syn_match_linecont(lnum - 1))
+ if (lnum > 1 && syn_match_linecont(lnum - 1)) {
continue;
+ }
/*
* Start with nothing on the state stack
@@ -741,12 +761,12 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
if (had_sync_point && current_state.ga_len) {
cur_si = &CUR_STATE(current_state.ga_len - 1);
if (cur_si->si_m_endpos.lnum > start_lnum) {
- /* ignore match that goes to after where started */
+ // ignore match that goes to after where started
current_lnum = end_lnum;
break;
}
if (cur_si->si_idx < 0) {
- /* Cannot happen? */
+ // Cannot happen?
found_flags = 0;
found_match_idx = KEYWORD_IDX;
} else {
@@ -764,23 +784,27 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
if (found_m_endpos.lnum > current_lnum) {
current_lnum = found_m_endpos.lnum;
current_col = found_m_endpos.col;
- if (current_lnum >= end_lnum)
+ if (current_lnum >= end_lnum) {
break;
- } else if (found_m_endpos.col > current_col)
+ }
+ } else if (found_m_endpos.col > current_col) {
current_col = found_m_endpos.col;
- else
+ } else {
++current_col;
+ }
/* syn_current_attr() will have skipped the check for
* an item that ends here, need to do that now. Be
* careful not to go past the NUL. */
prev_current_col = current_col;
- if (syn_getcurline()[current_col] != NUL)
+ if (syn_getcurline()[current_col] != NUL) {
++current_col;
+ }
check_state_ends();
current_col = prev_current_col;
- } else
+ } else {
break;
+ }
}
}
@@ -828,7 +852,7 @@ static void syn_sync(win_T *wp, linenr_T start_lnum, synstate_T *last_valid)
invalidate_current_state();
}
- /* Ran into start of the file or exceeded maximum number of lines */
+ // Ran into start of the file or exceeded maximum number of lines
if (lnum <= break_lnum) {
invalidate_current_state();
current_lnum = break_lnum + 1;
@@ -934,10 +958,13 @@ static void syn_update_ends(bool startofline)
* Then check for items ending in column 0.
*/
int i = current_state.ga_len - 1;
- if (keepend_level >= 0)
- for (; i > keepend_level; --i)
- if (CUR_STATE(i).si_flags & HL_EXTEND)
+ if (keepend_level >= 0) {
+ for (; i > keepend_level; --i) {
+ if (CUR_STATE(i).si_flags & HL_EXTEND) {
break;
+ }
+ }
+ }
bool seen_keepend = false;
for (; i < current_state.ga_len; i++) {
@@ -945,11 +972,12 @@ static void syn_update_ends(bool startofline)
if ((cur_si->si_flags & HL_KEEPEND)
|| (seen_keepend && !startofline)
|| (i == current_state.ga_len - 1 && startofline)) {
- cur_si->si_h_startpos.col = 0; /* start highl. in col 0 */
+ cur_si->si_h_startpos.col = 0; // start highl. in col 0
cur_si->si_h_startpos.lnum = current_lnum;
- if (!(cur_si->si_flags & HL_MATCHCONT))
+ if (!(cur_si->si_flags & HL_MATCHCONT)) {
update_si_end(cur_si, (int)current_col, !startofline);
+ }
if (!startofline && (cur_si->si_flags & HL_KEEPEND)) {
seen_keepend = true;
@@ -997,7 +1025,7 @@ static void syn_update_ends(bool startofline)
static void syn_stack_free_block(synblock_T *block)
{
- synstate_T *p;
+ synstate_T *p;
if (block->b_sst_array != NULL) {
for (p = block->b_sst_first; p != NULL; p = p->sst_next) {
@@ -1016,7 +1044,7 @@ void syn_stack_free_all(synblock_T *block)
{
syn_stack_free_block(block);
- /* When using "syntax" fold method, must update all folds. */
+ // When using "syntax" fold method, must update all folds.
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
if (wp->w_s == block && foldmethodIsSyntax(wp)) {
foldUpdateAll(wp);
@@ -1033,31 +1061,35 @@ void syn_stack_free_all(synblock_T *block)
static void syn_stack_alloc(void)
{
long len;
- synstate_T *to, *from;
- synstate_T *sstp;
+ synstate_T *to, *from;
+ synstate_T *sstp;
len = syn_buf->b_ml.ml_line_count / SST_DIST + Rows * 2;
- if (len < SST_MIN_ENTRIES)
+ if (len < SST_MIN_ENTRIES) {
len = SST_MIN_ENTRIES;
- else if (len > SST_MAX_ENTRIES)
+ } else if (len > SST_MAX_ENTRIES) {
len = SST_MAX_ENTRIES;
+ }
if (syn_block->b_sst_len > len * 2 || syn_block->b_sst_len < len) {
- /* Allocate 50% too much, to avoid reallocating too often. */
+ // Allocate 50% too much, to avoid reallocating too often.
len = syn_buf->b_ml.ml_line_count;
len = (len + len / 2) / SST_DIST + Rows * 2;
- if (len < SST_MIN_ENTRIES)
+ if (len < SST_MIN_ENTRIES) {
len = SST_MIN_ENTRIES;
- else if (len > SST_MAX_ENTRIES)
+ } else if (len > SST_MAX_ENTRIES) {
len = SST_MAX_ENTRIES;
+ }
if (syn_block->b_sst_array != NULL) {
/* When shrinking the array, cleanup the existing stack.
* Make sure that all valid entries fit in the new array. */
while (syn_block->b_sst_len - syn_block->b_sst_freecount + 2 > len
- && syn_stack_cleanup())
+ && syn_stack_cleanup()) {
;
- if (len < syn_block->b_sst_len - syn_block->b_sst_freecount + 2)
+ }
+ if (len < syn_block->b_sst_len - syn_block->b_sst_freecount + 2) {
len = syn_block->b_sst_len - syn_block->b_sst_freecount + 2;
+ }
}
assert(len >= 0);
@@ -1065,7 +1097,7 @@ static void syn_stack_alloc(void)
to = sstp - 1;
if (syn_block->b_sst_array != NULL) {
- /* Move the states from the old array to the new one. */
+ // Move the states from the old array to the new one.
for (from = syn_block->b_sst_first; from != NULL;
from = from->sst_next) {
++to;
@@ -1082,10 +1114,11 @@ static void syn_stack_alloc(void)
syn_block->b_sst_freecount = len;
}
- /* Create the list of free entries. */
+ // Create the list of free entries.
syn_block->b_sst_firstfree = to + 1;
- while (++to < sstp + len)
+ while (++to < sstp + len) {
to->sst_next = to + 1;
+ }
(sstp + len - 1)->sst_next = NULL;
xfree(syn_block->b_sst_array);
@@ -1113,7 +1146,7 @@ void syn_stack_apply_changes(buf_T *buf)
static void syn_stack_apply_changes_block(synblock_T *block, buf_T *buf)
{
- synstate_T *p, *prev, *np;
+ synstate_T *p, *prev, *np;
linenr_T n;
prev = NULL;
@@ -1121,12 +1154,13 @@ static void syn_stack_apply_changes_block(synblock_T *block, buf_T *buf)
if (p->sst_lnum + block->b_syn_sync_linebreaks > buf->b_mod_top) {
n = p->sst_lnum + buf->b_mod_xlines;
if (n <= buf->b_mod_bot) {
- /* this state is inside the changed area, remove it */
+ // this state is inside the changed area, remove it
np = p->sst_next;
- if (prev == NULL)
+ if (prev == NULL) {
block->b_sst_first = np;
- else
+ } else {
prev->sst_next = np;
+ }
syn_stack_free_entry(block, p);
p = np;
continue;
@@ -1135,14 +1169,16 @@ static void syn_stack_apply_changes_block(synblock_T *block, buf_T *buf)
* that needs to be parsed before this entry can be made valid
* again. */
if (p->sst_change_lnum != 0 && p->sst_change_lnum > buf->b_mod_top) {
- if (p->sst_change_lnum + buf->b_mod_xlines > buf->b_mod_top)
+ if (p->sst_change_lnum + buf->b_mod_xlines > buf->b_mod_top) {
p->sst_change_lnum += buf->b_mod_xlines;
- else
+ } else {
p->sst_change_lnum = buf->b_mod_top;
+ }
}
if (p->sst_change_lnum == 0
- || p->sst_change_lnum < buf->b_mod_bot)
+ || p->sst_change_lnum < buf->b_mod_bot) {
p->sst_change_lnum = buf->b_mod_bot;
+ }
p->sst_lnum = n;
}
@@ -1156,7 +1192,7 @@ static void syn_stack_apply_changes_block(synblock_T *block, buf_T *buf)
/// @return true if at least one entry was freed.
static bool syn_stack_cleanup(void)
{
- synstate_T *p, *prev;
+ synstate_T *p, *prev;
disptick_T tick;
int dist;
bool retval = false;
@@ -1165,11 +1201,12 @@ static bool syn_stack_cleanup(void)
return retval;
}
- /* Compute normal distance between non-displayed entries. */
- if (syn_block->b_sst_len <= Rows)
+ // Compute normal distance between non-displayed entries.
+ if (syn_block->b_sst_len <= Rows) {
dist = 999999;
- else
+ } else {
dist = syn_buf->b_ml.ml_line_count / (syn_block->b_sst_len - Rows) + 1;
+ }
/*
* Go through the list to find the "tick" for the oldest entry that can
@@ -1182,8 +1219,9 @@ static bool syn_stack_cleanup(void)
for (p = prev->sst_next; p != NULL; prev = p, p = p->sst_next) {
if (prev->sst_lnum + dist > p->sst_lnum) {
if (p->sst_tick > syn_block->b_sst_lasttick) {
- if (!above || p->sst_tick < tick)
+ if (!above || p->sst_tick < tick) {
tick = p->sst_tick;
+ }
above = true;
} else if (!above && p->sst_tick < tick) {
tick = p->sst_tick;
@@ -1198,7 +1236,7 @@ static bool syn_stack_cleanup(void)
prev = syn_block->b_sst_first;
for (p = prev->sst_next; p != NULL; prev = p, p = p->sst_next) {
if (p->sst_tick == tick && prev->sst_lnum + dist > p->sst_lnum) {
- /* Move this entry from used list to free list */
+ // Move this entry from used list to free list
prev->sst_next = p->sst_next;
syn_stack_free_entry(syn_block, p);
p = prev;
@@ -1226,14 +1264,16 @@ static void syn_stack_free_entry(synblock_T *block, synstate_T *p)
*/
static synstate_T *syn_stack_find_entry(linenr_T lnum)
{
- synstate_T *p, *prev;
+ synstate_T *p, *prev;
prev = NULL;
for (p = syn_block->b_sst_first; p != NULL; prev = p, p = p->sst_next) {
- if (p->sst_lnum == lnum)
+ if (p->sst_lnum == lnum) {
return p;
- if (p->sst_lnum > lnum)
+ }
+ if (p->sst_lnum > lnum) {
break;
+ }
}
return prev;
}
@@ -1245,10 +1285,10 @@ static synstate_T *syn_stack_find_entry(linenr_T lnum)
static synstate_T *store_current_state(void)
{
int i;
- synstate_T *p;
- bufstate_T *bp;
+ synstate_T *p;
+ bufstate_T *bp;
stateitem_T *cur_si;
- synstate_T *sp = syn_stack_find_entry(current_lnum);
+ synstate_T *sp = syn_stack_find_entry(current_lnum);
/*
* If the current state contains a start or end pattern that continues
@@ -1260,51 +1300,55 @@ static synstate_T *store_current_state(void)
|| cur_si->si_m_endpos.lnum >= current_lnum
|| cur_si->si_h_endpos.lnum >= current_lnum
|| (cur_si->si_end_idx
- && cur_si->si_eoe_pos.lnum >= current_lnum))
+ && cur_si->si_eoe_pos.lnum >= current_lnum)) {
break;
+ }
}
if (i >= 0) {
if (sp != NULL) {
- /* find "sp" in the list and remove it */
- if (syn_block->b_sst_first == sp)
- /* it's the first entry */
+ // find "sp" in the list and remove it
+ if (syn_block->b_sst_first == sp) {
+ // it's the first entry
syn_block->b_sst_first = sp->sst_next;
- else {
- /* find the entry just before this one to adjust sst_next */
- for (p = syn_block->b_sst_first; p != NULL; p = p->sst_next)
- if (p->sst_next == sp)
+ } else {
+ // find the entry just before this one to adjust sst_next
+ for (p = syn_block->b_sst_first; p != NULL; p = p->sst_next) {
+ if (p->sst_next == sp) {
break;
- if (p != NULL) /* just in case */
+ }
+ }
+ if (p != NULL) { // just in case
p->sst_next = sp->sst_next;
+ }
}
syn_stack_free_entry(syn_block, sp);
sp = NULL;
}
- } else if (sp == NULL || sp->sst_lnum != current_lnum) {
+ } else if (sp == NULL || sp->sst_lnum != current_lnum) {
/*
* Add a new entry
*/
- /* If no free items, cleanup the array first. */
+ // If no free items, cleanup the array first.
if (syn_block->b_sst_freecount == 0) {
(void)syn_stack_cleanup();
- /* "sp" may have been moved to the freelist now */
+ // "sp" may have been moved to the freelist now
sp = syn_stack_find_entry(current_lnum);
}
- /* Still no free items? Must be a strange problem... */
- if (syn_block->b_sst_freecount == 0)
+ // Still no free items? Must be a strange problem...
+ if (syn_block->b_sst_freecount == 0) {
sp = NULL;
- else {
+ } else {
/* Take the first item from the free list and put it in the used
* list, after *sp */
p = syn_block->b_sst_firstfree;
syn_block->b_sst_firstfree = p->sst_next;
--syn_block->b_sst_freecount;
if (sp == NULL) {
- /* Insert in front of the list */
+ // Insert in front of the list
p->sst_next = syn_block->b_sst_first;
syn_block->b_sst_first = p;
} else {
- /* insert in list after *sp */
+ // insert in list after *sp
p->sst_next = sp->sst_next;
sp->sst_next = p;
}
@@ -1314,7 +1358,7 @@ static synstate_T *store_current_state(void)
}
}
if (sp != NULL) {
- /* When overwriting an existing state stack, clear it first */
+ // When overwriting an existing state stack, clear it first
clear_syn_state(sp);
sp->sst_stacksize = current_state.ga_len;
if (current_state.ga_len > SST_FIX_STATES) {
@@ -1324,8 +1368,9 @@ static synstate_T *store_current_state(void)
ga_grow(&sp->sst_union.sst_ga, current_state.ga_len);
sp->sst_union.sst_ga.ga_len = current_state.ga_len;
bp = SYN_STATE_P(&(sp->sst_union.sst_ga));
- } else
+ } else {
bp = sp->sst_union.sst_stack;
+ }
for (i = 0; i < sp->sst_stacksize; ++i) {
bp[i].bs_idx = CUR_STATE(i).si_idx;
bp[i].bs_flags = CUR_STATE(i).si_flags;
@@ -1348,32 +1393,35 @@ static synstate_T *store_current_state(void)
static void load_current_state(synstate_T *from)
{
int i;
- bufstate_T *bp;
+ bufstate_T *bp;
clear_current_state();
validate_current_state();
keepend_level = -1;
if (from->sst_stacksize) {
ga_grow(&current_state, from->sst_stacksize);
- if (from->sst_stacksize > SST_FIX_STATES)
+ if (from->sst_stacksize > SST_FIX_STATES) {
bp = SYN_STATE_P(&(from->sst_union.sst_ga));
- else
+ } else {
bp = from->sst_union.sst_stack;
+ }
for (i = 0; i < from->sst_stacksize; ++i) {
CUR_STATE(i).si_idx = bp[i].bs_idx;
CUR_STATE(i).si_flags = bp[i].bs_flags;
CUR_STATE(i).si_seqnr = bp[i].bs_seqnr;
CUR_STATE(i).si_cchar = bp[i].bs_cchar;
CUR_STATE(i).si_extmatch = ref_extmatch(bp[i].bs_extmatch);
- if (keepend_level < 0 && (CUR_STATE(i).si_flags & HL_KEEPEND))
+ if (keepend_level < 0 && (CUR_STATE(i).si_flags & HL_KEEPEND)) {
keepend_level = i;
+ }
CUR_STATE(i).si_ends = FALSE;
CUR_STATE(i).si_m_lnum = 0;
- if (CUR_STATE(i).si_idx >= 0)
+ if (CUR_STATE(i).si_idx >= 0) {
CUR_STATE(i).si_next_list =
(SYN_ITEMS(syn_block)[CUR_STATE(i).si_idx]).sp_next_list;
- else
+ } else {
CUR_STATE(i).si_next_list = NULL;
+ }
update_si_attr(i);
}
current_state.ga_len = from->sst_stacksize;
@@ -1388,26 +1436,28 @@ static void load_current_state(synstate_T *from)
/// @return true when they are equal.
static bool syn_stack_equal(synstate_T *sp)
{
- bufstate_T *bp;
- reg_extmatch_T *six, *bsx;
+ bufstate_T *bp;
+ reg_extmatch_T *six, *bsx;
- /* First a quick check if the stacks have the same size end nextlist. */
+ // First a quick check if the stacks have the same size end nextlist.
if (sp->sst_stacksize != current_state.ga_len
|| sp->sst_next_list != current_next_list) {
return false;
}
- /* Need to compare all states on both stacks. */
- if (sp->sst_stacksize > SST_FIX_STATES)
+ // Need to compare all states on both stacks.
+ if (sp->sst_stacksize > SST_FIX_STATES) {
bp = SYN_STATE_P(&(sp->sst_union.sst_ga));
- else
+ } else {
bp = sp->sst_union.sst_stack;
+ }
int i;
for (i = current_state.ga_len; --i >= 0; ) {
- /* If the item has another index the state is different. */
- if (bp[i].bs_idx != CUR_STATE(i).si_idx)
+ // If the item has another index the state is different.
+ if (bp[i].bs_idx != CUR_STATE(i).si_idx) {
break;
+ }
if (bp[i].bs_extmatch == CUR_STATE(i).si_extmatch) {
continue;
}
@@ -1418,8 +1468,9 @@ static bool syn_stack_equal(synstate_T *sp)
six = CUR_STATE(i).si_extmatch;
/* If one of the extmatch pointers is NULL the states are
* different. */
- if (bsx == NULL || six == NULL)
+ if (bsx == NULL || six == NULL) {
break;
+ }
int j;
for (j = 0; j < NSUBEXP; ++j) {
/* Check each referenced match string. They must all be
@@ -1438,8 +1489,9 @@ static bool syn_stack_equal(synstate_T *sp)
}
}
}
- if (j != NSUBEXP)
+ if (j != NSUBEXP) {
break;
+ }
}
if (i < 0) {
return true;
@@ -1453,21 +1505,23 @@ static bool syn_stack_equal(synstate_T *sp)
* this line depended on a change before it, it now depends on the line below
* the last parsed line.
* The window looks like this:
- * line which changed
- * displayed line
- * displayed line
+ * line which changed
+ * displayed line
+ * displayed line
* lnum -> line below window
*/
void syntax_end_parsing(linenr_T lnum)
{
- synstate_T *sp;
+ synstate_T *sp;
sp = syn_stack_find_entry(lnum);
- if (sp != NULL && sp->sst_lnum < lnum)
+ if (sp != NULL && sp->sst_lnum < lnum) {
sp = sp->sst_next;
+ }
- if (sp != NULL && sp->sst_change_lnum != 0)
+ if (sp != NULL && sp->sst_change_lnum != 0) {
sp->sst_change_lnum = lnum;
+ }
}
/*
@@ -1477,7 +1531,7 @@ void syntax_end_parsing(linenr_T lnum)
static void invalidate_current_state(void)
{
clear_current_state();
- current_state.ga_itemsize = 0; /* mark current_state invalid */
+ current_state.ga_itemsize = 0; // mark current_state invalid
current_next_list = NULL;
keepend_level = -1;
}
@@ -1495,7 +1549,7 @@ static void validate_current_state(void)
bool syntax_check_changed(linenr_T lnum)
{
bool retval = true;
- synstate_T *sp;
+ synstate_T *sp;
/*
* Check the state stack when:
@@ -1532,16 +1586,13 @@ bool syntax_check_changed(linenr_T lnum)
return retval;
}
-/*
- * Finish the current line.
- * This doesn't return any attributes, it only gets the state at the end of
- * the line. It can start anywhere in the line, as long as the current state
- * is valid.
- */
-static bool
-syn_finish_line(
- const bool syncing // called for syncing
-)
+/// Finish the current line.
+/// This doesn't return any attributes, it only gets the state at the end of
+/// the line. It can start anywhere in the line, as long as the current state
+/// is valid.
+///
+/// @param syncing called for syncing
+static bool syn_finish_line(const bool syncing)
{
while (!current_finished) {
(void)syn_current_attr(syncing, false, NULL, false);
@@ -1571,36 +1622,35 @@ syn_finish_line(
return false;
}
-/*
- * Return highlight attributes for next character.
- * Must first call syntax_start() once for the line.
- * "col" is normally 0 for the first use in a line, and increments by one each
- * time. It's allowed to skip characters and to stop before the end of the
- * line. But only a "col" after a previously used column is allowed.
- * When "can_spell" is not NULL set it to TRUE when spell-checking should be
- * done.
- */
-int
-get_syntax_attr(
- const colnr_T col,
- bool *const can_spell,
- const bool keep_state // keep state of char at "col"
-)
+/// Gets highlight attributes for next character.
+/// Must first call syntax_start() once for the line.
+/// "col" is normally 0 for the first use in a line, and increments by one each
+/// time. It's allowed to skip characters and to stop before the end of the
+/// line. But only a "col" after a previously used column is allowed.
+/// When "can_spell" is not NULL set it to TRUE when spell-checking should be
+/// done.
+///
+/// @param keep_state keep state of char at "col"
+///
+/// @return highlight attributes for next character.
+int get_syntax_attr(const colnr_T col, bool *const can_spell, const bool keep_state)
{
int attr = 0;
- if (can_spell != NULL)
+ if (can_spell != NULL) {
/* Default: Only do spelling when there is no @Spell cluster or when
* ":syn spell toplevel" was used. */
*can_spell = syn_block->b_syn_spell == SYNSPL_DEFAULT
? (syn_block->b_spell_cluster_id == 0)
: (syn_block->b_syn_spell == SYNSPL_TOP);
+ }
- /* check for out of memory situation */
- if (syn_block->b_sst_array == NULL)
+ // check for out of memory situation
+ if (syn_block->b_sst_array == NULL) {
return 0;
+ }
- /* After 'synmaxcol' the attribute is always zero. */
+ // After 'synmaxcol' the attribute is always zero.
if (syn_buf->b_p_smc > 0 && col >= (colnr_T)syn_buf->b_p_smc) {
clear_current_state();
current_id = 0;
@@ -1610,9 +1660,10 @@ get_syntax_attr(
return 0;
}
- /* Make sure current_state is valid */
- if (INVALID_STATE(&current_state))
+ // Make sure current_state is valid
+ if (INVALID_STATE(&current_state)) {
validate_current_state();
+ }
/*
* Skip from the current column to "col", get the attributes for "col".
@@ -1626,15 +1677,14 @@ get_syntax_attr(
return attr;
}
-/*
- * Get syntax attributes for current_lnum, current_col.
- */
-static int syn_current_attr(
- const bool syncing, // When true: called for syncing
- const bool displaying, // result will be displayed
- bool *const can_spell, // return: do spell checking
- const bool keep_state // keep syntax stack afterwards
-)
+/// Get syntax attributes for current_lnum, current_col.
+///
+/// @param syncing When true: called for syncing
+/// @param displaying result will be displayed
+/// @param can_spell return: do spell checking
+/// @param keep_state keep syntax stack afterwards
+static int syn_current_attr(const bool syncing, const bool displaying, bool *const can_spell,
+ const bool keep_state)
{
lpos_T endpos; // was: char_u *endp;
lpos_T hl_startpos; // was: int hl_startcol;
@@ -1654,8 +1704,8 @@ static int syn_current_attr(
lpos_T pos;
reg_extmatch_T *cur_extmatch = NULL;
char_u buf_chartab[32]; // chartab array for syn iskeyword
- char_u *line; // current line. NOTE: becomes invalid after
- // looking for a pattern match!
+ char_u *line; // current line. NOTE: becomes invalid after
+ // looking for a pattern match!
// variables for zero-width matches that have a "nextgroup" argument
bool keep_next_list;
@@ -1681,7 +1731,7 @@ static int syn_current_attr(
return 0;
}
- /* if the current or next character is NUL, we will finish the line now */
+ // if the current or next character is NUL, we will finish the line now
if (line[current_col] == NUL || line[current_col + 1] == NUL) {
current_finished = true;
current_state_stored = false;
@@ -1699,8 +1749,8 @@ static int syn_current_attr(
// Only check for keywords when not syncing and there are some.
const bool do_keywords = !syncing
- && (syn_block->b_keywtab.ht_used > 0
- || syn_block->b_keywtab_ic.ht_used > 0);
+ && (syn_block->b_keywtab.ht_used > 0
+ || syn_block->b_keywtab_ic.ht_used > 0);
/* Init the list of zero-width matches with a nextlist. This is used to
* avoid matching the same item in the same position twice. */
@@ -1726,23 +1776,25 @@ static int syn_current_attr(
* Always need to check for contained items if some item has the
* "containedin" argument (takes extra time!).
*/
- if (current_state.ga_len)
+ if (current_state.ga_len) {
cur_si = &CUR_STATE(current_state.ga_len - 1);
- else
+ } else {
cur_si = NULL;
+ }
if (syn_block->b_syn_containedin || cur_si == NULL
|| cur_si->si_cont_list != NULL) {
/*
* 2. Check for keywords, if on a keyword char after a non-keyword
- * char. Don't do this when syncing.
+ * char. Don't do this when syncing.
*/
if (do_keywords) {
line = syn_getcurline();
const char_u *cur_pos = line + current_col;
if (vim_iswordp_buf(cur_pos, syn_buf)
- && (current_col == 0 || !vim_iswordp_buf(
- cur_pos - 1 - utf_head_off(line, cur_pos - 1), syn_buf))) {
+ && (current_col == 0 ||
+ !vim_iswordp_buf(cur_pos - 1 - utf_head_off(line, cur_pos - 1),
+ syn_buf))) {
syn_id = check_keyword_id(line, (int)current_col, &endcol, &flags,
&next_list, cur_si, &cchar);
if (syn_id != 0) {
@@ -1751,7 +1803,7 @@ static int syn_current_attr(
cur_si = &CUR_STATE(current_state.ga_len - 1);
cur_si->si_m_startcol = current_col;
cur_si->si_h_startpos.lnum = current_lnum;
- cur_si->si_h_startpos.col = 0; /* starts right away */
+ cur_si->si_h_startpos.col = 0; // starts right away
cur_si->si_m_endpos.lnum = current_lnum;
cur_si->si_m_endpos.col = endcol;
cur_si->si_h_endpos.lnum = current_lnum;
@@ -1761,10 +1813,11 @@ static int syn_current_attr(
cur_si->si_flags = flags;
cur_si->si_seqnr = next_seqnr++;
cur_si->si_cchar = cchar;
- if (current_state.ga_len > 1)
+ if (current_state.ga_len > 1) {
cur_si->si_flags |=
CUR_STATE(current_state.ga_len - 2).si_flags
& HL_CONCEAL;
+ }
cur_si->si_id = syn_id;
cur_si->si_trans_id = syn_id;
if (flags & HL_TRANSP) {
@@ -1772,10 +1825,8 @@ static int syn_current_attr(
cur_si->si_attr = 0;
cur_si->si_trans_id = 0;
} else {
- cur_si->si_attr = CUR_STATE(
- current_state.ga_len - 2).si_attr;
- cur_si->si_trans_id = CUR_STATE(
- current_state.ga_len - 2).si_trans_id;
+ cur_si->si_attr = CUR_STATE(current_state.ga_len - 2).si_attr;
+ cur_si->si_trans_id = CUR_STATE(current_state.ga_len - 2).si_trans_id;
}
} else {
cur_si->si_attr = syn_id2attr(syn_id);
@@ -1803,28 +1854,29 @@ static int syn_current_attr(
* pattern takes quite a bit of time, thus we want to
* avoid doing it when it's not needed.
*/
- next_match_idx = 0; /* no match in this line yet */
+ next_match_idx = 0; // no match in this line yet
next_match_col = MAXCOL;
for (int idx = syn_block->b_syn_patterns.ga_len; --idx >= 0; ) {
synpat_T *const spp = &(SYN_ITEMS(syn_block)[idx]);
- if ( spp->sp_syncing == syncing
- && (displaying || !(spp->sp_flags & HL_DISPLAY))
- && (spp->sp_type == SPTYPE_MATCH
- || spp->sp_type == SPTYPE_START)
- && (current_next_list != NULL
+ if (spp->sp_syncing == syncing
+ && (displaying || !(spp->sp_flags & HL_DISPLAY))
+ && (spp->sp_type == SPTYPE_MATCH
+ || spp->sp_type == SPTYPE_START)
+ && (current_next_list != NULL
? in_id_list(NULL, current_next_list,
- &spp->sp_syn, 0)
+ &spp->sp_syn, 0)
: (cur_si == NULL
? !(spp->sp_flags & HL_CONTAINED)
: in_id_list(cur_si,
- cur_si->si_cont_list, &spp->sp_syn,
- spp->sp_flags & HL_CONTAINED)))) {
+ cur_si->si_cont_list, &spp->sp_syn,
+ spp->sp_flags & HL_CONTAINED)))) {
/* If we already tried matching in this line, and
* there isn't a match before next_match_col, skip
* this item. */
if (spp->sp_line_id == current_line_id
- && spp->sp_startcol >= next_match_col)
+ && spp->sp_startcol >= next_match_col) {
continue;
+ }
spp->sp_line_id = current_line_id;
colnr_T lc_col = current_col - spp->sp_offsets[SPO_LC_OFF];
@@ -1838,7 +1890,7 @@ static int syn_current_attr(
IF_SYN_TIME(&spp->sp_time));
spp->sp_prog = regmatch.regprog;
if (!r) {
- /* no match in this line, try another one */
+ // no match in this line, try another one
spp->sp_startcol = MAXCOL;
continue;
}
@@ -1847,7 +1899,7 @@ static int syn_current_attr(
* Compute the first column of the match.
*/
syn_add_start_off(&pos, &regmatch,
- spp, SPO_MS_OFF, -1);
+ spp, SPO_MS_OFF, -1);
if (pos.lnum > current_lnum) {
/* must have used end of match in a next line,
* we can't handle that */
@@ -1864,8 +1916,9 @@ static int syn_current_attr(
* If a previously found match starts at a lower
* column number, don't use this one.
*/
- if (startcol >= next_match_col)
+ if (startcol >= next_match_col) {
continue;
+ }
/*
* If we matched this pattern at this position
@@ -1880,14 +1933,14 @@ static int syn_current_attr(
endpos.lnum = regmatch.endpos[0].lnum;
endpos.col = regmatch.endpos[0].col;
- /* Compute the highlight start. */
+ // Compute the highlight start.
syn_add_start_off(&hl_startpos, &regmatch,
- spp, SPO_HS_OFF, -1);
+ spp, SPO_HS_OFF, -1);
- /* Compute the region start. */
- /* Default is to use the end of the match. */
+ // Compute the region start.
+ // Default is to use the end of the match.
syn_add_end_off(&eos_pos, &regmatch,
- spp, SPO_RS_OFF, 0);
+ spp, SPO_RS_OFF, 0);
/*
* Grab the external submatches before they get
@@ -1898,7 +1951,7 @@ static int syn_current_attr(
re_extmatch_out = NULL;
flags = 0;
- eoe_pos.lnum = 0; /* avoid warning */
+ eoe_pos.lnum = 0; // avoid warning
eoe_pos.col = 0;
end_idx = 0;
hl_endpos.lnum = 0;
@@ -1915,9 +1968,10 @@ static int syn_current_attr(
startpos = endpos;
find_endpos(idx, &startpos, &endpos, &hl_endpos,
- &flags, &eoe_pos, &end_idx, cur_extmatch);
- if (endpos.lnum == 0)
- continue; /* not found */
+ &flags, &eoe_pos, &end_idx, cur_extmatch);
+ if (endpos.lnum == 0) {
+ continue; // not found
+ }
}
/*
* For a "match" the size must be > 0 after the
@@ -1926,9 +1980,9 @@ static int syn_current_attr(
*/
else if (spp->sp_type == SPTYPE_MATCH) {
syn_add_end_off(&hl_endpos, &regmatch, spp,
- SPO_HE_OFF, 0);
+ SPO_HE_OFF, 0);
syn_add_end_off(&endpos, &regmatch, spp,
- SPO_ME_OFF, 0);
+ SPO_ME_OFF, 0);
if (endpos.lnum == current_lnum
&& (int)endpos.col + syncing < startcol) {
/*
@@ -1948,8 +2002,9 @@ static int syn_current_attr(
/* Highlighting must start after startpos and end
* before endpos. */
if (hl_startpos.lnum == current_lnum
- && (int)hl_startpos.col < startcol)
+ && (int)hl_startpos.col < startcol) {
hl_startpos.col = startcol;
+ }
limit_pos_zero(&hl_endpos, &endpos);
next_match_idx = idx;
@@ -1972,7 +2027,7 @@ static int syn_current_attr(
* If we found a match at the current column, use it.
*/
if (next_match_idx >= 0 && next_match_col == (int)current_col) {
- synpat_T *lspp;
+ synpat_T *lspp;
/* When a zero-width item matched which has a nextgroup,
* don't push the item but set nextgroup. */
@@ -2012,8 +2067,9 @@ static int syn_current_attr(
if (((current_next_flags & HL_SKIPWHITE)
&& ascii_iswhite(line[current_col]))
|| ((current_next_flags & HL_SKIPEMPTY)
- && *line == NUL))
+ && *line == NUL)) {
break;
+ }
}
/*
@@ -2030,7 +2086,6 @@ static int syn_current_attr(
found_match = true;
}
}
-
} while (found_match);
restore_chartab(buf_chartab);
@@ -2075,9 +2130,9 @@ static int syn_current_attr(
/* There is no @Spell cluster: Do spelling for items without
* @NoSpell cluster. */
if (syn_block->b_nospell_cluster_id == 0
- || current_trans_id == 0)
+ || current_trans_id == 0) {
*can_spell = (syn_block->b_syn_spell != SYNSPL_NOTOP);
- else {
+ } else {
sps.inc_tag = 0;
sps.id = syn_block->b_nospell_cluster_id;
sps.cont_in_list = NULL;
@@ -2088,9 +2143,9 @@ static int syn_current_attr(
* the @Spell cluster. But not when @NoSpell is also there.
* At the toplevel only spell check when ":syn spell toplevel"
* was used. */
- if (current_trans_id == 0)
+ if (current_trans_id == 0) {
*can_spell = (syn_block->b_syn_spell == SYNSPL_TOP);
- else {
+ } else {
sps.inc_tag = 0;
sps.id = syn_block->b_spell_cluster_id;
sps.cont_in_list = NULL;
@@ -2098,8 +2153,9 @@ static int syn_current_attr(
if (syn_block->b_nospell_cluster_id != 0) {
sps.id = syn_block->b_nospell_cluster_id;
- if (in_id_list(sip, sip->si_cont_list, &sps, 0))
+ if (in_id_list(sip, sip->si_cont_list, &sps, 0)) {
*can_spell = false;
+ }
}
}
}
@@ -2123,14 +2179,15 @@ static int syn_current_attr(
--current_col;
}
}
- } else if (can_spell != NULL)
+ } else if (can_spell != NULL) {
/* Default: Only do spelling when there is no @Spell cluster or when
* ":syn spell toplevel" was used. */
*can_spell = syn_block->b_syn_spell == SYNSPL_DEFAULT
? (syn_block->b_spell_cluster_id == 0)
: (syn_block->b_syn_spell == SYNSPL_TOP);
+ }
- /* nextgroup ends at end of line, unless "skipnl" or "skipempty" present */
+ // nextgroup ends at end of line, unless "skipnl" or "skipempty" present
if (current_next_list != NULL
&& (line = syn_getcurline())[current_col] != NUL
&& line[current_col + 1] == NUL
@@ -2138,10 +2195,11 @@ static int syn_current_attr(
current_next_list = NULL;
}
- if (!GA_EMPTY(&zero_width_next_ga))
+ if (!GA_EMPTY(&zero_width_next_ga)) {
ga_clear(&zero_width_next_ga);
+ }
- /* No longer need external matches. But keep next_match_extmatch. */
+ // No longer need external matches. But keep next_match_extmatch.
unref_extmatch(re_extmatch_out);
re_extmatch_out = NULL;
unref_extmatch(cur_extmatch);
@@ -2199,9 +2257,10 @@ static stateitem_T *push_next_match(void)
cur_si->si_flags = spp->sp_flags;
cur_si->si_seqnr = next_seqnr++;
cur_si->si_cchar = spp->sp_cchar;
- if (current_state.ga_len > 1)
+ if (current_state.ga_len > 1) {
cur_si->si_flags |=
CUR_STATE(current_state.ga_len - 2).si_flags & HL_CONCEAL;
+ }
cur_si->si_next_list = spp->sp_next_list;
cur_si->si_extmatch = ref_extmatch(next_match_extmatch);
if (spp->sp_type == SPTYPE_START && !(spp->sp_flags & HL_ONELINE)) {
@@ -2216,8 +2275,9 @@ static stateitem_T *push_next_match(void)
cur_si->si_eoe_pos = next_match_eoe_pos;
cur_si->si_end_idx = next_match_end_idx;
}
- if (keepend_level < 0 && (cur_si->si_flags & HL_KEEPEND))
+ if (keepend_level < 0 && (cur_si->si_flags & HL_KEEPEND)) {
keepend_level = current_state.ga_len - 1;
+ }
check_keepend();
update_si_attr(current_state.ga_len - 1);
@@ -2239,15 +2299,16 @@ static stateitem_T *push_next_match(void)
cur_si->si_flags = HL_MATCH;
cur_si->si_seqnr = next_seqnr++;
cur_si->si_flags |= save_flags;
- if (cur_si->si_flags & HL_CONCEALENDS)
+ if (cur_si->si_flags & HL_CONCEALENDS) {
cur_si->si_flags |= HL_CONCEAL;
+ }
cur_si->si_next_list = NULL;
check_keepend();
update_si_attr(current_state.ga_len - 1);
}
}
- next_match_idx = -1; /* try other match next time */
+ next_match_idx = -1; // try other match next time
return cur_si;
}
@@ -2282,14 +2343,15 @@ static void check_state_ends(void)
cur_si->si_h_endpos = cur_si->si_eoe_pos;
cur_si->si_flags |= HL_MATCH;
cur_si->si_seqnr = next_seqnr++;
- if (cur_si->si_flags & HL_CONCEALENDS)
+ if (cur_si->si_flags & HL_CONCEALENDS) {
cur_si->si_flags |= HL_CONCEAL;
+ }
update_si_attr(current_state.ga_len - 1);
- /* nextgroup= should not match in the end pattern */
+ // nextgroup= should not match in the end pattern
current_next_list = NULL;
- /* what matches next may be different now, clear it */
+ // what matches next may be different now, clear it
next_match_idx = 0;
next_match_col = MAXCOL;
break;
@@ -2299,8 +2361,9 @@ static void check_state_ends(void)
current_next_list = cur_si->si_next_list;
current_next_flags = cur_si->si_flags;
if (!(current_next_flags & (HL_SKIPNL | HL_SKIPEMPTY))
- && syn_getcurline()[current_col] == NUL)
+ && syn_getcurline()[current_col] == NUL) {
current_next_list = NULL;
+ }
/* When the ended item has "extend", another item with
* "keepend" now needs to check for its end. */
@@ -2308,8 +2371,9 @@ static void check_state_ends(void)
pop_current_state();
- if (GA_EMPTY(&current_state))
+ if (GA_EMPTY(&current_state)) {
break;
+ }
if (had_extend && keepend_level >= 0) {
syn_update_ends(false);
@@ -2337,12 +2401,14 @@ static void check_state_ends(void)
check_keepend();
if ((current_next_flags & HL_HAS_EOL)
&& keepend_level < 0
- && syn_getcurline()[current_col] == NUL)
+ && syn_getcurline()[current_col] == NUL) {
break;
+ }
}
}
- } else
+ } else {
break;
+ }
}
}
@@ -2353,23 +2419,26 @@ static void check_state_ends(void)
static void update_si_attr(int idx)
{
stateitem_T *sip = &CUR_STATE(idx);
- synpat_T *spp;
+ synpat_T *spp;
- /* This should not happen... */
- if (sip->si_idx < 0)
+ // This should not happen...
+ if (sip->si_idx < 0) {
return;
+ }
spp = &(SYN_ITEMS(syn_block)[sip->si_idx]);
- if (sip->si_flags & HL_MATCH)
+ if (sip->si_flags & HL_MATCH) {
sip->si_id = spp->sp_syn_match_id;
- else
+ } else {
sip->si_id = spp->sp_syn.id;
+ }
sip->si_attr = syn_id2attr(sip->si_id);
sip->si_trans_id = sip->si_id;
- if (sip->si_flags & HL_MATCH)
+ if (sip->si_flags & HL_MATCH) {
sip->si_cont_list = NULL;
- else
+ } else {
sip->si_cont_list = spp->sp_cont_list;
+ }
/*
* For transparent items, take attr from outer item.
@@ -2380,8 +2449,9 @@ static void update_si_attr(int idx)
if (idx == 0) {
sip->si_attr = 0;
sip->si_trans_id = 0;
- if (sip->si_cont_list == NULL)
+ if (sip->si_cont_list == NULL) {
sip->si_cont_list = ID_LIST_ALL;
+ }
} else {
sip->si_attr = CUR_STATE(idx - 1).si_attr;
sip->si_trans_id = CUR_STATE(idx - 1).si_trans_id;
@@ -2410,17 +2480,20 @@ static void check_keepend(void)
* This check can consume a lot of time; only do it from the level where
* there really is a keepend.
*/
- if (keepend_level < 0)
+ if (keepend_level < 0) {
return;
+ }
/*
* Find the last index of an "extend" item. "keepend" items before that
* won't do anything. If there is no "extend" item "i" will be
* "keepend_level" and all "keepend" items will work normally.
*/
- for (i = current_state.ga_len - 1; i > keepend_level; --i)
- if (CUR_STATE(i).si_flags & HL_EXTEND)
+ for (i = current_state.ga_len - 1; i > keepend_level; --i) {
+ if (CUR_STATE(i).si_flags & HL_EXTEND) {
break;
+ }
+ }
maxpos.lnum = 0;
maxpos.col = 0;
@@ -2438,13 +2511,15 @@ static void check_keepend(void)
if (maxpos.lnum == 0
|| maxpos.lnum > sip->si_m_endpos.lnum
|| (maxpos.lnum == sip->si_m_endpos.lnum
- && maxpos.col > sip->si_m_endpos.col))
+ && maxpos.col > sip->si_m_endpos.col)) {
maxpos = sip->si_m_endpos;
+ }
if (maxpos_h.lnum == 0
|| maxpos_h.lnum > sip->si_h_endpos.lnum
|| (maxpos_h.lnum == sip->si_h_endpos.lnum
- && maxpos_h.col > sip->si_h_endpos.col))
+ && maxpos_h.col > sip->si_h_endpos.col)) {
maxpos_h = sip->si_h_endpos;
+ }
}
}
}
@@ -2461,15 +2536,17 @@ static void update_si_end(stateitem_T *sip, int startcol, bool force)
lpos_T hl_endpos;
lpos_T end_endpos;
- /* return quickly for a keyword */
- if (sip->si_idx < 0)
+ // return quickly for a keyword
+ if (sip->si_idx < 0) {
return;
+ }
/* Don't update when it's already done. Can be a match of an end pattern
* that started in a previous line. Watch out: can also be a "keepend"
* from a containing item. */
- if (!force && sip->si_m_endpos.lnum >= current_lnum)
+ if (!force && sip->si_m_endpos.lnum >= current_lnum) {
return;
+ }
/*
* We need to find the end of the region. It may continue in the next
@@ -2482,23 +2559,23 @@ static void update_si_end(stateitem_T *sip, int startcol, bool force)
};
lpos_T endpos = { 0 };
find_endpos(sip->si_idx, &startpos, &endpos, &hl_endpos,
- &(sip->si_flags), &end_endpos, &end_idx, sip->si_extmatch);
+ &(sip->si_flags), &end_endpos, &end_idx, sip->si_extmatch);
if (endpos.lnum == 0) {
- /* No end pattern matched. */
+ // No end pattern matched.
if (SYN_ITEMS(syn_block)[sip->si_idx].sp_flags & HL_ONELINE) {
- /* a "oneline" never continues in the next line */
+ // a "oneline" never continues in the next line
sip->si_ends = TRUE;
sip->si_m_endpos.lnum = current_lnum;
sip->si_m_endpos.col = (colnr_T)STRLEN(syn_getcurline());
} else {
- /* continues in the next line */
+ // continues in the next line
sip->si_ends = FALSE;
sip->si_m_endpos.lnum = 0;
}
sip->si_h_endpos = sip->si_m_endpos;
} else {
- /* match within this line */
+ // match within this line
sip->si_m_endpos = endpos;
sip->si_h_endpos = hl_endpos;
sip->si_eoe_pos = end_endpos;
@@ -2527,49 +2604,49 @@ static void pop_current_state(void)
unref_extmatch(CUR_STATE(current_state.ga_len - 1).si_extmatch);
--current_state.ga_len;
}
- /* after the end of a pattern, try matching a keyword or pattern */
+ // after the end of a pattern, try matching a keyword or pattern
next_match_idx = -1;
- /* if first state with "keepend" is popped, reset keepend_level */
- if (keepend_level >= current_state.ga_len)
+ // if first state with "keepend" is popped, reset keepend_level
+ if (keepend_level >= current_state.ga_len) {
keepend_level = -1;
+ }
}
-/*
- * Find the end of a start/skip/end syntax region after "startpos".
- * Only checks one line.
- * Also handles a match item that continued from a previous line.
- * If not found, the syntax item continues in the next line. m_endpos->lnum
- * will be 0.
- * If found, the end of the region and the end of the highlighting is
- * computed.
- */
-static void
-find_endpos(
- int idx, // index of the pattern
- lpos_T *startpos, // where to start looking for an END match
- lpos_T *m_endpos, // return: end of match
- lpos_T *hl_endpos, // return: end of highlighting
- long *flagsp, // return: flags of matching END
- lpos_T *end_endpos, // return: end of end pattern match
- int *end_idx, // return: group ID for end pat. match, or 0
- reg_extmatch_T *start_ext // submatches from the start pattern
-)
+/// Find the end of a start/skip/end syntax region after "startpos".
+/// Only checks one line.
+/// Also handles a match item that continued from a previous line.
+/// If not found, the syntax item continues in the next line. m_endpos->lnum
+/// will be 0.
+/// If found, the end of the region and the end of the highlighting is
+/// computed.
+///
+/// @param idx index of the pattern
+/// @param startpos where to start looking for an END match
+/// @param m_endpos return: end of match
+/// @param hl_endpos return: end of highlighting
+/// @param flagsp return: flags of matching END
+/// @param end_endpos return: end of end pattern match
+/// @param end_idx return: group ID for end pat. match, or 0
+/// @param start_ext submatches from the start pattern
+static void find_endpos(int idx, lpos_T *startpos, lpos_T *m_endpos, lpos_T *hl_endpos,
+ long *flagsp, lpos_T *end_endpos, int *end_idx, reg_extmatch_T *start_ext)
{
colnr_T matchcol;
- synpat_T *spp, *spp_skip;
+ synpat_T *spp, *spp_skip;
int start_idx;
int best_idx;
regmmatch_T regmatch;
- regmmatch_T best_regmatch; /* startpos/endpos of best match */
+ regmmatch_T best_regmatch; // startpos/endpos of best match
lpos_T pos;
- char_u *line;
+ char_u *line;
bool had_match = false;
char_u buf_chartab[32]; // chartab array for syn option iskeyword
- /* just in case we are invoked for a keyword */
- if (idx < 0)
+ // just in case we are invoked for a keyword
+ if (idx < 0) {
return;
+ }
/*
* Check for being called with a START pattern.
@@ -2587,21 +2664,23 @@ find_endpos(
*/
for (;; ) {
spp = &(SYN_ITEMS(syn_block)[idx]);
- if (spp->sp_type != SPTYPE_START)
+ if (spp->sp_type != SPTYPE_START) {
break;
+ }
++idx;
}
/*
- * Lookup the SKIP pattern (if present)
+ * Lookup the SKIP pattern (if present)
*/
if (spp->sp_type == SPTYPE_SKIP) {
spp_skip = spp;
++idx;
- } else
+ } else {
spp_skip = NULL;
+ }
- /* Setup external matches for syn_regexec(). */
+ // Setup external matches for syn_regexec().
unref_extmatch(re_extmatch_in);
re_extmatch_in = ref_extmatch(start_ext);
@@ -2621,11 +2700,13 @@ find_endpos(
int lc_col = matchcol;
spp = &(SYN_ITEMS(syn_block)[idx]);
- if (spp->sp_type != SPTYPE_END) /* past last END pattern */
+ if (spp->sp_type != SPTYPE_END) { // past last END pattern
break;
+ }
lc_col -= spp->sp_offsets[SPO_LC_OFF];
- if (lc_col < 0)
+ if (lc_col < 0) {
lc_col = 0;
+ }
regmatch.rmm_ic = spp->sp_ic;
regmatch.regprog = spp->sp_prog;
@@ -2646,8 +2727,9 @@ find_endpos(
* If all end patterns have been tried, and there is no match, the
* item continues until end-of-line.
*/
- if (best_idx == -1)
+ if (best_idx == -1) {
break;
+ }
/*
* If the skip pattern matches before the end pattern,
@@ -2656,8 +2738,9 @@ find_endpos(
if (spp_skip != NULL) {
int lc_col = matchcol - spp_skip->sp_offsets[SPO_LC_OFF];
- if (lc_col < 0)
+ if (lc_col < 0) {
lc_col = 0;
+ }
regmatch.rmm_ic = spp_skip->sp_ic;
regmatch.regprog = spp_skip->sp_prog;
int r = syn_regexec(&regmatch, startpos->lnum, lc_col,
@@ -2704,16 +2787,18 @@ find_endpos(
*/
spp = &(SYN_ITEMS(syn_block)[best_idx]);
syn_add_end_off(m_endpos, &best_regmatch, spp, SPO_ME_OFF, 1);
- /* can't end before the start */
- if (m_endpos->lnum == startpos->lnum && m_endpos->col < startpos->col)
+ // can't end before the start
+ if (m_endpos->lnum == startpos->lnum && m_endpos->col < startpos->col) {
m_endpos->col = startpos->col;
+ }
syn_add_end_off(end_endpos, &best_regmatch, spp, SPO_HE_OFF, 1);
- /* can't end before the start */
+ // can't end before the start
if (end_endpos->lnum == startpos->lnum
- && end_endpos->col < startpos->col)
+ && end_endpos->col < startpos->col) {
end_endpos->col = startpos->col;
- /* can't end after the match */
+ }
+ // can't end after the match
limit_pos(end_endpos, m_endpos);
/*
@@ -2730,10 +2815,11 @@ find_endpos(
}
hl_endpos->col += spp->sp_offsets[SPO_RE_OFF];
- /* can't end before the start */
+ // can't end before the start
if (hl_endpos->lnum == startpos->lnum
- && hl_endpos->col < startpos->col)
+ && hl_endpos->col < startpos->col) {
hl_endpos->col = startpos->col;
+ }
limit_pos(hl_endpos, m_endpos);
/* now the match ends where the highlighting ends, it is turned
@@ -2750,13 +2836,14 @@ find_endpos(
break;
}
- /* no match for an END pattern in this line */
- if (!had_match)
+ // no match for an END pattern in this line
+ if (!had_match) {
m_endpos->lnum = 0;
+ }
restore_chartab(buf_chartab);
- /* Remove external matches. */
+ // Remove external matches.
unref_extmatch(re_extmatch_in);
re_extmatch_in = NULL;
}
@@ -2766,10 +2853,11 @@ find_endpos(
*/
static void limit_pos(lpos_T *pos, lpos_T *limit)
{
- if (pos->lnum > limit->lnum)
+ if (pos->lnum > limit->lnum) {
*pos = *limit;
- else if (pos->lnum == limit->lnum && pos->col > limit->col)
+ } else if (pos->lnum == limit->lnum && pos->col > limit->col) {
pos->col = limit->col;
+ }
}
/*
@@ -2777,28 +2865,27 @@ static void limit_pos(lpos_T *pos, lpos_T *limit)
*/
static void limit_pos_zero(lpos_T *pos, lpos_T *limit)
{
- if (pos->lnum == 0)
+ if (pos->lnum == 0) {
*pos = *limit;
- else
+ } else {
limit_pos(pos, limit);
+ }
}
-/*
- * Add offset to matched text for end of match or highlight.
- */
-static void
-syn_add_end_off(
- lpos_T *result, // returned position
- regmmatch_T *regmatch, // start/end of match
- synpat_T *spp, // matched pattern
- int idx, // index of offset
- int extra // extra chars for offset to start
-)
+/// Add offset to matched text for end of match or highlight.
+///
+/// @param result returned position
+/// @param regmatch start/end of match
+/// @param spp matched pattern
+/// @param idx index of offset
+/// @param extra extra chars for offset to start
+static void syn_add_end_off(lpos_T *result, regmmatch_T *regmatch, synpat_T *spp, int idx,
+ int extra)
{
int col;
int off;
- char_u *base;
- char_u *p;
+ char_u *base;
+ char_u *p;
if (spp->sp_off_flags & (1 << idx)) {
result->lnum = regmatch->startpos[0].lnum;
@@ -2830,23 +2917,19 @@ syn_add_end_off(
result->col = col;
}
-/*
- * Add offset to matched text for start of match or highlight.
- * Avoid resulting column to become negative.
- */
-static void
-syn_add_start_off(
- lpos_T *result, // returned position
- regmmatch_T *regmatch, // start/end of match
- synpat_T *spp,
- int idx,
- int extra // extra chars for offset to end
-)
+/// Add offset to matched text for start of match or highlight.
+/// Avoid resulting column to become negative.
+///
+/// @param result returned position
+/// @param regmatch start/end of match
+/// @param extra extra chars for offset to end
+static void syn_add_start_off(lpos_T *result, regmmatch_T *regmatch, synpat_T *spp, int idx,
+ int extra)
{
int col;
int off;
- char_u *base;
- char_u *p;
+ char_u *base;
+ char_u *p;
if (spp->sp_off_flags & (1 << (idx + SPO_COUNT))) {
result->lnum = regmatch->endpos[0].lnum;
@@ -2858,7 +2941,7 @@ syn_add_start_off(
off = spp->sp_offsets[idx];
}
if (result->lnum > syn_buf->b_ml.ml_line_count) {
- /* a "\n" at the end of the pattern may take us below the last line */
+ // a "\n" at the end of the pattern may take us below the last line
result->lnum = syn_buf->b_ml.ml_line_count;
col = (int)STRLEN(ml_get_buf(syn_buf, result->lnum, false));
}
@@ -2920,8 +3003,9 @@ static int syn_regexec(regmmatch_T *rmp, linenr_T lnum, colnr_T col, syn_time_T
st->slowest = pt;
}
++st->count;
- if (r > 0)
+ if (r > 0) {
++st->match;
+ }
}
if (timed_out && !syn_win->w_s->b_syn_slow) {
syn_win->w_s->b_syn_slow = true;
@@ -2936,20 +3020,19 @@ static int syn_regexec(regmmatch_T *rmp, linenr_T lnum, colnr_T col, syn_time_T
return FALSE;
}
-/*
- * Check one position in a line for a matching keyword.
- * The caller must check if a keyword can start at startcol.
- * Return its ID if found, 0 otherwise.
- */
-static int check_keyword_id(
- char_u *const line,
- const int startcol, // position in line to check for keyword
- int *const endcolp, // return: character after found keyword
- long *const flagsp, // return: flags of matching keyword
- int16_t **const next_listp, // return: next_list of matching keyword
- stateitem_T *const cur_si, // item at the top of the stack
- int *const ccharp // conceal substitution char
-)
+/// Check one position in a line for a matching keyword.
+/// The caller must check if a keyword can start at startcol.
+/// Return its ID if found, 0 otherwise.
+///
+/// @param startcol position in line to check for keyword
+/// @param endcolp return: character after found keyword
+/// @param flagsp return: flags of matching keyword
+/// @param next_listp return: next_list of matching keyword
+/// @param cur_si item at the top of the stack
+/// @param ccharp conceal substitution char
+static int check_keyword_id(char_u *const line, const int startcol, int *const endcolp,
+ long *const flagsp, int16_t **const next_listp,
+ stateitem_T *const cur_si, int *const ccharp)
{
// Find first character after the keyword. First character was already
// checked.
@@ -2997,11 +3080,10 @@ static int check_keyword_id(
/// When current_next_list is non-zero accept only that group, otherwise:
/// Accept a not-contained keyword at toplevel.
/// Accept a keyword at other levels only if it is in the contains list.
-static keyentry_T *match_keyword(char_u *keyword, hashtab_T *ht,
- stateitem_T *cur_si)
+static keyentry_T *match_keyword(char_u *keyword, hashtab_T *ht, stateitem_T *cur_si)
{
hashitem_T *hi = hash_find(ht, keyword);
- if (!HASHITEM_EMPTY(hi))
+ if (!HASHITEM_EMPTY(hi)) {
for (keyentry_T *kp = HI2KE(hi); kp != NULL; kp = kp->ke_next) {
if (current_next_list != 0
? in_id_list(NULL, current_next_list, &kp->k_syn, 0)
@@ -3012,6 +3094,7 @@ static keyentry_T *match_keyword(char_u *keyword, hashtab_T *ht,
return kp;
}
}
+ }
return NULL;
}
@@ -3020,12 +3103,13 @@ static keyentry_T *match_keyword(char_u *keyword, hashtab_T *ht,
*/
static void syn_cmd_conceal(exarg_T *eap, int syncing)
{
- char_u *arg = eap->arg;
- char_u *next;
+ char_u *arg = eap->arg;
+ char_u *next;
eap->nextcmd = find_nextcmd(arg);
- if (eap->skip)
+ if (eap->skip) {
return;
+ }
next = skiptowhite(arg);
if (*arg == NUL) {
@@ -3048,12 +3132,13 @@ static void syn_cmd_conceal(exarg_T *eap, int syncing)
*/
static void syn_cmd_case(exarg_T *eap, int syncing)
{
- char_u *arg = eap->arg;
- char_u *next;
+ char_u *arg = eap->arg;
+ char_u *next;
eap->nextcmd = find_nextcmd(arg);
- if (eap->skip)
+ if (eap->skip) {
return;
+ }
next = skiptowhite(arg);
if (*arg == NUL) {
@@ -3078,14 +3163,18 @@ static void syn_cmd_foldlevel(exarg_T *eap, int syncing)
char_u *arg_end;
eap->nextcmd = find_nextcmd(arg);
- if (eap->skip)
+ if (eap->skip) {
return;
+ }
if (*arg == NUL) {
switch (curwin->w_s->b_syn_foldlevel) {
- case SYNFLD_START: MSG(_("syntax foldlevel start")); break;
- case SYNFLD_MINIMUM: MSG(_("syntax foldlevel minimum")); break;
- default: break;
+ case SYNFLD_START:
+ MSG(_("syntax foldlevel start")); break;
+ case SYNFLD_MINIMUM:
+ MSG(_("syntax foldlevel minimum")); break;
+ default:
+ break;
}
return;
}
@@ -3111,12 +3200,13 @@ static void syn_cmd_foldlevel(exarg_T *eap, int syncing)
*/
static void syn_cmd_spell(exarg_T *eap, int syncing)
{
- char_u *arg = eap->arg;
- char_u *next;
+ char_u *arg = eap->arg;
+ char_u *next;
eap->nextcmd = find_nextcmd(arg);
- if (eap->skip)
+ if (eap->skip) {
return;
+ }
next = skiptowhite(arg);
if (*arg == NUL) {
@@ -3195,17 +3285,17 @@ void syntax_clear(synblock_T *block)
block->b_syn_containedin = false;
block->b_syn_conceal = false;
- /* free the keywords */
+ // free the keywords
clear_keywtab(&block->b_keywtab);
clear_keywtab(&block->b_keywtab_ic);
- /* free the syntax patterns */
+ // free the syntax patterns
for (int i = block->b_syn_patterns.ga_len; --i >= 0; ) {
syn_clear_pattern(block, i);
}
ga_clear(&block->b_syn_patterns);
- /* free the syntax clusters */
+ // free the syntax clusters
for (int i = block->b_syn_clusters.ga_len; --i >= 0; ) {
syn_clear_cluster(block, i);
}
@@ -3224,11 +3314,11 @@ void syntax_clear(synblock_T *block)
block->b_syn_folditems = 0;
clear_string_option(&block->b_syn_isk);
- /* free the stored states */
+ // free the stored states
syn_stack_free_all(block);
invalidate_current_state();
- /* Reset the counter for ":syn include" */
+ // Reset the counter for ":syn include"
running_syn_inc_tag = 0;
}
@@ -3249,7 +3339,7 @@ void reset_synblock(win_T *wp)
*/
static void syntax_sync_clear(void)
{
- /* free the syntax patterns */
+ // free the syntax patterns
for (int i = curwin->w_s->b_syn_patterns.ga_len; --i >= 0; ) {
if (SYN_ITEMS(curwin->w_s)[i].sp_syncing) {
syn_remove_pattern(curwin->w_s, i);
@@ -3266,7 +3356,7 @@ static void syntax_sync_clear(void)
XFREE_CLEAR(curwin->w_s->b_syn_linecont_pat);
clear_string_option(&curwin->w_s->b_syn_isk);
- syn_stack_free_all(curwin->w_s); /* Need to recompute all syntax. */
+ syn_stack_free_all(curwin->w_s); // Need to recompute all syntax.
}
/*
@@ -3274,14 +3364,15 @@ static void syntax_sync_clear(void)
*/
static void syn_remove_pattern(synblock_T *block, int idx)
{
- synpat_T *spp;
+ synpat_T *spp;
spp = &(SYN_ITEMS(block)[idx]);
- if (spp->sp_flags & HL_FOLD)
+ if (spp->sp_flags & HL_FOLD) {
--block->b_syn_folditems;
+ }
syn_clear_pattern(block, idx);
memmove(spp, spp + 1,
- sizeof(synpat_T) * (block->b_syn_patterns.ga_len - idx - 1));
+ sizeof(synpat_T) * (block->b_syn_patterns.ga_len - idx - 1));
--block->b_syn_patterns.ga_len;
}
@@ -3293,7 +3384,7 @@ static void syn_clear_pattern(synblock_T *block, int i)
{
xfree(SYN_ITEMS(block)[i].sp_pattern);
vim_regfree(SYN_ITEMS(block)[i].sp_prog);
- /* Only free sp_cont_list and sp_next_list of first start pattern */
+ // Only free sp_cont_list and sp_next_list of first start pattern
if (i == 0 || SYN_ITEMS(block)[i - 1].sp_type != SPTYPE_START) {
xfree(SYN_ITEMS(block)[i].sp_cont_list);
xfree(SYN_ITEMS(block)[i].sp_next_list);
@@ -3316,13 +3407,14 @@ static void syn_clear_cluster(synblock_T *block, int i)
*/
static void syn_cmd_clear(exarg_T *eap, int syncing)
{
- char_u *arg = eap->arg;
- char_u *arg_end;
+ char_u *arg = eap->arg;
+ char_u *arg_end;
int id;
eap->nextcmd = find_nextcmd(arg);
- if (eap->skip)
+ if (eap->skip) {
return;
+ }
/*
* We have to disable this within ":syn include @group filename",
@@ -3330,16 +3422,17 @@ static void syn_cmd_clear(exarg_T *eap, int syncing)
* Only required for Vim 5.x syntax files, 6.0 ones don't contain ":syn
* clear".
*/
- if (curwin->w_s->b_syn_topgrp != 0)
+ if (curwin->w_s->b_syn_topgrp != 0) {
return;
+ }
if (ends_excmd(*arg)) {
/*
* No argument: Clear all syntax items.
*/
- if (syncing)
+ if (syncing) {
syntax_sync_clear();
- else {
+ } else {
syntax_clear(curwin->w_s);
if (curwin->w_s == &curwin->w_buffer->b_s) {
do_unlet(S_LEN("b:current_syntax"), true);
@@ -3370,14 +3463,15 @@ static void syn_cmd_clear(exarg_T *eap, int syncing)
if (id == 0) {
EMSG2(_(e_nogroup), arg);
break;
- } else
+ } else {
syn_clear_one(id, syncing);
+ }
}
arg = skipwhite(arg_end);
}
}
redraw_curbuf_later(SOME_VALID);
- syn_stack_free_all(curwin->w_s); /* Need to recompute all syntax. */
+ syn_stack_free_all(curwin->w_s); // Need to recompute all syntax.
}
/*
@@ -3385,19 +3479,20 @@ static void syn_cmd_clear(exarg_T *eap, int syncing)
*/
static void syn_clear_one(const int id, const bool syncing)
{
- synpat_T *spp;
+ synpat_T *spp;
- /* Clear keywords only when not ":syn sync clear group-name" */
+ // Clear keywords only when not ":syn sync clear group-name"
if (!syncing) {
syn_clear_keyword(id, &curwin->w_s->b_keywtab);
syn_clear_keyword(id, &curwin->w_s->b_keywtab_ic);
}
- /* clear the patterns for "id" */
+ // clear the patterns for "id"
for (int idx = curwin->w_s->b_syn_patterns.ga_len; --idx >= 0; ) {
spp = &(SYN_ITEMS(curwin->w_s)[idx]);
- if (spp->sp_syn.id != id || spp->sp_syncing != syncing)
+ if (spp->sp_syn.id != id || spp->sp_syncing != syncing) {
continue;
+ }
syn_remove_pattern(curwin->w_s, idx);
}
}
@@ -3461,21 +3556,18 @@ void syn_maybe_enable(void)
}
}
-/*
- * Handle ":syntax [list]" command: list current syntax words.
- */
-static void
-syn_cmd_list(
- exarg_T *eap,
- int syncing /* when TRUE: list syncing items */
-)
+/// Handle ":syntax [list]" command: list current syntax words.
+///
+/// @param syncing when TRUE: list syncing items
+static void syn_cmd_list(exarg_T *eap, int syncing)
{
- char_u *arg = eap->arg;
- char_u *arg_end;
+ char_u *arg = eap->arg;
+ char_u *arg_end;
eap->nextcmd = find_nextcmd(arg);
- if (eap->skip)
+ if (eap->skip) {
return;
+ }
if (!syntax_present(curwin)) {
MSG(_(msg_no_items));
@@ -3488,7 +3580,7 @@ syn_cmd_list(
syn_lines_msg();
syn_match_msg();
return;
- } else if (!(curwin->w_s->b_syn_sync_flags & SF_MATCH)) {
+ } else if (!(curwin->w_s->b_syn_sync_flags & SF_MATCH)) {
if (curwin->w_s->b_syn_sync_minlines == 0) {
MSG_PUTS(_("no syncing"));
} else {
@@ -3511,8 +3603,9 @@ syn_cmd_list(
syn_lines_msg();
syn_match_msg();
}
- } else
+ } else {
MSG_PUTS_TITLE(_("\n--- Syntax items ---"));
+ }
if (ends_excmd(*arg)) {
/*
* No argument: List all group IDs and all syntax clusters.
@@ -3531,10 +3624,11 @@ syn_cmd_list(
arg_end = skiptowhite(arg);
if (*arg == '@') {
int id = syn_scl_namen2id(arg + 1, (int)(arg_end - arg - 1));
- if (id == 0)
+ if (id == 0) {
EMSG2(_("E392: No such syntax cluster: %s"), arg);
- else
+ } else {
syn_list_cluster(id - SYNID_CLUSTER);
+ }
} else {
int id = syn_name2id_len(arg, (int)(arg_end - arg));
if (id == 0) {
@@ -3585,37 +3679,33 @@ static void syn_match_msg(void)
static int last_matchgroup;
-/*
- * List one syntax item, for ":syntax" or "syntax list syntax_name".
- */
-static void
-syn_list_one(
- const int id,
- const bool syncing, // when true: list syncing items
- const bool link_only // when true; list link-only too
-)
+/// List one syntax item, for ":syntax" or "syntax list syntax_name".
+///
+/// @param syncing when true: list syncing items
+/// @param link_only when true; list link-only too
+static void syn_list_one(const int id, const bool syncing, const bool link_only)
{
bool did_header = false;
static struct name_list namelist1[] =
{
- {HL_DISPLAY, "display"},
- {HL_CONTAINED, "contained"},
- {HL_ONELINE, "oneline"},
- {HL_KEEPEND, "keepend"},
- {HL_EXTEND, "extend"},
- {HL_EXCLUDENL, "excludenl"},
- {HL_TRANSP, "transparent"},
- {HL_FOLD, "fold"},
- {HL_CONCEAL, "conceal"},
- {HL_CONCEALENDS, "concealends"},
- {0, NULL}
+ { HL_DISPLAY, "display" },
+ { HL_CONTAINED, "contained" },
+ { HL_ONELINE, "oneline" },
+ { HL_KEEPEND, "keepend" },
+ { HL_EXTEND, "extend" },
+ { HL_EXCLUDENL, "excludenl" },
+ { HL_TRANSP, "transparent" },
+ { HL_FOLD, "fold" },
+ { HL_CONCEAL, "conceal" },
+ { HL_CONCEALENDS, "concealends" },
+ { 0, NULL }
};
static struct name_list namelist2[] =
{
- {HL_SKIPWHITE, "skipwhite"},
- {HL_SKIPNL, "skipnl"},
- {HL_SKIPEMPTY, "skipempty"},
- {0, NULL}
+ { HL_SKIPWHITE, "skipwhite" },
+ { HL_SKIPNL, "skipnl" },
+ { HL_SKIPEMPTY, "skipempty" },
+ { 0, NULL }
};
const int attr = HL_ATTR(HLF_D); // highlight like directories
@@ -3642,14 +3732,17 @@ syn_list_one(
if (spp->sp_type == SPTYPE_MATCH) {
put_pattern("match", ' ', spp, attr);
msg_putchar(' ');
- } else if (spp->sp_type == SPTYPE_START) {
- while (SYN_ITEMS(curwin->w_s)[idx].sp_type == SPTYPE_START)
+ } else if (spp->sp_type == SPTYPE_START) {
+ while (SYN_ITEMS(curwin->w_s)[idx].sp_type == SPTYPE_START) {
put_pattern("start", '=', &SYN_ITEMS(curwin->w_s)[idx++], attr);
- if (SYN_ITEMS(curwin->w_s)[idx].sp_type == SPTYPE_SKIP)
+ }
+ if (SYN_ITEMS(curwin->w_s)[idx].sp_type == SPTYPE_SKIP) {
put_pattern("skip", '=', &SYN_ITEMS(curwin->w_s)[idx++], attr);
+ }
while (idx < curwin->w_s->b_syn_patterns.ga_len
- && SYN_ITEMS(curwin->w_s)[idx].sp_type == SPTYPE_END)
+ && SYN_ITEMS(curwin->w_s)[idx].sp_type == SPTYPE_END) {
put_pattern("end", '=', &SYN_ITEMS(curwin->w_s)[idx++], attr);
+ }
--idx;
msg_putchar(' ');
}
@@ -3674,16 +3767,17 @@ syn_list_one(
msg_puts_attr("groupthere", attr);
}
msg_putchar(' ');
- if (spp->sp_sync_idx >= 0)
+ if (spp->sp_sync_idx >= 0) {
msg_outtrans(HL_TABLE()[SYN_ITEMS(curwin->w_s)
[spp->sp_sync_idx].sp_syn.id - 1].sg_name);
- else
+ } else {
MSG_PUTS("NONE");
+ }
msg_putchar(' ');
}
}
- /* list the link, if there is one */
+ // list the link, if there is one
if (HL_TABLE()[id - 1].sg_link && (did_header || link_only) && !got_int) {
(void)syn_list_header(did_header, 0, id, true);
msg_puts_attr("links to", attr);
@@ -3696,11 +3790,12 @@ static void syn_list_flags(struct name_list *nlist, int flags, int attr)
{
int i;
- for (i = 0; nlist[i].flag != 0; ++i)
+ for (i = 0; nlist[i].flag != 0; ++i) {
if (flags & nlist[i].flag) {
msg_puts_attr(nlist[i].name, attr);
msg_putchar(' ');
}
+ }
}
/*
@@ -3710,14 +3805,16 @@ static void syn_list_cluster(int id)
{
int endcol = 15;
- /* slight hack: roughly duplicate the guts of syn_list_header() */
+ // slight hack: roughly duplicate the guts of syn_list_header()
msg_putchar('\n');
msg_outtrans(SYN_CLSTR(curwin->w_s)[id].scl_name);
- if (msg_col >= endcol) /* output at least one space */
+ if (msg_col >= endcol) { // output at least one space
endcol = msg_col + 1;
- if (Columns <= endcol) /* avoid hang for tiny window */
+ }
+ if (Columns <= endcol) { // avoid hang for tiny window
endcol = Columns - 1;
+ }
msg_advance(endcol);
if (SYN_CLSTR(curwin->w_s)[id].scl_list != NULL) {
@@ -3728,9 +3825,7 @@ static void syn_list_cluster(int id)
}
}
-static void put_id_list(const char *const name,
- const int16_t *const list,
- const int attr)
+static void put_id_list(const char *const name, const int16_t *const list, const int attr)
{
msg_puts_attr(name, attr);
msg_putchar('=');
@@ -3741,38 +3836,40 @@ static void put_id_list(const char *const name,
} else {
msg_puts("ALL");
}
- } else if (*p >= SYNID_TOP && *p < SYNID_CONTAINED) {
+ } else if (*p >= SYNID_TOP && *p < SYNID_CONTAINED) {
msg_puts("TOP");
- } else if (*p >= SYNID_CONTAINED && *p < SYNID_CLUSTER) {
+ } else if (*p >= SYNID_CONTAINED && *p < SYNID_CLUSTER) {
msg_puts("CONTAINED");
- } else if (*p >= SYNID_CLUSTER) {
+ } else if (*p >= SYNID_CLUSTER) {
int scl_id = *p - SYNID_CLUSTER;
msg_putchar('@');
msg_outtrans(SYN_CLSTR(curwin->w_s)[scl_id].scl_name);
- } else
+ } else {
msg_outtrans(HL_TABLE()[*p - 1].sg_name);
- if (p[1])
+ }
+ if (p[1]) {
msg_putchar(',');
+ }
}
msg_putchar(' ');
}
-static void put_pattern(const char *const s, const int c,
- const synpat_T *const spp, const int attr)
+static void put_pattern(const char *const s, const int c, const synpat_T *const spp, const int attr)
{
static const char *const sepchars = "/+=-#@\"|'^&";
int i;
- /* May have to write "matchgroup=group" */
+ // May have to write "matchgroup=group"
if (last_matchgroup != spp->sp_syn_match_id) {
last_matchgroup = spp->sp_syn_match_id;
msg_puts_attr("matchgroup", attr);
msg_putchar('=');
- if (last_matchgroup == 0)
+ if (last_matchgroup == 0) {
msg_outtrans((char_u *)"NONE");
- else
+ } else {
msg_outtrans(HL_TABLE()[last_matchgroup - 1].sg_name);
+ }
msg_putchar(' ');
}
@@ -3780,12 +3877,13 @@ static void put_pattern(const char *const s, const int c,
msg_puts_attr(s, attr);
msg_putchar(c);
- /* output the pattern, in between a char that is not in the pattern */
- for (i = 0; vim_strchr(spp->sp_pattern, sepchars[i]) != NULL; )
+ // output the pattern, in between a char that is not in the pattern
+ for (i = 0; vim_strchr(spp->sp_pattern, sepchars[i]) != NULL; ) {
if (sepchars[++i] == NUL) {
- i = 0; /* no good char found, just use the first one */
+ i = 0; // no good char found, just use the first one
break;
}
+ }
msg_putchar(sepchars[i]);
msg_outtrans(spp->sp_pattern);
msg_putchar(sepchars[i]);
@@ -3803,12 +3901,14 @@ static void put_pattern(const char *const s, const int c,
msg_puts(spo_name_tab[i]);
const long n = spp->sp_offsets[i];
if (i != SPO_LC_OFF) {
- if (spp->sp_off_flags & mask)
+ if (spp->sp_off_flags & mask) {
msg_putchar('s');
- else
+ } else {
msg_putchar('e');
- if (n > 0)
+ }
+ if (n > 0) {
msg_putchar('+');
+ }
}
if (n || i == SPO_LC_OFF) {
msg_outnum(n);
@@ -3818,14 +3918,13 @@ static void put_pattern(const char *const s, const int c,
msg_putchar(' ');
}
-// List or clear the keywords for one syntax group.
-// Return true if the header has been printed.
-static bool syn_list_keywords(
- const int id,
- const hashtab_T *const ht,
- bool did_header, // header has already been printed
- const int attr
-)
+/// List or clear the keywords for one syntax group.
+///
+/// @param did_header header has already been printed
+///
+/// @return true if the header has been printed.
+static bool syn_list_keywords(const int id, const hashtab_T *const ht, bool did_header,
+ const int attr)
{
int prev_contained = 0;
const int16_t *prev_next_list = NULL;
@@ -3852,7 +3951,7 @@ static bool syn_list_keywords(
|| prev_skipempty != (kp->flags & HL_SKIPEMPTY)
|| prev_cont_in_list != kp->k_syn.cont_in_list
|| prev_next_list != kp->next_list) {
- force_newline = true;
+ force_newline = true;
} else {
outlen = (int)STRLEN(kp->keyword);
}
@@ -3906,10 +4005,10 @@ static bool syn_list_keywords(
static void syn_clear_keyword(int id, hashtab_T *ht)
{
- hashitem_T *hi;
- keyentry_T *kp;
- keyentry_T *kp_prev;
- keyentry_T *kp_next;
+ hashitem_T *hi;
+ keyentry_T *kp;
+ keyentry_T *kp_prev;
+ keyentry_T *kp_next;
int todo;
hash_lock(ht);
@@ -3924,12 +4023,14 @@ static void syn_clear_keyword(int id, hashtab_T *ht)
if (kp->k_syn.id == id) {
kp_next = kp->ke_next;
if (kp_prev == NULL) {
- if (kp_next == NULL)
+ if (kp_next == NULL) {
hash_remove(ht, hi);
- else
+ } else {
hi->hi_key = KE2HIKEY(kp_next);
- } else
+ }
+ } else {
kp_prev->ke_next = kp_next;
+ }
xfree(kp->next_list);
xfree(kp->k_syn.cont_in_list);
xfree(kp);
@@ -3948,10 +4049,10 @@ static void syn_clear_keyword(int id, hashtab_T *ht)
*/
static void clear_keywtab(hashtab_T *ht)
{
- hashitem_T *hi;
+ hashitem_T *hi;
int todo;
- keyentry_T *kp;
- keyentry_T *kp_next;
+ keyentry_T *kp;
+ keyentry_T *kp_next;
todo = (int)ht->ht_used;
for (hi = ht->ht_array; todo > 0; ++hi) {
@@ -3976,11 +4077,8 @@ static void clear_keywtab(hashtab_T *ht)
/// @param flags flags for this keyword
/// @param cont_in_list containedin for this keyword
/// @param next_list nextgroup for this keyword
-static void add_keyword(char_u *const name,
- const int id,
- const int flags,
- int16_t *const cont_in_list,
- int16_t *const next_list,
+static void add_keyword(char_u *const name, const int id, const int flags,
+ int16_t *const cont_in_list, int16_t *const next_list,
const int conceal_char)
{
char_u name_folded[MAXKEYWLEN + 1];
@@ -4022,18 +4120,16 @@ static void add_keyword(char_u *const name,
}
}
-/*
- * Get the start and end of the group name argument.
- * Return a pointer to the first argument.
- * Return NULL if the end of the command was found instead of further args.
- */
-static char_u *
-get_group_name (
- char_u *arg, /* start of the argument */
- char_u **name_end /* pointer to end of the name */
-)
+/// Get the start and end of the group name argument.
+///
+/// @param arg start of the argument
+/// @param name_end pointer to end of the name
+///
+/// @return a pointer to the first argument.
+/// Return NULL if the end of the command was found instead of further args.
+static char_u *get_group_name(char_u *arg, char_u **name_end)
{
- char_u *rest;
+ char_u *rest;
*name_end = skiptowhite(arg);
rest = skipwhite(*name_end);
@@ -4042,62 +4138,62 @@ get_group_name (
* Check if there are enough arguments. The first argument may be a
* pattern, where '|' is allowed, so only check for NUL.
*/
- if (ends_excmd(*arg) || *rest == NUL)
+ if (ends_excmd(*arg) || *rest == NUL) {
return NULL;
+ }
return rest;
}
-/*
- * Check for syntax command option arguments.
- * This can be called at any place in the list of arguments, and just picks
- * out the arguments that are known. Can be called several times in a row to
- * collect all options in between other arguments.
- * Return a pointer to the next argument (which isn't an option).
- * Return NULL for any error;
- */
-static char_u *
-get_syn_options(
- char_u *arg, // next argument to be checked
- syn_opt_arg_T *opt, // various things
- int *conceal_char,
- int skip // TRUE if skipping over command
-)
-{
- char_u *gname_start, *gname;
+/// Check for syntax command option arguments.
+/// This can be called at any place in the list of arguments, and just picks
+/// out the arguments that are known. Can be called several times in a row to
+/// collect all options in between other arguments.
+///
+/// @param arg next argument to be checked
+/// @param opt various things
+/// @param skip TRUE if skipping over command
+///
+/// @return a pointer to the next argument (which isn't an option).
+/// Return NULL for any error;
+static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_char, int skip)
+{
+ char_u *gname_start, *gname;
int syn_id;
int len = 0;
- char *p;
+ char *p;
int fidx;
static const struct flag {
- char *name;
+ char *name;
int argtype;
int flags;
- } flagtab[] = { {"cCoOnNtTaAiInNeEdD", 0, HL_CONTAINED},
- {"oOnNeElLiInNeE", 0, HL_ONELINE},
- {"kKeEeEpPeEnNdD", 0, HL_KEEPEND},
- {"eExXtTeEnNdD", 0, HL_EXTEND},
- {"eExXcClLuUdDeEnNlL", 0, HL_EXCLUDENL},
- {"tTrRaAnNsSpPaArReEnNtT", 0, HL_TRANSP},
- {"sSkKiIpPnNlL", 0, HL_SKIPNL},
- {"sSkKiIpPwWhHiItTeE", 0, HL_SKIPWHITE},
- {"sSkKiIpPeEmMpPtTyY", 0, HL_SKIPEMPTY},
- {"gGrRoOuUpPhHeErReE", 0, HL_SYNC_HERE},
- {"gGrRoOuUpPtThHeErReE", 0, HL_SYNC_THERE},
- {"dDiIsSpPlLaAyY", 0, HL_DISPLAY},
- {"fFoOlLdD", 0, HL_FOLD},
- {"cCoOnNcCeEaAlL", 0, HL_CONCEAL},
- {"cCoOnNcCeEaAlLeEnNdDsS", 0, HL_CONCEALENDS},
- {"cCcChHaArR", 11, 0},
- {"cCoOnNtTaAiInNsS", 1, 0},
- {"cCoOnNtTaAiInNeEdDiInN", 2, 0},
- {"nNeExXtTgGrRoOuUpP", 3, 0},};
+ } flagtab[] = { { "cCoOnNtTaAiInNeEdD", 0, HL_CONTAINED },
+ { "oOnNeElLiInNeE", 0, HL_ONELINE },
+ { "kKeEeEpPeEnNdD", 0, HL_KEEPEND },
+ { "eExXtTeEnNdD", 0, HL_EXTEND },
+ { "eExXcClLuUdDeEnNlL", 0, HL_EXCLUDENL },
+ { "tTrRaAnNsSpPaArReEnNtT", 0, HL_TRANSP },
+ { "sSkKiIpPnNlL", 0, HL_SKIPNL },
+ { "sSkKiIpPwWhHiItTeE", 0, HL_SKIPWHITE },
+ { "sSkKiIpPeEmMpPtTyY", 0, HL_SKIPEMPTY },
+ { "gGrRoOuUpPhHeErReE", 0, HL_SYNC_HERE },
+ { "gGrRoOuUpPtThHeErReE", 0, HL_SYNC_THERE },
+ { "dDiIsSpPlLaAyY", 0, HL_DISPLAY },
+ { "fFoOlLdD", 0, HL_FOLD },
+ { "cCoOnNcCeEaAlL", 0, HL_CONCEAL },
+ { "cCoOnNcCeEaAlLeEnNdDsS", 0, HL_CONCEALENDS },
+ { "cCcChHaArR", 11, 0 },
+ { "cCoOnNtTaAiInNsS", 1, 0 },
+ { "cCoOnNtTaAiInNeEdDiInN", 2, 0 },
+ { "nNeExXtTgGrRoOuUpP", 3, 0 }, };
static const char *const first_letters = "cCoOkKeEtTsSgGdDfFnN";
- if (arg == NULL) /* already detected error */
+ if (arg == NULL) { // already detected error
return NULL;
+ }
- if (curwin->w_s->b_syn_conceal)
+ if (curwin->w_s->b_syn_conceal) {
opt->flags |= HL_CONCEAL;
+ }
for (;; ) {
/*
@@ -4105,15 +4201,17 @@ get_syn_options(
* Need to skip quickly when no option name is found.
* Also avoid tolower(), it's slow.
*/
- if (strchr(first_letters, *arg) == NULL)
+ if (strchr(first_letters, *arg) == NULL) {
break;
+ }
for (fidx = ARRAY_SIZE(flagtab); --fidx >= 0; ) {
p = flagtab[fidx].name;
int i;
for (i = 0, len = 0; p[i] != NUL; i += 2, ++len) {
- if (arg[len] != p[i] && arg[len] != p[i + 1])
+ if (arg[len] != p[i] && arg[len] != p[i + 1]) {
break;
+ }
}
if (p[i] == NUL && (ascii_iswhite(arg[len])
|| (flagtab[fidx].argtype > 0
@@ -4122,14 +4220,16 @@ get_syn_options(
if (opt->keyword
&& (flagtab[fidx].flags == HL_DISPLAY
|| flagtab[fidx].flags == HL_FOLD
- || flagtab[fidx].flags == HL_EXTEND))
- /* treat "display", "fold" and "extend" as a keyword */
+ || flagtab[fidx].flags == HL_EXTEND)) {
+ // treat "display", "fold" and "extend" as a keyword
fidx = -1;
+ }
break;
}
}
- if (fidx < 0) /* no match found */
+ if (fidx < 0) { // no match found
break;
+ }
if (flagtab[fidx].argtype == 1) {
if (!opt->has_cont_list) {
@@ -4139,15 +4239,15 @@ get_syn_options(
if (get_id_list(&arg, 8, &opt->cont_list, skip) == FAIL) {
return NULL;
}
- } else if (flagtab[fidx].argtype == 2) {
+ } else if (flagtab[fidx].argtype == 2) {
if (get_id_list(&arg, 11, &opt->cont_in_list, skip) == FAIL) {
return NULL;
}
- } else if (flagtab[fidx].argtype == 3) {
+ } else if (flagtab[fidx].argtype == 3) {
if (get_id_list(&arg, 9, &opt->next_list, skip) == FAIL) {
return NULL;
}
- } else if (flagtab[fidx].argtype == 11 && arg[5] == '=') {
+ } else if (flagtab[fidx].argtype == 11 && arg[5] == '=') {
// cchar=?
*conceal_char = utf_ptr2char(arg + 6);
arg += mb_ptr2len(arg + 6) - 1;
@@ -4168,20 +4268,22 @@ get_syn_options(
}
gname_start = arg;
arg = skiptowhite(arg);
- if (gname_start == arg)
+ if (gname_start == arg) {
return NULL;
+ }
gname = vim_strnsave(gname_start, arg - gname_start);
if (STRCMP(gname, "NONE") == 0) {
*opt->sync_idx = NONE_IDX;
} else {
syn_id = syn_name2id(gname);
int i;
- for (i = curwin->w_s->b_syn_patterns.ga_len; --i >= 0; )
+ for (i = curwin->w_s->b_syn_patterns.ga_len; --i >= 0; ) {
if (SYN_ITEMS(curwin->w_s)[i].sp_syn.id == syn_id
&& SYN_ITEMS(curwin->w_s)[i].sp_type == SPTYPE_START) {
*opt->sync_idx = i;
break;
}
+ }
if (i < 0) {
EMSG2(_("E394: Didn't find region item for %s"), gname);
xfree(gname);
@@ -4192,9 +4294,10 @@ get_syn_options(
xfree(gname);
arg = skipwhite(arg);
} else if (flagtab[fidx].flags == HL_FOLD
- && foldmethodIsSyntax(curwin))
- /* Need to update folds later. */
+ && foldmethodIsSyntax(curwin)) {
+ // Need to update folds later.
foldUpdateAll(curwin);
+ }
}
}
@@ -4208,8 +4311,9 @@ get_syn_options(
*/
static void syn_incl_toplevel(int id, int *flagsp)
{
- if ((*flagsp & HL_CONTAINED) || curwin->w_s->b_syn_topgrp == 0)
+ if ((*flagsp & HL_CONTAINED) || curwin->w_s->b_syn_topgrp == 0) {
return;
+ }
*flagsp |= HL_CONTAINED;
if (curwin->w_s->b_syn_topgrp >= SYNID_CLUSTER) {
// We have to alloc this, because syn_combine_list() will free it.
@@ -4219,7 +4323,7 @@ static void syn_incl_toplevel(int id, int *flagsp)
grp_list[0] = id;
grp_list[1] = 0;
syn_combine_list(&SYN_CLSTR(curwin->w_s)[tlg_id].scl_list, &grp_list,
- CLUSTER_ADD);
+ CLUSTER_ADD);
}
}
@@ -4228,18 +4332,19 @@ static void syn_incl_toplevel(int id, int *flagsp)
*/
static void syn_cmd_include(exarg_T *eap, int syncing)
{
- char_u *arg = eap->arg;
+ char_u *arg = eap->arg;
int sgl_id = 1;
- char_u *group_name_end;
- char_u *rest;
- char_u *errormsg = NULL;
+ char_u *group_name_end;
+ char_u *rest;
+ char_u *errormsg = NULL;
int prev_toplvl_grp;
int prev_syn_inc_tag;
bool source = false;
eap->nextcmd = find_nextcmd(arg);
- if (eap->skip)
+ if (eap->skip) {
return;
+ }
if (arg[0] == '@') {
++arg;
@@ -4249,9 +4354,10 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
return;
}
sgl_id = syn_check_cluster(arg, (int)(group_name_end - arg));
- if (sgl_id == 0)
+ if (sgl_id == 0) {
return;
- /* separate_nextcmd() and expand_filename() depend on this */
+ }
+ // separate_nextcmd() and expand_filename() depend on this
eap->arg = rest;
}
@@ -4267,8 +4373,9 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
// ":runtime!" is used.
source = true;
if (expand_filename(eap, syn_cmdlinep, &errormsg) == FAIL) {
- if (errormsg != NULL)
+ if (errormsg != NULL) {
EMSG(errormsg);
+ }
return;
}
}
@@ -4299,13 +4406,13 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
*/
static void syn_cmd_keyword(exarg_T *eap, int syncing)
{
- char_u *arg = eap->arg;
- char_u *group_name_end;
+ char_u *arg = eap->arg;
+ char_u *group_name_end;
int syn_id;
- char_u *rest;
- char_u *keyword_copy = NULL;
- char_u *p;
- char_u *kw;
+ char_u *rest;
+ char_u *keyword_copy = NULL;
+ char_u *p;
+ char_u *kw;
syn_opt_arg_T syn_opt_arg;
int cnt;
int conceal_char = NUL;
@@ -4395,39 +4502,36 @@ error:
}
}
- if (rest != NULL)
+ if (rest != NULL) {
eap->nextcmd = check_nextcmd(rest);
- else
+ } else {
EMSG2(_(e_invarg2), arg);
+ }
redraw_curbuf_later(SOME_VALID);
- syn_stack_free_all(curwin->w_s); /* Need to recompute all syntax. */
+ syn_stack_free_all(curwin->w_s); // Need to recompute all syntax.
}
-/*
- * Handle ":syntax match {name} [{options}] {pattern} [{options}]".
- *
- * Also ":syntax sync match {name} [[grouphere | groupthere] {group-name}] .."
- */
-static void
-syn_cmd_match(
- exarg_T *eap,
- int syncing /* TRUE for ":syntax sync match .. " */
-)
-{
- char_u *arg = eap->arg;
- char_u *group_name_end;
- char_u *rest;
- synpat_T item; /* the item found in the line */
+/// Handle ":syntax match {name} [{options}] {pattern} [{options}]".
+///
+/// Also ":syntax sync match {name} [[grouphere | groupthere] {group-name}] .."
+///
+/// @param syncing TRUE for ":syntax sync match .. "
+static void syn_cmd_match(exarg_T *eap, int syncing)
+{
+ char_u *arg = eap->arg;
+ char_u *group_name_end;
+ char_u *rest;
+ synpat_T item; // the item found in the line
int syn_id;
syn_opt_arg_T syn_opt_arg;
int sync_idx = 0;
int conceal_char = NUL;
- /* Isolate the group name, check for validity */
+ // Isolate the group name, check for validity
rest = get_group_name(arg, &group_name_end);
- /* Get options before the pattern */
+ // Get options before the pattern
syn_opt_arg.flags = 0;
syn_opt_arg.keyword = false;
syn_opt_arg.sync_idx = syncing ? &sync_idx : NULL;
@@ -4437,7 +4541,7 @@ syn_cmd_match(
syn_opt_arg.next_list = NULL;
rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
- /* get the pattern. */
+ // get the pattern.
init_syn_patterns();
memset(&item, 0, sizeof(item));
rest = get_syn_pattern(rest, &item);
@@ -4448,14 +4552,14 @@ syn_cmd_match(
// Get options after the pattern
rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
- if (rest != NULL) { /* all arguments are valid */
+ if (rest != NULL) { // all arguments are valid
/*
* Check for trailing command and illegal trailing arguments.
*/
eap->nextcmd = check_nextcmd(rest);
- if (!ends_excmd(*rest) || eap->skip)
+ if (!ends_excmd(*rest) || eap->skip) {
rest = NULL;
- else {
+ } else {
if ((syn_id = syn_check_group(arg, (int)(group_name_end - arg))) != 0) {
syn_incl_toplevel(syn_id, &syn_opt_arg.flags);
/*
@@ -4473,19 +4577,22 @@ syn_cmd_match(
spp->sp_cont_list = syn_opt_arg.cont_list;
spp->sp_syn.cont_in_list = syn_opt_arg.cont_in_list;
spp->sp_cchar = conceal_char;
- if (syn_opt_arg.cont_in_list != NULL)
+ if (syn_opt_arg.cont_in_list != NULL) {
curwin->w_s->b_syn_containedin = TRUE;
+ }
spp->sp_next_list = syn_opt_arg.next_list;
- /* remember that we found a match for syncing on */
- if (syn_opt_arg.flags & (HL_SYNC_HERE|HL_SYNC_THERE))
+ // remember that we found a match for syncing on
+ if (syn_opt_arg.flags & (HL_SYNC_HERE|HL_SYNC_THERE)) {
curwin->w_s->b_syn_sync_flags |= SF_MATCH;
- if (syn_opt_arg.flags & HL_FOLD)
+ }
+ if (syn_opt_arg.flags & HL_FOLD) {
++curwin->w_s->b_syn_folditems;
+ }
redraw_curbuf_later(SOME_VALID);
- syn_stack_free_all(curwin->w_s); /* Need to recompute all syntax. */
- return; /* don't free the progs and patterns now */
+ syn_stack_free_all(curwin->w_s); // Need to recompute all syntax.
+ return; // don't free the progs and patterns now
}
}
}
@@ -4499,40 +4606,37 @@ syn_cmd_match(
xfree(syn_opt_arg.cont_in_list);
xfree(syn_opt_arg.next_list);
- if (rest == NULL)
+ if (rest == NULL) {
EMSG2(_(e_invarg2), arg);
+ }
}
-/*
- * Handle ":syntax region {group-name} [matchgroup={group-name}]
- * start {start} .. [skip {skip}] end {end} .. [{options}]".
- */
-static void
-syn_cmd_region(
- exarg_T *eap,
- int syncing /* TRUE for ":syntax sync region .." */
-)
-{
- char_u *arg = eap->arg;
- char_u *group_name_end;
- char_u *rest; /* next arg, NULL on error */
- char_u *key_end;
- char_u *key = NULL;
- char_u *p;
+/// Handle ":syntax region {group-name} [matchgroup={group-name}]
+/// start {start} .. [skip {skip}] end {end} .. [{options}]".
+///
+/// @param syncing TRUE for ":syntax sync region .."
+static void syn_cmd_region(exarg_T *eap, int syncing)
+{
+ char_u *arg = eap->arg;
+ char_u *group_name_end;
+ char_u *rest; // next arg, NULL on error
+ char_u *key_end;
+ char_u *key = NULL;
+ char_u *p;
int item;
#define ITEM_START 0
#define ITEM_SKIP 1
#define ITEM_END 2
#define ITEM_MATCHGROUP 3
struct pat_ptr {
- synpat_T *pp_synp; /* pointer to syn_pattern */
- int pp_matchgroup_id; /* matchgroup ID */
- struct pat_ptr *pp_next; /* pointer to next pat_ptr */
+ synpat_T *pp_synp; // pointer to syn_pattern
+ int pp_matchgroup_id; // matchgroup ID
+ struct pat_ptr *pp_next; // pointer to next pat_ptr
} *(pat_ptrs[3]);
- /* patterns found in the line */
- struct pat_ptr *ppp;
- struct pat_ptr *ppp_next;
- int pat_count = 0; /* nr of syn_patterns found */
+ // patterns found in the line
+ struct pat_ptr *ppp;
+ struct pat_ptr *ppp_next;
+ int pat_count = 0; // nr of syn_patterns found
int syn_id;
int matchgroup_id = 0;
bool not_enough = false; // not enough arguments
@@ -4541,7 +4645,7 @@ syn_cmd_region(
syn_opt_arg_T syn_opt_arg;
int conceal_char = NUL;
- /* Isolate the group name, check for validity */
+ // Isolate the group name, check for validity
rest = get_group_name(arg, &group_name_end);
pat_ptrs[0] = NULL;
@@ -4566,10 +4670,11 @@ syn_cmd_region(
break;
}
- /* must be a pattern or matchgroup then */
+ // must be a pattern or matchgroup then
key_end = rest;
- while (*key_end && !ascii_iswhite(*key_end) && *key_end != '=')
+ while (*key_end && !ascii_iswhite(*key_end) && *key_end != '=') {
++key_end;
+ }
xfree(key);
key = vim_strnsave_up(rest, key_end - rest);
if (STRCMP(key, "MATCHGROUP") == 0) {
@@ -4601,9 +4706,9 @@ syn_cmd_region(
if (item == ITEM_MATCHGROUP) {
p = skiptowhite(rest);
- if ((p - rest == 4 && STRNCMP(rest, "NONE", 4) == 0) || eap->skip)
+ if ((p - rest == 4 && STRNCMP(rest, "NONE", 4) == 0) || eap->skip) {
matchgroup_id = 0;
- else {
+ } else {
matchgroup_id = syn_check_group(rest, (int)(p - rest));
if (matchgroup_id == 0) {
illegal = true;
@@ -4642,8 +4747,9 @@ syn_cmd_region(
}
}
xfree(key);
- if (illegal || not_enough)
+ if (illegal || not_enough) {
rest = NULL;
+ }
// Must have a "start" and "end" pattern.
if (rest != NULL && (pat_ptrs[ITEM_START] == NULL
@@ -4658,9 +4764,9 @@ syn_cmd_region(
* If OK, add the item.
*/
eap->nextcmd = check_nextcmd(rest);
- if (!ends_excmd(*rest) || eap->skip)
+ if (!ends_excmd(*rest) || eap->skip) {
rest = NULL;
- else {
+ } else {
ga_grow(&(curwin->w_s->b_syn_patterns), pat_count);
if ((syn_id = syn_check_group(arg, (int)(group_name_end - arg))) != 0) {
syn_incl_toplevel(syn_id, &syn_opt_arg.flags);
@@ -4687,15 +4793,17 @@ syn_cmd_region(
syn_opt_arg.cont_list;
SYN_ITEMS(curwin->w_s)[idx].sp_syn.cont_in_list =
syn_opt_arg.cont_in_list;
- if (syn_opt_arg.cont_in_list != NULL)
+ if (syn_opt_arg.cont_in_list != NULL) {
curwin->w_s->b_syn_containedin = TRUE;
+ }
SYN_ITEMS(curwin->w_s)[idx].sp_next_list =
syn_opt_arg.next_list;
}
++curwin->w_s->b_syn_patterns.ga_len;
++idx;
- if (syn_opt_arg.flags & HL_FOLD)
+ if (syn_opt_arg.flags & HL_FOLD) {
++curwin->w_s->b_syn_folditems;
+ }
}
}
@@ -4709,7 +4817,7 @@ syn_cmd_region(
/*
* Free the allocated memory.
*/
- for (item = ITEM_START; item <= ITEM_END; ++item)
+ for (item = ITEM_START; item <= ITEM_END; ++item) {
for (ppp = pat_ptrs[item]; ppp != NULL; ppp = ppp_next) {
if (!success && ppp->pp_synp != NULL) {
vim_regfree(ppp->pp_synp->sp_prog);
@@ -4719,15 +4827,17 @@ syn_cmd_region(
ppp_next = ppp->pp_next;
xfree(ppp);
}
+ }
if (!success) {
xfree(syn_opt_arg.cont_list);
xfree(syn_opt_arg.cont_in_list);
xfree(syn_opt_arg.next_list);
- if (not_enough)
+ if (not_enough) {
EMSG2(_("E399: Not enough arguments: syntax region %s"), arg);
- else if (illegal || rest == NULL)
+ } else if (illegal || rest == NULL) {
EMSG2(_(e_invarg2), arg);
+ }
}
}
@@ -4742,8 +4852,7 @@ static int syn_compare_stub(const void *const v1, const void *const v2)
// Combines lists of syntax clusters.
// *clstr1 and *clstr2 must both be allocated memory; they will be consumed.
-static void syn_combine_list(int16_t **const clstr1, int16_t **const clstr2,
- const int list_op)
+static void syn_combine_list(int16_t **const clstr1, int16_t **const clstr2, const int list_op)
{
size_t count1 = 0;
size_t count2 = 0;
@@ -4754,15 +4863,18 @@ static void syn_combine_list(int16_t **const clstr1, int16_t **const clstr2,
/*
* Handle degenerate cases.
*/
- if (*clstr2 == NULL)
+ if (*clstr2 == NULL) {
return;
+ }
if (*clstr1 == NULL || list_op == CLUSTER_REPLACE) {
- if (list_op == CLUSTER_REPLACE)
+ if (list_op == CLUSTER_REPLACE) {
xfree(*clstr1);
- if (list_op == CLUSTER_REPLACE || list_op == CLUSTER_ADD)
+ }
+ if (list_op == CLUSTER_REPLACE || list_op == CLUSTER_ADD) {
*clstr1 = *clstr2;
- else
+ } else {
xfree(*clstr2);
+ }
return;
}
@@ -4794,8 +4906,9 @@ static void syn_combine_list(int16_t **const clstr1, int16_t **const clstr2,
* We always want to add from the first list.
*/
if (*g1 < *g2) {
- if (round == 2)
+ if (round == 2) {
clstr[count] = *g1;
+ }
count++;
g1++;
continue;
@@ -4805,12 +4918,14 @@ static void syn_combine_list(int16_t **const clstr1, int16_t **const clstr2,
* lists.
*/
if (list_op == CLUSTER_ADD) {
- if (round == 2)
+ if (round == 2) {
clstr[count] = *g2;
+ }
count++;
}
- if (*g1 == *g2)
+ if (*g1 == *g2) {
g1++;
+ }
g2++;
}
@@ -4819,13 +4934,18 @@ static void syn_combine_list(int16_t **const clstr1, int16_t **const clstr2,
* first. As before, we only want to add from the second list if
* we're adding the lists.
*/
- for (; *g1; g1++, count++)
- if (round == 2)
+ for (; *g1; g1++, count++) {
+ if (round == 2) {
clstr[count] = *g1;
- if (list_op == CLUSTER_ADD)
- for (; *g2; g2++, count++)
- if (round == 2)
+ }
+ }
+ if (list_op == CLUSTER_ADD) {
+ for (; *g2; g2++, count++) {
+ if (round == 2) {
clstr[count] = *g2;
+ }
+ }
+ }
if (round == 1) {
/*
@@ -4885,15 +5005,16 @@ static int syn_scl_namen2id(char_u *linep, int len)
static int syn_check_cluster(char_u *pp, int len)
{
int id;
- char_u *name;
+ char_u *name;
name = vim_strnsave(pp, len);
id = syn_scl_name2id(name);
- if (id == 0) /* doesn't exist yet */
+ if (id == 0) { // doesn't exist yet
id = syn_add_cluster(name);
- else
+ } else {
xfree(name);
+ }
return id;
}
@@ -4924,30 +5045,33 @@ static int syn_add_cluster(char_u *name)
scp->scl_name_u = vim_strsave_up(name);
scp->scl_list = NULL;
- if (STRICMP(name, "Spell") == 0)
+ if (STRICMP(name, "Spell") == 0) {
curwin->w_s->b_spell_cluster_id = len + SYNID_CLUSTER;
- if (STRICMP(name, "NoSpell") == 0)
+ }
+ if (STRICMP(name, "NoSpell") == 0) {
curwin->w_s->b_nospell_cluster_id = len + SYNID_CLUSTER;
+ }
return len + SYNID_CLUSTER;
}
/*
* Handle ":syntax cluster {cluster-name} [contains={groupname},..]
- * [add={groupname},..] [remove={groupname},..]".
+ * [add={groupname},..] [remove={groupname},..]".
*/
static void syn_cmd_cluster(exarg_T *eap, int syncing)
{
- char_u *arg = eap->arg;
- char_u *group_name_end;
- char_u *rest;
+ char_u *arg = eap->arg;
+ char_u *group_name_end;
+ char_u *rest;
bool got_clstr = false;
int opt_len;
int list_op;
eap->nextcmd = find_nextcmd(arg);
- if (eap->skip)
+ if (eap->skip) {
return;
+ }
rest = get_group_name(arg, &group_name_end);
@@ -4971,8 +5095,9 @@ static void syn_cmd_cluster(exarg_T *eap, int syncing)
&& (ascii_iswhite(rest[8]) || rest[8] == '=')) {
opt_len = 8;
list_op = CLUSTER_REPLACE;
- } else
+ } else {
break;
+ }
int16_t *clstr_list = NULL;
if (get_id_list(&rest, opt_len, &clstr_list, eap->skip) == FAIL) {
@@ -4990,14 +5115,16 @@ static void syn_cmd_cluster(exarg_T *eap, int syncing)
if (got_clstr) {
redraw_curbuf_later(SOME_VALID);
- syn_stack_free_all(curwin->w_s); /* Need to recompute all. */
+ syn_stack_free_all(curwin->w_s); // Need to recompute all.
}
}
- if (!got_clstr)
+ if (!got_clstr) {
EMSG(_("E400: No cluster specified"));
- if (rest == NULL || !ends_excmd(*rest))
+ }
+ if (rest == NULL || !ends_excmd(*rest)) {
EMSG2(_(e_invarg2), arg);
+ }
}
/*
@@ -5016,10 +5143,10 @@ static void init_syn_patterns(void)
*/
static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
{
- char_u *end;
- int *p;
+ char_u *end;
+ int *p;
int idx;
- char_u *cpo_save;
+ char_u *cpo_save;
// need at least three chars
if (arg == NULL || arg[0] == NUL || arg[1] == NUL || arg[2] == NUL) {
@@ -5027,21 +5154,22 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
}
end = skip_regexp(arg + 1, *arg, TRUE, NULL);
- if (*end != *arg) { /* end delimiter not found */
+ if (*end != *arg) { // end delimiter not found
EMSG2(_("E401: Pattern delimiter not found: %s"), arg);
return NULL;
}
// store the pattern and compiled regexp program
ci->sp_pattern = vim_strnsave(arg + 1, end - arg - 1);
- /* Make 'cpoptions' empty, to avoid the 'l' flag */
+ // Make 'cpoptions' empty, to avoid the 'l' flag
cpo_save = p_cpo;
p_cpo = (char_u *)"";
ci->sp_prog = vim_regcomp(ci->sp_pattern, RE_MAGIC);
p_cpo = cpo_save;
- if (ci->sp_prog == NULL)
+ if (ci->sp_prog == NULL) {
return NULL;
+ }
ci->sp_ic = curwin->w_s->b_syn_ic;
syn_clear_time(&ci->sp_time);
@@ -5050,41 +5178,49 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
*/
++end;
do {
- for (idx = SPO_COUNT; --idx >= 0; )
- if (STRNCMP(end, spo_name_tab[idx], 3) == 0)
+ for (idx = SPO_COUNT; --idx >= 0; ) {
+ if (STRNCMP(end, spo_name_tab[idx], 3) == 0) {
break;
+ }
+ }
if (idx >= 0) {
p = &(ci->sp_offsets[idx]);
- if (idx != SPO_LC_OFF)
+ if (idx != SPO_LC_OFF) {
switch (end[3]) {
- case 's': break;
- case 'b': break;
- case 'e': idx += SPO_COUNT; break;
- default: idx = -1; break;
+ case 's':
+ break;
+ case 'b':
+ break;
+ case 'e':
+ idx += SPO_COUNT; break;
+ default:
+ idx = -1; break;
}
+ }
if (idx >= 0) {
ci->sp_off_flags |= (1 << idx);
- if (idx == SPO_LC_OFF) { /* lc=99 */
+ if (idx == SPO_LC_OFF) { // lc=99
end += 3;
*p = getdigits_int(&end, true, 0);
- /* "lc=" offset automatically sets "ms=" offset */
+ // "lc=" offset automatically sets "ms=" offset
if (!(ci->sp_off_flags & (1 << SPO_MS_OFF))) {
ci->sp_off_flags |= (1 << SPO_MS_OFF);
ci->sp_offsets[SPO_MS_OFF] = *p;
}
- } else { /* yy=x+99 */
+ } else { // yy=x+99
end += 4;
if (*end == '+') {
end++;
*p = getdigits_int(&end, true, 0); // positive offset
- } else if (*end == '-') {
+ } else if (*end == '-') {
end++;
*p = -getdigits_int(&end, true, 0); // negative offset
}
}
- if (*end != ',')
+ if (*end != ',') {
break;
+ }
++end;
}
}
@@ -5102,14 +5238,14 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
*/
static void syn_cmd_sync(exarg_T *eap, int syncing)
{
- char_u *arg_start = eap->arg;
- char_u *arg_end;
- char_u *key = NULL;
- char_u *next_arg;
+ char_u *arg_start = eap->arg;
+ char_u *arg_end;
+ char_u *key = NULL;
+ char_u *next_arg;
int illegal = FALSE;
int finished = FALSE;
long n;
- char_u *cpo_save;
+ char_u *cpo_save;
if (ends_excmd(*arg_start)) {
syn_cmd_list(eap, TRUE);
@@ -5122,45 +5258,50 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
xfree(key);
key = vim_strnsave_up(arg_start, arg_end - arg_start);
if (STRCMP(key, "CCOMMENT") == 0) {
- if (!eap->skip)
+ if (!eap->skip) {
curwin->w_s->b_syn_sync_flags |= SF_CCOMMENT;
+ }
if (!ends_excmd(*next_arg)) {
arg_end = skiptowhite(next_arg);
- if (!eap->skip)
+ if (!eap->skip) {
curwin->w_s->b_syn_sync_id = syn_check_group(next_arg,
- (int)(arg_end - next_arg));
+ (int)(arg_end - next_arg));
+ }
next_arg = skipwhite(arg_end);
- } else if (!eap->skip)
+ } else if (!eap->skip) {
curwin->w_s->b_syn_sync_id = syn_name2id((char_u *)"Comment");
- } else if ( STRNCMP(key, "LINES", 5) == 0
- || STRNCMP(key, "MINLINES", 8) == 0
- || STRNCMP(key, "MAXLINES", 8) == 0
- || STRNCMP(key, "LINEBREAKS", 10) == 0) {
- if (key[4] == 'S')
+ }
+ } else if (STRNCMP(key, "LINES", 5) == 0
+ || STRNCMP(key, "MINLINES", 8) == 0
+ || STRNCMP(key, "MAXLINES", 8) == 0
+ || STRNCMP(key, "LINEBREAKS", 10) == 0) {
+ if (key[4] == 'S') {
arg_end = key + 6;
- else if (key[0] == 'L')
+ } else if (key[0] == 'L') {
arg_end = key + 11;
- else
+ } else {
arg_end = key + 9;
+ }
if (arg_end[-1] != '=' || !ascii_isdigit(*arg_end)) {
illegal = TRUE;
break;
}
n = getdigits_long(&arg_end, false, 0);
if (!eap->skip) {
- if (key[4] == 'B')
+ if (key[4] == 'B') {
curwin->w_s->b_syn_sync_linebreaks = n;
- else if (key[1] == 'A')
+ } else if (key[1] == 'A') {
curwin->w_s->b_syn_sync_maxlines = n;
- else
+ } else {
curwin->w_s->b_syn_sync_minlines = n;
+ }
}
- } else if (STRCMP(key, "FROMSTART") == 0) {
+ } else if (STRCMP(key, "FROMSTART") == 0) {
if (!eap->skip) {
curwin->w_s->b_syn_sync_minlines = MAXLNUM;
curwin->w_s->b_syn_sync_maxlines = 0;
}
- } else if (STRCMP(key, "LINECONT") == 0) {
+ } else if (STRCMP(key, "LINECONT") == 0) {
if (*next_arg == NUL) { // missing pattern
illegal = true;
break;
@@ -5171,18 +5312,18 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
break;
}
arg_end = skip_regexp(next_arg + 1, *next_arg, TRUE, NULL);
- if (*arg_end != *next_arg) { /* end delimiter not found */
+ if (*arg_end != *next_arg) { // end delimiter not found
illegal = TRUE;
break;
}
if (!eap->skip) {
- /* store the pattern and compiled regexp program */
+ // store the pattern and compiled regexp program
curwin->w_s->b_syn_linecont_pat =
vim_strnsave(next_arg + 1, arg_end - next_arg - 1);
curwin->w_s->b_syn_linecont_ic = curwin->w_s->b_syn_ic;
- /* Make 'cpoptions' empty, to avoid the 'l' flag */
+ // Make 'cpoptions' empty, to avoid the 'l' flag
cpo_save = p_cpo;
p_cpo = (char_u *)"";
curwin->w_s->b_syn_linecont_prog =
@@ -5199,47 +5340,43 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
next_arg = skipwhite(arg_end + 1);
} else {
eap->arg = next_arg;
- if (STRCMP(key, "MATCH") == 0)
+ if (STRCMP(key, "MATCH") == 0) {
syn_cmd_match(eap, TRUE);
- else if (STRCMP(key, "REGION") == 0)
+ } else if (STRCMP(key, "REGION") == 0) {
syn_cmd_region(eap, TRUE);
- else if (STRCMP(key, "CLEAR") == 0)
+ } else if (STRCMP(key, "CLEAR") == 0) {
syn_cmd_clear(eap, TRUE);
- else
+ } else {
illegal = TRUE;
+ }
finished = TRUE;
break;
}
arg_start = next_arg;
}
xfree(key);
- if (illegal)
+ if (illegal) {
EMSG2(_("E404: Illegal arguments: %s"), arg_start);
- else if (!finished) {
+ } else if (!finished) {
eap->nextcmd = check_nextcmd(arg_start);
redraw_curbuf_later(SOME_VALID);
- syn_stack_free_all(curwin->w_s); /* Need to recompute all syntax. */
+ syn_stack_free_all(curwin->w_s); // Need to recompute all syntax.
}
}
-/*
- * Convert a line of highlight group names into a list of group ID numbers.
- * "arg" should point to the "contains" or "nextgroup" keyword.
- * "arg" is advanced to after the last group name.
- * Careful: the argument is modified (NULs added).
- * returns FAIL for some error, OK for success.
- */
-static int
-get_id_list(
- char_u **const arg,
- const int keylen, // length of keyword
- int16_t **const list, // where to store the resulting list, if not
- // NULL, the list is silently skipped!
- const bool skip
-)
-{
- char_u *p = NULL;
- char_u *end;
+/// Convert a line of highlight group names into a list of group ID numbers.
+/// "arg" should point to the "contains" or "nextgroup" keyword.
+/// "arg" is advanced to after the last group name.
+/// Careful: the argument is modified (NULs added).
+///
+/// @param keylen length of keyword
+/// @param list where to store the resulting list, if not NULL, the list is silently skipped!
+///
+/// @return FAIL for some error, OK for success.
+static int get_id_list(char_u **const arg, const int keylen, int16_t **const list, const bool skip)
+{
+ char_u *p = NULL;
+ char_u *end;
int total_count = 0;
int16_t *retval = NULL;
regmatch_T regmatch;
@@ -5271,10 +5408,10 @@ get_id_list(
}
char_u *const name = xmalloc((int)(end - p + 3)); // leave room for "^$"
STRLCPY(name + 1, p, end - p + 1);
- if ( STRCMP(name + 1, "ALLBUT") == 0
- || STRCMP(name + 1, "ALL") == 0
- || STRCMP(name + 1, "TOP") == 0
- || STRCMP(name + 1, "CONTAINED") == 0) {
+ if (STRCMP(name + 1, "ALLBUT") == 0
+ || STRCMP(name + 1, "ALL") == 0
+ || STRCMP(name + 1, "TOP") == 0
+ || STRCMP(name + 1, "CONTAINED") == 0) {
if (TOUPPER_ASC(**arg) != 'C') {
EMSG2(_("E407: %s not allowed here"), name + 1);
failed = true;
@@ -5299,7 +5436,7 @@ get_id_list(
} else {
id = SYNID_CONTAINED + current_syn_inc_tag;
}
- } else if (name[1] == '@') {
+ } else if (name[1] == '@') {
if (skip) {
id = -1;
} else {
@@ -5364,12 +5501,14 @@ get_id_list(
++count;
}
p = skipwhite(end);
- if (*p != ',')
+ if (*p != ',') {
break;
- p = skipwhite(p + 1); /* skip comma in between arguments */
+ }
+ p = skipwhite(p + 1); // skip comma in between arguments
} while (!ends_excmd(*p));
- if (failed)
+ if (failed) {
break;
+ }
if (round == 1) {
retval = xmalloc((count + 1) * sizeof(*retval));
retval[count] = 0; // zero means end of the list
@@ -5383,11 +5522,11 @@ get_id_list(
return FAIL;
}
- if (*list == NULL)
+ if (*list == NULL) {
*list = retval;
- else
- xfree(retval); /* list already found, don't overwrite it */
-
+ } else {
+ xfree(retval); // list already found, don't overwrite it
+ }
return OK;
}
@@ -5410,20 +5549,17 @@ static int16_t *copy_id_list(const int16_t *const list)
return retval;
}
-/*
- * Check if syntax group "ssp" is in the ID list "list" of "cur_si".
- * "cur_si" can be NULL if not checking the "containedin" list.
- * Used to check if a syntax item is in the "contains" or "nextgroup" list of
- * the current item.
- * This function is called very often, keep it fast!!
- */
-static int
-in_id_list(
- stateitem_T *cur_si, // current item or NULL
- int16_t *list, // id list
- struct sp_syn *ssp, // group id and ":syn include" tag of group
- int contained // group id is contained
-)
+/// Check if syntax group "ssp" is in the ID list "list" of "cur_si".
+/// "cur_si" can be NULL if not checking the "containedin" list.
+/// Used to check if a syntax item is in the "contains" or "nextgroup" list of
+/// the current item.
+/// This function is called very often, keep it fast!!
+///
+/// @param cur_si current item or NULL
+/// @param list id list
+/// @param ssp group id and ":syn include" tag of group
+/// @param contained group id is contained
+static int in_id_list(stateitem_T *cur_si, int16_t *list, struct sp_syn *ssp, int contained)
{
int retval;
int16_t *scl_list;
@@ -5432,30 +5568,35 @@ in_id_list(
static int depth = 0;
int r;
- /* If ssp has a "containedin" list and "cur_si" is in it, return TRUE. */
+ // If ssp has a "containedin" list and "cur_si" is in it, return TRUE.
if (cur_si != NULL && ssp->cont_in_list != NULL
&& !(cur_si->si_flags & HL_MATCH)) {
/* Ignore transparent items without a contains argument. Double check
* that we don't go back past the first one. */
while ((cur_si->si_flags & HL_TRANS_CONT)
- && cur_si > (stateitem_T *)(current_state.ga_data))
+ && cur_si > (stateitem_T *)(current_state.ga_data)) {
--cur_si;
- /* cur_si->si_idx is -1 for keywords, these never contain anything. */
+ }
+ // cur_si->si_idx is -1 for keywords, these never contain anything.
if (cur_si->si_idx >= 0 && in_id_list(NULL, ssp->cont_in_list,
- &(SYN_ITEMS(syn_block)[cur_si->si_idx].sp_syn),
- SYN_ITEMS(syn_block)[cur_si->si_idx].sp_flags & HL_CONTAINED))
+ &(SYN_ITEMS(syn_block)[cur_si->si_idx].sp_syn),
+ SYN_ITEMS(syn_block)[cur_si->si_idx].sp_flags &
+ HL_CONTAINED)) {
return TRUE;
+ }
}
- if (list == NULL)
+ if (list == NULL) {
return FALSE;
+ }
/*
* If list is ID_LIST_ALL, we are in a transparent item that isn't
* inside anything. Only allow not-contained groups.
*/
- if (list == ID_LIST_ALL)
+ if (list == ID_LIST_ALL) {
return !contained;
+ }
/*
* If the first item is "ALLBUT", return TRUE if "id" is NOT in the
@@ -5465,29 +5606,34 @@ in_id_list(
item = *list;
if (item >= SYNID_ALLBUT && item < SYNID_CLUSTER) {
if (item < SYNID_TOP) {
- /* ALL or ALLBUT: accept all groups in the same file */
- if (item - SYNID_ALLBUT != ssp->inc_tag)
+ // ALL or ALLBUT: accept all groups in the same file
+ if (item - SYNID_ALLBUT != ssp->inc_tag) {
return FALSE;
- } else if (item < SYNID_CONTAINED) {
- /* TOP: accept all not-contained groups in the same file */
- if (item - SYNID_TOP != ssp->inc_tag || contained)
+ }
+ } else if (item < SYNID_CONTAINED) {
+ // TOP: accept all not-contained groups in the same file
+ if (item - SYNID_TOP != ssp->inc_tag || contained) {
return FALSE;
+ }
} else {
- /* CONTAINED: accept all contained groups in the same file */
- if (item - SYNID_CONTAINED != ssp->inc_tag || !contained)
+ // CONTAINED: accept all contained groups in the same file
+ if (item - SYNID_CONTAINED != ssp->inc_tag || !contained) {
return FALSE;
+ }
}
item = *++list;
retval = FALSE;
- } else
+ } else {
retval = TRUE;
+ }
/*
* Return "retval" if id is in the contains list.
*/
while (item != 0) {
- if (item == id)
+ if (item == id) {
return retval;
+ }
if (item >= SYNID_CLUSTER) {
scl_list = SYN_CLSTR(syn_block)[item - SYNID_CLUSTER].scl_list;
/* restrict recursiveness to 30 to avoid an endless loop for a
@@ -5496,8 +5642,9 @@ in_id_list(
++depth;
r = in_id_list(NULL, scl_list, ssp, contained);
--depth;
- if (r)
+ if (r) {
return retval;
+ }
}
}
item = *++list;
@@ -5506,8 +5653,8 @@ in_id_list(
}
struct subcommand {
- char *name; /* subcommand name */
- void (*func)(exarg_T *, int); /* function to call */
+ char *name; // subcommand name
+ void (*func)(exarg_T *, int); // function to call
};
static struct subcommand subcommands[] =
@@ -5541,8 +5688,8 @@ static struct subcommand subcommands[] =
*/
void ex_syntax(exarg_T *eap)
{
- char_u *arg = eap->arg;
- char_u *subcmd_end;
+ char_u *arg = eap->arg;
+ char_u *subcmd_end;
syn_cmdlinep = eap->cmdlinep;
@@ -5565,14 +5712,15 @@ void ex_syntax(exarg_T *eap)
}
}
xfree(subcmd_name);
- if (eap->skip)
+ if (eap->skip) {
--emsg_skip;
+ }
}
void ex_ownsyntax(exarg_T *eap)
{
- char_u *old_value;
- char_u *new_value;
+ char_u *old_value;
+ char_u *new_value;
if (curwin->w_s == &curwin->w_buffer->b_s) {
curwin->w_s = xmalloc(sizeof(synblock_T));
@@ -5662,7 +5810,7 @@ void set_context_in_syntax_cmd(expand_T *xp, const char *arg)
include_link = 0;
include_default = 0;
- /* (part of) subcommand already typed */
+ // (part of) subcommand already typed
if (*arg != NUL) {
const char *p = (const char *)skiptowhite((const char_u *)arg);
if (*p != NUL) { // Past first word.
@@ -5694,47 +5842,44 @@ void set_context_in_syntax_cmd(expand_T *xp, const char *arg)
char_u *get_syntax_name(expand_T *xp, int idx)
{
switch (expand_what) {
- case EXP_SUBCMD:
- return (char_u *)subcommands[idx].name;
- case EXP_CASE: {
- static char *case_args[] = { "match", "ignore", NULL };
- return (char_u *)case_args[idx];
+ case EXP_SUBCMD:
+ return (char_u *)subcommands[idx].name;
+ case EXP_CASE: {
+ static char *case_args[] = { "match", "ignore", NULL };
+ return (char_u *)case_args[idx];
}
- case EXP_SPELL: {
- static char *spell_args[] =
- { "toplevel", "notoplevel", "default", NULL };
- return (char_u *)spell_args[idx];
+ case EXP_SPELL: {
+ static char *spell_args[] =
+ { "toplevel", "notoplevel", "default", NULL };
+ return (char_u *)spell_args[idx];
}
- case EXP_SYNC: {
- static char *sync_args[] =
- { "ccomment", "clear", "fromstart",
- "linebreaks=", "linecont", "lines=", "match",
- "maxlines=", "minlines=", "region", NULL };
- return (char_u *)sync_args[idx];
+ case EXP_SYNC: {
+ static char *sync_args[] =
+ { "ccomment", "clear", "fromstart",
+ "linebreaks=", "linecont", "lines=", "match",
+ "maxlines=", "minlines=", "region", NULL };
+ return (char_u *)sync_args[idx];
}
}
return NULL;
}
-// Function called for expression evaluation: get syntax ID at file position.
-int syn_get_id(
- win_T *wp,
- long lnum,
- colnr_T col,
- int trans, // remove transparency
- bool *spellp, // return: can do spell checking
- int keep_state // keep state of char at "col"
-)
+/// Function called for expression evaluation: get syntax ID at file position.
+///
+/// @param trans remove transparency
+/// @param spellp return: can do spell checking
+/// @param keep_state keep state of char at "col"
+int syn_get_id(win_T *wp, long lnum, colnr_T col, int trans, bool *spellp, int keep_state)
{
// When the position is not after the current position and in the same
// line of the same buffer, need to restart parsing.
if (wp->w_buffer != syn_buf || lnum != current_lnum || col < current_col) {
syntax_start(wp, lnum);
} else if (col > current_col) {
- // next_match may not be correct when moving around, e.g. with the
- // "skip" expression in searchpair()
- next_match_idx = -1;
+ // next_match may not be correct when moving around, e.g. with the
+ // "skip" expression in searchpair()
+ next_match_idx = -1;
}
(void)get_syntax_attr(col, spellp, keep_state);
@@ -5842,8 +5987,9 @@ int syn_get_foldlevel(win_T *wp, long lnum)
}
if (level > wp->w_p_fdn) {
level = wp->w_p_fdn;
- if (level < 0)
+ if (level < 0) {
level = 0;
+ }
}
return level;
}
@@ -5879,7 +6025,7 @@ static void syn_clear_time(syn_time_T *st)
*/
static void syntime_clear(void)
{
- synpat_T *spp;
+ synpat_T *spp;
if (!syntax_present(curwin)) {
MSG(_(msg_no_items));
@@ -5898,18 +6044,22 @@ static void syntime_clear(void)
char_u *get_syntime_arg(expand_T *xp, int idx)
{
switch (idx) {
- case 0: return (char_u *)"on";
- case 1: return (char_u *)"off";
- case 2: return (char_u *)"clear";
- case 3: return (char_u *)"report";
+ case 0:
+ return (char_u *)"on";
+ case 1:
+ return (char_u *)"off";
+ case 2:
+ return (char_u *)"clear";
+ case 3:
+ return (char_u *)"report";
}
return NULL;
}
static int syn_compare_syntime(const void *v1, const void *v2)
{
- const time_entry_T *s1 = v1;
- const time_entry_T *s2 = v2;
+ const time_entry_T *s1 = v1;
+ const time_entry_T *s2 = v2;
return profile_cmp(s1->total, s2->total);
}
@@ -5954,14 +6104,13 @@ static void syntime_report(void)
syn_compare_syntime);
}
- MSG_PUTS_TITLE(_(
- " TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN"));
+ MSG_PUTS_TITLE(_(" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN"));
MSG_PUTS("\n");
for (int idx = 0; idx < ga.ga_len && !got_int; ++idx) {
p = ((time_entry_T *)ga.ga_data) + idx;
MSG_PUTS(profile_msg(p->total));
- MSG_PUTS(" "); /* make sure there is always a separating space */
+ MSG_PUTS(" "); // make sure there is always a separating space
msg_advance(13);
msg_outnum(p->count);
MSG_PUTS(" ");
@@ -5980,12 +6129,14 @@ static void syntime_report(void)
msg_advance(69);
int len;
- if (Columns < 80)
- len = 20; /* will wrap anyway */
- else
+ if (Columns < 80) {
+ len = 20; // will wrap anyway
+ } else {
len = Columns - 70;
- if (len > (int)STRLEN(p->pattern))
+ }
+ if (len > (int)STRLEN(p->pattern)) {
len = (int)STRLEN(p->pattern);
+ }
msg_outtrans_len(p->pattern, len);
MSG_PUTS("\n");
}
@@ -6000,7 +6151,7 @@ static void syntime_report(void)
}
/**************************************
-* Highlighting stuff *
+* Highlighting stuff *
**************************************/
// The default highlight groups. These are compiled-in for fast startup and
@@ -6009,8 +6160,7 @@ static void syntime_report(void)
// When making changes here, also change runtime/colors/default.vim!
static const char *highlight_init_both[] = {
- "Conceal "
- "ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey",
+ "Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey",
"Cursor guibg=fg guifg=bg",
"lCursor guibg=fg guifg=bg",
"DiffText cterm=bold ctermbg=Red gui=bold guibg=Red",
@@ -6042,10 +6192,8 @@ static const char *highlight_init_both[] = {
"RedrawDebugClear ctermbg=Yellow guibg=Yellow",
"RedrawDebugComposed ctermbg=Green guibg=Green",
"RedrawDebugRecompose ctermbg=Red guibg=Red",
- "Error term=reverse cterm=NONE ctermfg=White ctermbg=Red gui=NONE "
- "guifg=White guibg=Red",
- "Todo term=standout cterm=NONE ctermfg=Black ctermbg=Yellow gui=NONE "
- "guifg=Blue guibg=Yellow",
+ "Error term=reverse cterm=NONE ctermfg=White ctermbg=Red gui=NONE guifg=White guibg=Red",
+ "Todo term=standout cterm=NONE ctermfg=Black ctermbg=Yellow gui=NONE guifg=Blue guibg=Yellow",
"default link String Constant",
"default link Character Constant",
"default link Number Constant",
@@ -6103,24 +6251,15 @@ static const char *highlight_init_light[] = {
"Title ctermfg=DarkMagenta gui=bold guifg=Magenta",
"Visual guibg=LightGrey",
"WarningMsg ctermfg=DarkRed guifg=Red",
- "Comment term=bold cterm=NONE ctermfg=DarkBlue ctermbg=NONE "
- "gui=NONE guifg=Blue guibg=NONE",
- "Constant term=underline cterm=NONE ctermfg=DarkRed ctermbg=NONE "
- "gui=NONE guifg=Magenta guibg=NONE",
- "Special term=bold cterm=NONE ctermfg=DarkMagenta ctermbg=NONE "
- "gui=NONE guifg=#6a5acd guibg=NONE",
- "Identifier term=underline cterm=NONE ctermfg=DarkCyan ctermbg=NONE "
- "gui=NONE guifg=DarkCyan guibg=NONE",
- "Statement term=bold cterm=NONE ctermfg=Brown ctermbg=NONE "
- "gui=bold guifg=Brown guibg=NONE",
- "PreProc term=underline cterm=NONE ctermfg=DarkMagenta ctermbg=NONE "
- "gui=NONE guifg=#6a0dad guibg=NONE",
- "Type term=underline cterm=NONE ctermfg=DarkGreen ctermbg=NONE "
- "gui=bold guifg=SeaGreen guibg=NONE",
- "Underlined term=underline cterm=underline ctermfg=DarkMagenta "
- "gui=underline guifg=SlateBlue",
- "Ignore term=NONE cterm=NONE ctermfg=white ctermbg=NONE "
- "gui=NONE guifg=bg guibg=NONE",
+ "Comment term=bold cterm=NONE ctermfg=DarkBlue ctermbg=NONE gui=NONE guifg=Blue guibg=NONE",
+ "Constant term=underline cterm=NONE ctermfg=DarkRed ctermbg=NONE gui=NONE guifg=Magenta guibg=NONE",
+ "Special term=bold cterm=NONE ctermfg=DarkMagenta ctermbg=NONE gui=NONE guifg=#6a5acd guibg=NONE",
+ "Identifier term=underline cterm=NONE ctermfg=DarkCyan ctermbg=NONE gui=NONE guifg=DarkCyan guibg=NONE",
+ "Statement term=bold cterm=NONE ctermfg=Brown ctermbg=NONE gui=bold guifg=Brown guibg=NONE",
+ "PreProc term=underline cterm=NONE ctermfg=DarkMagenta ctermbg=NONE gui=NONE guifg=#6a0dad guibg=NONE",
+ "Type term=underline cterm=NONE ctermfg=DarkGreen ctermbg=NONE gui=bold guifg=SeaGreen guibg=NONE",
+ "Underlined term=underline cterm=underline ctermfg=DarkMagenta gui=underline guifg=SlateBlue",
+ "Ignore term=NONE cterm=NONE ctermfg=white ctermbg=NONE gui=NONE guifg=bg guibg=NONE",
NULL
};
@@ -6154,24 +6293,15 @@ static const char *highlight_init_dark[] = {
"Title ctermfg=LightMagenta gui=bold guifg=Magenta",
"Visual guibg=DarkGrey",
"WarningMsg ctermfg=LightRed guifg=Red",
- "Comment term=bold cterm=NONE ctermfg=Cyan ctermbg=NONE "
- "gui=NONE guifg=#80a0ff guibg=NONE",
- "Constant term=underline cterm=NONE ctermfg=Magenta ctermbg=NONE "
- "gui=NONE guifg=#ffa0a0 guibg=NONE",
- "Special term=bold cterm=NONE ctermfg=LightRed ctermbg=NONE "
- "gui=NONE guifg=Orange guibg=NONE",
- "Identifier term=underline cterm=bold ctermfg=Cyan ctermbg=NONE "
- "gui=NONE guifg=#40ffff guibg=NONE",
- "Statement term=bold cterm=NONE ctermfg=Yellow ctermbg=NONE "
- "gui=bold guifg=#ffff60 guibg=NONE",
- "PreProc term=underline cterm=NONE ctermfg=LightBlue ctermbg=NONE "
- "gui=NONE guifg=#ff80ff guibg=NONE",
- "Type term=underline cterm=NONE ctermfg=LightGreen ctermbg=NONE "
- "gui=bold guifg=#60ff60 guibg=NONE",
- "Underlined term=underline cterm=underline ctermfg=LightBlue "
- "gui=underline guifg=#80a0ff",
- "Ignore term=NONE cterm=NONE ctermfg=black ctermbg=NONE "
- "gui=NONE guifg=bg guibg=NONE",
+ "Comment term=bold cterm=NONE ctermfg=Cyan ctermbg=NONE gui=NONE guifg=#80a0ff guibg=NONE",
+ "Constant term=underline cterm=NONE ctermfg=Magenta ctermbg=NONE gui=NONE guifg=#ffa0a0 guibg=NONE",
+ "Special term=bold cterm=NONE ctermfg=LightRed ctermbg=NONE gui=NONE guifg=Orange guibg=NONE",
+ "Identifier term=underline cterm=bold ctermfg=Cyan ctermbg=NONE gui=NONE guifg=#40ffff guibg=NONE",
+ "Statement term=bold cterm=NONE ctermfg=Yellow ctermbg=NONE gui=bold guifg=#ffff60 guibg=NONE",
+ "PreProc term=underline cterm=NONE ctermfg=LightBlue ctermbg=NONE gui=NONE guifg=#ff80ff guibg=NONE",
+ "Type term=underline cterm=NONE ctermfg=LightGreen ctermbg=NONE gui=bold guifg=#60ff60 guibg=NONE",
+ "Underlined term=underline cterm=underline ctermfg=LightBlue gui=underline guifg=#80a0ff",
+ "Ignore term=NONE cterm=NONE ctermfg=black ctermbg=NONE gui=NONE guifg=bg guibg=NONE",
NULL
};
@@ -6278,12 +6408,9 @@ const char *const highlight_init_cmdline[] = {
"default link NvimInvalidAssignment NvimInvalid",
"default link NvimInvalidPlainAssignment NvimInvalidAssignment",
"default link NvimInvalidAugmentedAssignment NvimInvalidAssignment",
- "default link NvimInvalidAssignmentWithAddition "
- "NvimInvalidAugmentedAssignment",
- "default link NvimInvalidAssignmentWithSubtraction "
- "NvimInvalidAugmentedAssignment",
- "default link NvimInvalidAssignmentWithConcatenation "
- "NvimInvalidAugmentedAssignment",
+ "default link NvimInvalidAssignmentWithAddition NvimInvalidAugmentedAssignment",
+ "default link NvimInvalidAssignmentWithSubtraction NvimInvalidAugmentedAssignment",
+ "default link NvimInvalidAssignmentWithConcatenation NvimInvalidAugmentedAssignment",
"default link NvimInvalidOperator NvimInvalid",
@@ -6345,7 +6472,7 @@ const char *const highlight_init_cmdline[] = {
"default link NvimInvalidOptionName NvimInvalidIdentifier",
"default link NvimInvalidOptionScope NvimInvalidIdentifierScope",
"default link NvimInvalidOptionScopeDelimiter "
- "NvimInvalidIdentifierScopeDelimiter",
+ "NvimInvalidIdentifierScopeDelimiter",
"default link NvimInvalidEnvironmentSigil NvimInvalidOptionSigil",
"default link NvimInvalidEnvironmentName NvimInvalidIdentifier",
@@ -6403,7 +6530,7 @@ void init_highlight(bool both, bool reset)
bool okay = load_colors(copy_p);
xfree(copy_p);
if (okay) {
- return;
+ return;
}
}
@@ -6436,8 +6563,7 @@ void init_highlight(bool both, bool reset)
* to avoid Statement highlighted text disappears.
* Clear the attributes, needed when changing the t_Co value. */
if (t_colors > 8) {
- do_highlight(
- (*p_bg == 'l'
+ do_highlight((*p_bg == 'l'
? "Visual cterm=NONE ctermbg=LightGrey"
: "Visual cterm=NONE ctermbg=DarkGrey"), false, true);
} else {
@@ -6456,7 +6582,7 @@ void init_highlight(bool both, bool reset)
*/
int load_colors(char_u *name)
{
- char_u *buf;
+ char_u *buf;
int retval = FAIL;
static bool recursive = false;
@@ -6492,46 +6618,47 @@ static char *(color_names[28]) = {
"DarkGray", "DarkGrey",
"Blue", "LightBlue", "Green", "LightGreen",
"Cyan", "LightCyan", "Red", "LightRed", "Magenta",
- "LightMagenta", "Yellow", "LightYellow", "White", "NONE" };
- // indices:
- // 0, 1, 2, 3,
- // 4, 5, 6, 7,
- // 8, 9, 10, 11,
- // 12, 13,
- // 14, 15, 16, 17,
- // 18, 19, 20, 21, 22,
- // 23, 24, 25, 26, 27
+ "LightMagenta", "Yellow", "LightYellow", "White", "NONE"
+};
+// indices:
+// 0, 1, 2, 3,
+// 4, 5, 6, 7,
+// 8, 9, 10, 11,
+// 12, 13,
+// 14, 15, 16, 17,
+// 18, 19, 20, 21, 22,
+// 23, 24, 25, 26, 27
static int color_numbers_16[28] = { 0, 1, 2, 3,
- 4, 5, 6, 6,
- 7, 7, 7, 7,
- 8, 8,
- 9, 9, 10, 10,
- 11, 11, 12, 12, 13,
- 13, 14, 14, 15, -1 };
+ 4, 5, 6, 6,
+ 7, 7, 7, 7,
+ 8, 8,
+ 9, 9, 10, 10,
+ 11, 11, 12, 12, 13,
+ 13, 14, 14, 15, -1 };
// for xterm with 88 colors...
static int color_numbers_88[28] = { 0, 4, 2, 6,
- 1, 5, 32, 72,
- 84, 84, 7, 7,
- 82, 82,
- 12, 43, 10, 61,
- 14, 63, 9, 74, 13,
- 75, 11, 78, 15, -1 };
+ 1, 5, 32, 72,
+ 84, 84, 7, 7,
+ 82, 82,
+ 12, 43, 10, 61,
+ 14, 63, 9, 74, 13,
+ 75, 11, 78, 15, -1 };
// for xterm with 256 colors...
static int color_numbers_256[28] = { 0, 4, 2, 6,
- 1, 5, 130, 3,
- 248, 248, 7, 7,
- 242, 242,
- 12, 81, 10, 121,
- 14, 159, 9, 224, 13,
- 225, 11, 229, 15, -1 };
+ 1, 5, 130, 3,
+ 248, 248, 7, 7,
+ 242, 242,
+ 12, 81, 10, 121,
+ 14, 159, 9, 224, 13,
+ 225, 11, 229, 15, -1 };
// for terminals with less than 16 colors...
static int color_numbers_8[28] = { 0, 4, 2, 6,
- 1, 5, 3, 3,
- 7, 7, 7, 7,
- 0+8, 0+8,
- 4+8, 4+8, 2+8, 2+8,
- 6+8, 6+8, 1+8, 1+8, 5+8,
- 5+8, 3+8, 3+8, 7+8, -1 };
+ 1, 5, 3, 3,
+ 7, 7, 7, 7,
+ 0+8, 0+8,
+ 4+8, 4+8, 2+8, 2+8,
+ 6+8, 6+8, 1+8, 1+8, 5+8,
+ 5+8, 3+8, 3+8, 7+8, -1 };
// Lookup the "cterm" value to be used for color with index "idx" in
// color_names[].
@@ -6849,7 +6976,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (error) {
break;
}
- if (*key == 'C') {
+ if (*key == 'C') {
if (!init || !(HL_TABLE()[idx].sg_set & SG_CTERM)) {
if (!init) {
HL_TABLE()[idx].sg_set |= SG_CTERM;
@@ -6865,7 +6992,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
HL_TABLE()[idx].sg_gui = attr;
}
}
- } else if (STRCMP(key, "FONT") == 0) {
+ } else if (STRCMP(key, "FONT") == 0) {
// in non-GUI fonts are simply ignored
} else if (STRCMP(key, "CTERMFG") == 0 || STRCMP(key, "CTERMBG") == 0) {
if (!init || !(HL_TABLE()[idx].sg_set & SG_CTERM)) {
@@ -6890,10 +7017,10 @@ void do_highlight(const char *line, const bool forceit, const bool init)
error = true;
break;
}
- } else if (STRICMP(arg, "bg") == 0) {
- if (cterm_normal_bg_color > 0)
+ } else if (STRICMP(arg, "bg") == 0) {
+ if (cterm_normal_bg_color > 0) {
color = cterm_normal_bg_color - 1;
- else {
+ } else {
EMSG(_("E420: BG color unknown"));
error = true;
break;
@@ -6960,7 +7087,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
}
}
}
- } else if (strcmp(key, "GUIFG") == 0) {
+ } else if (strcmp(key, "GUIFG") == 0) {
char **namep = &HL_TABLE()[idx].sg_rgb_fg_name;
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) {
@@ -6984,7 +7111,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (is_normal_group) {
normal_fg = HL_TABLE()[idx].sg_rgb_fg;
}
- } else if (STRCMP(key, "GUIBG") == 0) {
+ } else if (STRCMP(key, "GUIBG") == 0) {
char **const namep = &HL_TABLE()[idx].sg_rgb_bg_name;
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) {
@@ -7008,7 +7135,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (is_normal_group) {
normal_bg = HL_TABLE()[idx].sg_rgb_bg;
}
- } else if (strcmp(key, "GUISP") == 0) {
+ } else if (strcmp(key, "GUISP") == 0) {
char **const namep = &HL_TABLE()[idx].sg_rgb_sp_name;
if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) {
@@ -7032,9 +7159,9 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (is_normal_group) {
normal_sp = HL_TABLE()[idx].sg_rgb_sp;
}
- } else if (strcmp(key, "START") == 0 || strcmp(key, "STOP") == 0) {
+ } else if (strcmp(key, "START") == 0 || strcmp(key, "STOP") == 0) {
// Ignored for now
- } else if (strcmp(key, "BLEND") == 0) {
+ } else if (strcmp(key, "BLEND") == 0) {
if (strcmp(arg, "NONE") != 0) {
HL_TABLE()[idx].sg_blend = strtol(arg, NULL, 10);
} else {
@@ -7134,13 +7261,13 @@ void restore_cterm_colors(void)
static int hl_has_settings(int idx, bool check_link)
{
return HL_TABLE()[idx].sg_cleared == 0
- && (HL_TABLE()[idx].sg_attr != 0
- || HL_TABLE()[idx].sg_cterm_fg != 0
- || HL_TABLE()[idx].sg_cterm_bg != 0
- || HL_TABLE()[idx].sg_rgb_fg_name != NULL
- || HL_TABLE()[idx].sg_rgb_bg_name != NULL
- || HL_TABLE()[idx].sg_rgb_sp_name != NULL
- || (check_link && (HL_TABLE()[idx].sg_set & SG_LINK)));
+ && (HL_TABLE()[idx].sg_attr != 0
+ || HL_TABLE()[idx].sg_cterm_fg != 0
+ || HL_TABLE()[idx].sg_cterm_bg != 0
+ || HL_TABLE()[idx].sg_rgb_fg_name != NULL
+ || HL_TABLE()[idx].sg_rgb_bg_name != NULL
+ || HL_TABLE()[idx].sg_rgb_sp_name != NULL
+ || (check_link && (HL_TABLE()[idx].sg_set & SG_LINK)));
}
/*
@@ -7188,18 +7315,18 @@ static void highlight_list_one(const int id)
}
didh = highlight_list_arg(id, didh, LIST_ATTR,
- sgp->sg_cterm, NULL, "cterm");
+ sgp->sg_cterm, NULL, "cterm");
didh = highlight_list_arg(id, didh, LIST_INT,
- sgp->sg_cterm_fg, NULL, "ctermfg");
+ sgp->sg_cterm_fg, NULL, "ctermfg");
didh = highlight_list_arg(id, didh, LIST_INT,
- sgp->sg_cterm_bg, NULL, "ctermbg");
+ sgp->sg_cterm_bg, NULL, "ctermbg");
didh = highlight_list_arg(id, didh, LIST_ATTR,
- sgp->sg_gui, NULL, "gui");
+ sgp->sg_gui, NULL, "gui");
didh = highlight_list_arg(id, didh, LIST_STRING,
- 0, sgp->sg_rgb_fg_name, "guifg");
+ 0, sgp->sg_rgb_fg_name, "guifg");
didh = highlight_list_arg(id, didh, LIST_STRING,
- 0, sgp->sg_rgb_bg_name, "guibg");
+ 0, sgp->sg_rgb_bg_name, "guibg");
didh = highlight_list_arg(id, didh, LIST_STRING,
0, sgp->sg_rgb_sp_name, "guisp");
@@ -7245,9 +7372,8 @@ Dictionary get_global_hl_defs(void)
/// @param type one of \ref LIST_XXX
/// @param iarg integer argument used if \p type == LIST_INT
/// @param sarg string used if \p type == LIST_STRING
-static bool highlight_list_arg(
- const int id, bool didh, const int type, int iarg,
- char *const sarg, const char *const name)
+static bool highlight_list_arg(const int id, bool didh, const int type, int iarg, char *const sarg,
+ const char *const name)
{
char buf[100];
@@ -7264,10 +7390,11 @@ static bool highlight_list_arg(
buf[0] = NUL;
for (int i = 0; hl_attr_table[i] != 0; i++) {
if (iarg & hl_attr_table[i]) {
- if (buf[0] != NUL)
+ if (buf[0] != NUL) {
xstrlcat((char *)buf, ",", 100);
+ }
xstrlcat((char *)buf, hl_name_table[i], 100);
- iarg &= ~hl_attr_table[i]; /* don't want "inverse" */
+ iarg &= ~hl_attr_table[i]; // don't want "inverse"
}
}
}
@@ -7320,8 +7447,7 @@ const char *highlight_has_attr(const int id, const int flag, const int modec)
///
/// @return color name, possibly in a static buffer. Buffer will be overwritten
/// on next highlight_color() call. May return NULL.
-const char *highlight_color(const int id, const char *const what,
- const int modec)
+const char *highlight_color(const int id, const char *const what, const int modec)
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
static char name[20];
@@ -7347,11 +7473,11 @@ const char *highlight_color(const int id, const char *const what,
if (modec == 'g') {
if (what[2] == '#' && ui_rgb_attached()) {
if (fg) {
- n = HL_TABLE()[id - 1].sg_rgb_fg;
+ n = HL_TABLE()[id - 1].sg_rgb_fg;
} else if (sp) {
- n = HL_TABLE()[id - 1].sg_rgb_sp;
+ n = HL_TABLE()[id - 1].sg_rgb_sp;
} else {
- n = HL_TABLE()[id - 1].sg_rgb_bg;
+ n = HL_TABLE()[id - 1].sg_rgb_bg;
}
if (n < 0 || n > 0xffffff) {
return NULL;
@@ -7393,8 +7519,8 @@ const char *highlight_color(const int id, const char *const what,
/// @param id highlight group id
/// @param force_newline always start a new line
/// @return true when started a new line.
-static bool syn_list_header(const bool did_header, const int outlen,
- const int id, bool force_newline)
+static bool syn_list_header(const bool did_header, const int outlen, const int id,
+ bool force_newline)
{
int endcol = 19;
bool newline = true;
@@ -7410,7 +7536,7 @@ static bool syn_list_header(const bool did_header, const int outlen,
} else if ((ui_has(kUIMessages) || msg_silent) && !force_newline) {
msg_putchar(' ');
adjust = false;
- } else if (msg_col + outlen + 1 >= Columns || force_newline) {
+ } else if (msg_col + outlen + 1 >= Columns || force_newline) {
msg_putchar('\n');
if (got_int) {
return true;
@@ -7430,7 +7556,7 @@ static bool syn_list_header(const bool did_header, const int outlen,
msg_advance(endcol);
}
- /* Show "xxx" with the attributes. */
+ // Show "xxx" with the attributes.
if (!did_header) {
msg_puts_attr("xxx", syn_id2attr(id));
msg_putchar(' ');
@@ -7445,7 +7571,7 @@ static bool syn_list_header(const bool did_header, const int outlen,
static void set_hl_attr(int idx)
{
HlAttrs at_en = HLATTRS_INIT;
- struct hl_group *sgp = HL_TABLE() + idx;
+ struct hl_group *sgp = HL_TABLE() + idx;
at_en.cterm_ae_attr = sgp->sg_cterm;
at_en.cterm_fg_color = sgp->sg_cterm_fg;
@@ -7525,8 +7651,9 @@ int highlight_exists(const char_u *name)
*/
char_u *syn_id2name(int id)
{
- if (id <= 0 || id > highlight_ga.ga_len)
+ if (id <= 0 || id > highlight_ga.ga_len) {
return (char_u *)"";
+ }
return HL_TABLE()[id - 1].sg_name;
}
@@ -7554,15 +7681,15 @@ int syn_check_group(const char_u *name, int len)
/// @see syn_check_group syn_unadd_group
static int syn_add_group(char_u *name)
{
- char_u *p;
+ char_u *p;
- /* Check that the name is ASCII letters, digits and underscore. */
+ // Check that the name is ASCII letters, digits and underscore.
for (p = name; *p != NUL; ++p) {
if (!vim_isprintc(*p)) {
EMSG(_("E669: Unprintable character in group name"));
xfree(name);
return 0;
- } else if (!ASCII_ISALNUM(*p) && *p != '_') {
+ } else if (!ASCII_ISALNUM(*p) && *p != '_') {
/* This is an error, but since there previously was no check only
* give a warning. */
msg_source(HL_ATTR(HLF_W));
@@ -7588,7 +7715,7 @@ static int syn_add_group(char_u *name)
char *const name_up = (char *)vim_strsave_up(name);
// Append another syntax_highlight entry.
- struct hl_group* hlgp = GA_APPEND_VIA_PTR(struct hl_group, &highlight_ga);
+ struct hl_group * hlgp = GA_APPEND_VIA_PTR(struct hl_group, &highlight_ga);
memset(hlgp, 0, sizeof(*hlgp));
hlgp->sg_name = name;
hlgp->sg_rgb_bg = -1;
@@ -7640,9 +7767,9 @@ int syn_get_final_id(int hl_id)
{
int count;
- if (hl_id > highlight_ga.ga_len || hl_id < 1)
- return 0; /* Can be called from eval!! */
-
+ if (hl_id > highlight_ga.ga_len || hl_id < 1) {
+ return 0; // Can be called from eval!!
+ }
/*
* Follow links until there is no more.
* Look out for loops! Break after 100 links.
@@ -7690,8 +7817,7 @@ void highlight_attr_set_all(void)
}
// Apply difference between User[1-9] and HLF_S to HLF_SNC.
-static void combine_stl_hlt(int id, int id_S, int id_alt, int hlcnt, int i,
- int hlf, int *table)
+static void combine_stl_hlt(int id, int id_S, int id_alt, int hlcnt, int i, int hlf, int *table)
FUNC_ATTR_NONNULL_ALL
{
struct hl_group *const hlt = HL_TABLE();
@@ -7808,7 +7934,7 @@ void set_context_in_highlight_cmd(expand_T *xp, const char *arg)
include_link = 2;
include_default = 1;
- /* (part of) subcommand already typed */
+ // (part of) subcommand already typed
if (*arg != NUL) {
const char *p = (const char *)skiptowhite((const char_u *)arg);
if (*p != NUL) { // Past "default" or group name.
@@ -7818,7 +7944,7 @@ void set_context_in_highlight_cmd(expand_T *xp, const char *arg)
xp->xp_pattern = (char_u *)arg;
p = (const char *)skiptowhite((const char_u *)arg);
}
- if (*p != NUL) { /* past group name */
+ if (*p != NUL) { // past group name
include_link = 0;
if (arg[1] == 'i' && arg[0] == 'N') {
highlight_list();
@@ -8597,7 +8723,6 @@ color_name_table_T color_name_table[] = {
/// return the hex value or -1 if could not find a correct value
RgbValue name_to_color(const char *name)
{
-
if (name[0] == '#' && isxdigit(name[1]) && isxdigit(name[2])
&& isxdigit(name[3]) && isxdigit(name[4]) && isxdigit(name[5])
&& isxdigit(name[6]) && name[7] == NUL) {
@@ -8620,5 +8745,5 @@ RgbValue name_to_color(const char *name)
/**************************************
-* End of Highlighting stuff *
+* End of Highlighting stuff *
**************************************/
diff --git a/src/nvim/testdir/test_ins_complete.vim b/src/nvim/testdir/test_ins_complete.vim
index 0fb026f6b0..ce75799551 100644
--- a/src/nvim/testdir/test_ins_complete.vim
+++ b/src/nvim/testdir/test_ins_complete.vim
@@ -497,6 +497,133 @@ func Test_ins_compl_tag_sft()
%bwipe!
endfunc
+" Test for completing special characters
+func Test_complete_special_chars()
+ new
+ call setline(1, 'int .*[-\^$ func float')
+ call feedkeys("oin\<C-X>\<C-P>\<C-X>\<C-P>\<C-X>\<C-P>", 'xt')
+ call assert_equal('int .*[-\^$ func float', getline(2))
+ close!
+endfunc
+
+" Test for completion when text is wrapped across lines.
+func Test_complete_across_line()
+ new
+ call setline(1, ['red green blue', 'one two three'])
+ setlocal textwidth=20
+ exe "normal 2G$a re\<C-X>\<C-P>\<C-X>\<C-P>\<C-X>\<C-P>\<C-X>\<C-P>"
+ call assert_equal(['one two three red', 'green blue one'], getline(2, '$'))
+ close!
+endfunc
+
+" Test for using CTRL-L to add one character when completing matching
+func Test_complete_add_onechar()
+ new
+ call setline(1, ['wool', 'woodwork'])
+ call feedkeys("Gowoo\<C-P>\<C-P>\<C-P>\<C-L>f", 'xt')
+ call assert_equal('woof', getline(3))
+
+ " use 'ignorecase' and backspace to erase characters from the prefix string
+ " and then add letters using CTRL-L
+ %d
+ set ignorecase backspace=2
+ setlocal complete=.
+ call setline(1, ['workhorse', 'workload'])
+ normal Go
+ exe "normal aWOR\<C-P>\<bs>\<bs>\<bs>\<bs>\<bs>\<bs>\<C-L>r\<C-L>\<C-L>"
+ call assert_equal('workh', getline(3))
+ set ignorecase& backspace&
+ close!
+endfunc
+
+" Test insert completion with 'cindent' (adjust the indent)
+func Test_complete_with_cindent()
+ new
+ setlocal cindent
+ call setline(1, ['if (i == 1)', " j = 2;"])
+ exe "normal Go{\<CR>i\<C-X>\<C-L>\<C-X>\<C-L>\<CR>}"
+ call assert_equal(['{', "\tif (i == 1)", "\t\tj = 2;", '}'], getline(3, '$'))
+
+ %d
+ call setline(1, ['when while', '{', ''])
+ setlocal cinkeys+==while
+ exe "normal Giwh\<C-P> "
+ call assert_equal("\twhile ", getline('$'))
+ close!
+endfunc
+
+" Test for <CTRL-X> <CTRL-V> completion. Complete commands and functions
+func Test_complete_cmdline()
+ new
+ exe "normal icaddb\<C-X>\<C-V>"
+ call assert_equal('caddbuffer', getline(1))
+ exe "normal ocall getqf\<C-X>\<C-V>"
+ call assert_equal('call getqflist(', getline(2))
+ exe "normal oabcxyz(\<C-X>\<C-V>"
+ call assert_equal('abcxyz(', getline(3))
+ com! -buffer TestCommand1 echo 'TestCommand1'
+ com! -buffer TestCommand2 echo 'TestCommand2'
+ write TestCommand1Test
+ write TestCommand2Test
+ " Test repeating <CTRL-X> <CTRL-V> and switching to another CTRL-X mode
+ exe "normal oT\<C-X>\<C-V>\<C-X>\<C-V>\<C-X>\<C-F>\<Esc>"
+ call assert_equal('TestCommand2Test', getline(4))
+ call delete('TestCommand1Test')
+ call delete('TestCommand2Test')
+ delcom TestCommand1
+ delcom TestCommand2
+ close!
+endfunc
+
+" Test for <CTRL-X> <CTRL-Z> stopping completion without changing the match
+func Test_complete_stop()
+ new
+ func Save_mode1()
+ let g:mode1 = mode(1)
+ return ''
+ endfunc
+ func Save_mode2()
+ let g:mode2 = mode(1)
+ return ''
+ endfunc
+ inoremap <F1> <C-R>=Save_mode1()<CR>
+ inoremap <F2> <C-R>=Save_mode2()<CR>
+ call setline(1, ['aaa bbb ccc '])
+ exe "normal A\<C-N>\<C-P>\<F1>\<C-X>\<C-Z>\<F2>\<Esc>"
+ call assert_equal('ic', g:mode1)
+ call assert_equal('i', g:mode2)
+ call assert_equal('aaa bbb ccc ', getline(1))
+ exe "normal A\<C-N>\<Down>\<F1>\<C-X>\<C-Z>\<F2>\<Esc>"
+ call assert_equal('ic', g:mode1)
+ call assert_equal('i', g:mode2)
+ call assert_equal('aaa bbb ccc aaa', getline(1))
+ set completeopt+=noselect
+ exe "normal A \<C-N>\<Down>\<Down>\<C-L>\<C-L>\<F1>\<C-X>\<C-Z>\<F2>\<Esc>"
+ call assert_equal('ic', g:mode1)
+ call assert_equal('i', g:mode2)
+ call assert_equal('aaa bbb ccc aaa bb', getline(1))
+ set completeopt&
+ exe "normal A d\<C-N>\<F1>\<C-X>\<C-Z>\<F2>\<Esc>"
+ call assert_equal('ic', g:mode1)
+ call assert_equal('i', g:mode2)
+ call assert_equal('aaa bbb ccc aaa bb d', getline(1))
+ com! -buffer TestCommand1 echo 'TestCommand1'
+ com! -buffer TestCommand2 echo 'TestCommand2'
+ exe "normal oT\<C-X>\<C-V>\<C-X>\<C-V>\<F1>\<C-X>\<C-Z>\<F2>\<Esc>"
+ call assert_equal('ic', g:mode1)
+ call assert_equal('i', g:mode2)
+ call assert_equal('TestCommand2', getline(2))
+ delcom TestCommand1
+ delcom TestCommand2
+ unlet g:mode1
+ unlet g:mode2
+ iunmap <F1>
+ iunmap <F2>
+ delfunc Save_mode1
+ delfunc Save_mode2
+ close!
+endfunc
+
" Test to ensure 'Scanning...' messages are not recorded in messages history
func Test_z1_complete_no_history()
new
diff --git a/src/nvim/window.c b/src/nvim/window.c
index cb4be36d36..42fe2c0f49 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -840,14 +840,15 @@ void ui_ext_win_viewport(win_T *wp)
{
if ((wp == curwin || ui_has(kUIMultigrid)) && wp->w_viewport_invalid) {
int botline = wp->w_botline;
- if (botline == wp->w_buffer->b_ml.ml_line_count+1
- && wp->w_empty_rows == 0) {
+ int line_count = wp->w_buffer->b_ml.ml_line_count;
+ if (botline == line_count+1 && wp->w_empty_rows == 0) {
// TODO(bfredl): The might be more cases to consider, like how does this
// interact with incomplete final line? Diff filler lines?
botline = wp->w_buffer->b_ml.ml_line_count;
}
ui_call_win_viewport(wp->w_grid_alloc.handle, wp->handle, wp->w_topline-1,
- botline, wp->w_cursor.lnum-1, wp->w_cursor.col);
+ botline, wp->w_cursor.lnum-1, wp->w_cursor.col,
+ line_count);
wp->w_viewport_invalid = false;
}
}