:h help.txt (:h local-additions)に日本語が挿入されている
Closed this issue · 7 comments
h-east commented
tsuyoshicho commented
local-additionはvim本体(or バンドルされてるスクリプト)で自動なうえ、 local-addition@en だと本家ヘルプファイルのはずなので...、たぶんworkshop.txtの元がtxtに日本語書いてるのかもですね
と、思ったけど、workshopがvimdocに含まれてるから、その影響かもですねえ...
k-takata commented
src/help.c の fix_help_buffer() で挿入されているようです。
が、何で workshop.jax のタグが @en の方にも入るんでしょうね?
k-takata commented
検索の終了条件をミスって最後のファイルが追加されている疑惑
h-east commented
このpatchで良いと思う。
↓この判定は i2 を参照していないので、2重ループに入る前におこなうべき。
そうしないと最後の要素が2重ループ冒頭のif (i1 == i2)の判定でcontinueされて消されずに残ってしまう。
if (fnamecmp(e1, ".txt") != 0
&& fnamecmp(e1, fname + 4) != 0)
diff --git a/src/help.c b/src/help.c
index d67f78b08..020e182e9 100644
--- a/src/help.c
+++ b/src/help.c
@@ -818,27 +818,27 @@ fix_help_buffer(void)
// the same directory.
for (i1 = 0; i1 < fcount; ++i1)
{
+ f1 = fnames[i1];
+ t1 = gettail(f1);
+ e1 = vim_strrchr(t1, '.');
+ if (fnamecmp(e1, ".txt") != 0
+ && fnamecmp(e1, fname + 4) != 0)
+ {
+ // Not .txt and not .abx, remove it.
+ VIM_CLEAR(fnames[i1]);
+ continue;
+ }
for (i2 = 0; i2 < fcount; ++i2)
{
if (i1 == i2)
continue;
if (fnames[i1] == NULL || fnames[i2] == NULL)
continue;
- f1 = fnames[i1];
f2 = fnames[i2];
- t1 = gettail(f1);
t2 = gettail(f2);
- e1 = vim_strrchr(t1, '.');
e2 = vim_strrchr(t2, '.');
if (e1 == NULL || e2 == NULL)
continue;
- if (fnamecmp(e1, ".txt") != 0
- && fnamecmp(e1, fname + 4) != 0)
- {
- // Not .txt and not .abx, remove it.
- VIM_CLEAR(fnames[i1]);
- continue;
- }
if (e1 - f1 != e2 - f2
|| fnamencmp(f1, f2, e1 - f1) != 0)
continue;h-east commented
もう少し改良。
- i2 ループの開始値は
i1+1でいいのでは? - (i1 ループの冒頭で)
fnames[i1] == NULLが真になることはないのでは?
diff --git a/src/help.c b/src/help.c
index d67f78b..bb4b89c 100644
--- a/src/help.c
+++ b/src/help.c
@@ -818,27 +818,26 @@ fix_help_buffer(void)
// the same directory.
for (i1 = 0; i1 < fcount; ++i1)
{
- for (i2 = 0; i2 < fcount; ++i2)
+ f1 = fnames[i1];
+ t1 = gettail(f1);
+ e1 = vim_strrchr(t1, '.');
+ if (fnamecmp(e1, ".txt") != 0
+ && fnamecmp(e1, fname + 4) != 0)
+ {
+ // Not .txt and not .abx, remove it.
+ VIM_CLEAR(fnames[i1]);
+ continue;
+ }
+
+ for (i2 = i1+1; i2 < fcount; ++i2)
{
- if (i1 == i2)
- continue;
- if (fnames[i1] == NULL || fnames[i2] == NULL)
- continue;
- f1 = fnames[i1];
f2 = fnames[i2];
- t1 = gettail(f1);
+ if (f2 == NULL)
+ continue;
t2 = gettail(f2);
- e1 = vim_strrchr(t1, '.');
e2 = vim_strrchr(t2, '.');
if (e1 == NULL || e2 == NULL)
continue;
- if (fnamecmp(e1, ".txt") != 0
- && fnamecmp(e1, fname + 4) != 0)
- {
- // Not .txt and not .abx, remove it.
- VIM_CLEAR(fnames[i1]);
- continue;
- }
if (e1 - f1 != e2 - f2
|| fnamencmp(f1, f2, e1 - f1) != 0)
continue;h-east commented
PRed.
vim/vim#9464
h-east commented
patch 8.2.3992で取り込まれました。
Thanks for the hint.
