diff options
79 files changed, 1310 insertions, 1679 deletions
diff --git a/.gitignore b/.gitignore index 3ad1a352eb..629e73169e 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ /.vim-src/ # Files generated by the tests +/src/nvim/testdir/del /src/nvim/testdir/mbyte.vim /src/nvim/testdir/mzscheme.vim /src/nvim/testdir/lua.vim diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index b303ad61b1..8994c313b3 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1551,9 +1551,9 @@ v:profiling Normally zero. Set to one after using ":profile start". See |profiling|. *v:progname* *progname-variable* -v:progname Contains the name (with path removed) with which Vim was - invoked. Allows you to do special initialisations for |view|, - |rview|, or any other name you might symlink to Vim. +v:progname Contains the name (with path removed) with which Nvim was + invoked. Allows you to do special initialisations for any + other name you might symlink to Nvim. Read-only. *v:progpath* *progpath-variable* diff --git a/runtime/doc/manpages/de/vim-de.1 b/runtime/doc/manpages/de/vim-de.1 index d958372012..e956a22755 100644 --- a/runtime/doc/manpages/de/vim-de.1 +++ b/runtime/doc/manpages/de/vim-de.1 @@ -17,15 +17,6 @@ vim \- Vi IMproved, ein Text\-Editor für Programmierer \fBvim\fP [Optionen] \-t Tag .br \fBvim\fP [Optionen] \-q [Fehlerdatei] -.PP -.br -\fBex\fP -.br -\fBview\fP -.br -\fBgvim\fP \fBgview\fP -.br -\fBrvim\fP \fBrview\fP \fBrgvim\fP \fBrgview\fP .SH BESCHREIBUNG \fBVim\fP ist ein Text\-Editor, der aufwärtskompatibel zu Vi ist. Er kann verwendet werden, um alle Arten von Klartext zu bearbeiten. Er ist besonders @@ -82,29 +73,6 @@ erste Fehler wird angezeigt. Falls [Fehlerdatei] ausgelassen wird, wird der Dateiname aus der Option 'errorfile' verwendet (bei AmigaOS ist dies vorgabemäßig »AztecC.Err«, sowie „errors.err« bei anderen). Weitere Fehler können mit dem »:cn«\-Befehl angesprungen werden. Siehe „:help quickfix«. -.PP -\fBVim\fP reagiert unterschiedlich auf den Namen, der verwendet wird, um Vim zu -starten (die ausführbare Datei kann dieselbe sein). -.TP 10 -vim -der »normale« Weg, alles ist standardmäßig -.TP -ex -Startet im Ex\-Modus. Mit dem Befehl »:vi« gelangt man in den normalen -Modus. Funktioniert auch mit dem Argument »\-e«. -.TP -view -Startet im Nur\-Lesen\-Modus. Die Datei wird vor dem Überschreiben -geschützt. Dasselbe wird mit dem Parameter »\-R« erreicht. -.TP -gvim gview -Die grafische Version: Öffnet ein neues Fenster. Dasselbe wird mit dem -Parameter »\-g« erreicht. -.TP -rvim rview rgvim rgview -Wie die obigen, aber mit Beschränkungen: Es ist nicht möglich, Shell\-Befehle -aufzurufen oder mit Unterbrechung in eine Shell zurückzuspringen. Dasselbe -wird mit dem Parameter »\-Z« erreicht. .SH OPTIONEN Die Optionen können in beliebiger Reihenfolge vor oder nach den Dateinamen angegeben werden. Optionen ohne Parameter können hinter einem einzigen @@ -305,11 +273,6 @@ Ausführlich (verbose): Gibt Meldungen darüber, welche Befehlsdateien eingelesen werden, und über das Lesen und Schreiben einer VimInfo\-Datei. Die optionale Zahl N ist der Wert für 'verbose'. Vorgabe ist 10. .TP -\-v -Startet \fBVim\fP im Vi\-Modus, so als würde die ausführbare Datei mit »vi« -aufgerufen. Dies wirkt sich nur aus, wenn die ausführbare Datei als »ex« -aufgerufen wird. -.TP \-w {Ausgabeskript} Alle Zeichen, die eingetippt werden, werden in der Datei {Ausgabeskript} aufgezeichnet, solange bis Sie \fBVim\fP beenden. Dies ist nützlich, falls Sie diff --git a/runtime/doc/manpages/fr/vim-fr.1 b/runtime/doc/manpages/fr/vim-fr.1 index 2b2a50765f..158779de0c 100644 --- a/runtime/doc/manpages/fr/vim-fr.1 +++ b/runtime/doc/manpages/fr/vim-fr.1 @@ -21,19 +21,6 @@ vim \- Vi IMproved, éditeur de texte pour programmeurs .br .B vim [options] \-q [fichiererreurs] -.PP -.br -.B ex -.br -.B view -.br -.B gvim -.B gview -.br -.B rvim -.B rview -.B rgvim -.B rgview .SH DESCRIPTION .B Vim est un éditeur de texte proposant une compatibilité ascendante @@ -101,33 +88,6 @@ l'option 'errorfile' ("AztecC.Err" par défaut sur Amiga, "errors.err" sur les autres systèmes). La commande ":cn" permet de sauter aux erreurs suivantes. Voir ":help quickfix". -.PP -.B Vim -se comporte différemment selon le nom de la commande (l'exécutable peut -cependant être le même fichier). -.TP 10 -vim -La façon "normale", le comportement par défaut. -.TP -ex -Démarre en mode Ex. -La commande ":vi" permet de passer en mode Normal. -Ce mode est également accessible avec l'argument "\-e". -.TP -view -Démarre en mode Lecture-Seule. Vous êtes protégé de l'écriture accidentelle -des fichiers. Ce mode est également accessible avec l'argument "\-R". -.TP -gvim gview -La version graphique. -Ouvre une nouvelle fenêtre. -Également accessible avec l'argument "\-g". -.TP -rvim rview rgvim rgview -Comme ci-dessus, mais avec des restrictions. Il vous sera impossible de -lancer des commandes du shell, ou de suspendre -.B Vim. -Également accessible avec l'argument "\-Z". .SH OPTIONS Les options peuvent être spécifiées dans n'importe quel ordre, avant ou après les noms de fichiers. Les options sans arguments @@ -389,12 +349,6 @@ Donne des messages à propos des fichiers sourcés, ainsi que sur la lecture et les écritures dans le fichier viminfo. le nombre optionnel N précise la valeur de l'option 'verbose' (10 par défaut). .TP -\-v -Démarre -.B Vim -en mode Vi, comme si l'exécutable s'appelait "vi". Cela n'a d'effet que si -l'exécutable invoqué est "ex". -.TP \-w {scriptSortie} Tous les caractères que vous tapez sont enregistrés dans le fichier {scriptSortie}, jusqu'à ce que vous quittiez diff --git a/runtime/doc/manpages/it/vim-it.1 b/runtime/doc/manpages/it/vim-it.1 index 36ece8fb0b..ad7ef51934 100644 --- a/runtime/doc/manpages/it/vim-it.1 +++ b/runtime/doc/manpages/it/vim-it.1 @@ -14,19 +14,6 @@ vim \- VI Migliorato, un editor di testi per programmatori .br .B vim [opzioni] \-q [file_errori] -.PP -.br -.B ex -.br -.B view -.br -.B gvim -.B gview -.br -.B rvim -.B rview -.B rgvim -.B rgview .SH DESCRIZIONE .B Vim Un editore di testi, compatibile con, e migliore di, Vi. @@ -94,33 +81,6 @@ dell'opzione 'errorfile' (che, se non specificata, vale "AztecC.Err" per l'Amiga, "errors.err" su altri sistemi). Si può saltare all'errore successivo col comando ":cn". Vedere ":help quickfix". -.PP -.B Vim -si comporta in modo diverso se invocato con nomi differenti (il programma -eseguibile "sottostante" può essere sempre lo stesso). -.TP 10 -vim -Modo Normal, comportamento normale. -.TP -ex -Inizia in Modo "Ex". -Si può passare in Modo Normal col comando ":vi". -Si può invocare il Modo "Ex" anche con l'argomento "\-e". -.TP -view -Inizia in Modo Read-only (Sola Lettura). Non potete modificare i file. -Si può invocare il Modo Read-only anche con l'argomento "\-R". -.TP -gvim gview -La versione GUI [Graphical User Interface]. -Apre una nuova finestra. -Si può invocare il Modo GUI anche con l'argomento "\-g". -.TP -rvim rview rgvim rgview -Come sopra, ma con restrizioni ai comandi. Non si potranno eseguire comandi -della shell o sospendere -.B Vim. -Si può chiedere la stessa cosa anche con l'argomento "\-Z". .SH OPZIONI Le opzioni possono essere in un ordine qualsiasi, prima o dopo i nomi di file. Opzioni che non necessitano un argomento possono essere specificate @@ -372,12 +332,6 @@ e quando legge o scrive un file viminfo. Il numero opzionale N è il valore dell'opzione 'verbose'. Il valore predefinito è 10. .TP -\-v -Inizia -.B Vim -in Modo Vi, come se il programma eseguibile fosse "vi". Questo ha -effetto solo quando Vim viene invocato con il nome "ex". -.TP \-w {scriptout} Ogni carattere immesso viene registrato nel file {scriptout}, finché non uscite da diff --git a/runtime/doc/manpages/ja/vim-ja.1 b/runtime/doc/manpages/ja/vim-ja.1 index 9a9111a69f..4bb432aae1 100644 --- a/runtime/doc/manpages/ja/vim-ja.1 +++ b/runtime/doc/manpages/ja/vim-ja.1 @@ -14,19 +14,6 @@ vim \- Vi IMproved, プログラマのテキストエディタ .br .B vim [options] \-q [errorfile] -.PP -.br -.B ex -.br -.B view -.br -.B gvim -.B gview -.br -.B rvim -.B rview -.B rgvim -.B rgview .SH 説明 .B Vim は Vi 互換のテキストエディタです。 @@ -84,33 +71,6 @@ tags ファイルから {tag} が検索され、関連したファイルがカ は、Amiga では "AztecC.Err"、その他のシステムでは "errors.err" です)。 ":cn" コマンドで次のエラーにジャンプできます。 詳しくは ":help quickfix" を参照してください。 -.PP -.B Vim -は、起動されたときの実行ファイルの名前によって動作を変えます -(実行ファイルの実体が同じであっても)。 -.TP 10 -vim -"普通" に起動します。標準の状態です。 -.TP -ex -Ex モードで起動します。 -ノーマルモードに切り替えるには ":vi" コマンドを使ってください。 -引数に "\-e" を指定した場合と同じです。 -.TP -view -読み込み専用モードで起動します。ファイルの保存が制限されます。 -引数に "\-R" を指定した場合と同じです。 -.TP -gvim gview -GUI バージョン。 -新しいウィンドウを開いて起動します。 -引数に "\-g" を指定した場合と同じです。 -.TP -rvim rview rgvim rgview -上記と同じですが、制限モードで起動します。シェルコマンドを実行したり、 -.B Vim -をサスペンドしたりできなくなります。 -引数に "\-Z" を指定した場合と同じです。 .SH オプション ファイル名の前でも後ろでも、好きな順番でオプションを指定できます。 パラメータを必要としない引数は、一つのダッシュにまとめて指定できます。 @@ -320,11 +280,6 @@ termcap または terminfo ファイルで定義されている名前を指定 びにメッセージを表示します。N に指定した数値が 'verbose' に設定されます。 省略した場合は 10 になります。 .TP -\-v -Vi モードで起動します。 -実行ファイルの名前が "vi" の場合と同じです。 -実行ファイルの名前が "ex" の場合だけ効果があります。 -.TP \-w {scriptout} 入力した文字を {scriptout} に記録します。 "vim \-s" や "source!" で実行するためのスクリプトファイルを作成するのに便利 diff --git a/runtime/doc/manpages/pl/vim-pl.1 b/runtime/doc/manpages/pl/vim-pl.1 index e92c3fd35f..71ba6e3ffa 100644 --- a/runtime/doc/manpages/pl/vim-pl.1 +++ b/runtime/doc/manpages/pl/vim-pl.1 @@ -14,19 +14,6 @@ vim \- Vi rozbudowany, edytor tekstu dla programisty .br .B vim [opcje] \-q [plik_błędu] -.PP -.br -.B ex -.br -.B view -.br -.B gvim -.B gview -.br -.B rvim -.B rview -.B rgvim -.B rgview .SH OPIS .B Vim jest edytorem tekstu kompatybilnym z Vi. Może być @@ -93,35 +80,6 @@ Jeśli brak opcji [plik_błędów] nazwa pliku zostanie pobrana z opcji systemów. Do kolejnych błędów można przeskoczyć dzięki poleceniu ":cn". Zobacz ":help quickfix". -.PP -W zależności od wywołania -.B Vim -zachowuje się inaczej (program może być cały czas tym samym -plikiem). -.TP 10 -vim -"Normalny" sposób, wszystko jest domyślne. -.TP -ex -Zacznij w trybie Ex. -Przejdź do trybu Normalnego poleceniem ":vi". -Można także uruchomić poprzez argument "\-e". -.TP -view -Zacznij w trybie tylko do odczytu. W ten sposób będziesz chroniony -przed zapisywaniem pliku. Można także uruchomić poprzez argument -"\-R". -.TP -gvim gview -Wersja GUI. -Uruchamia nowe okno. -Można także uruchomić poprzez argument "\-g". -.TP -rvim rview rgvim rgview -Podobnie jak powyżej, ale z ograniczeniami. Nie będzie można uruchomić -poleceń powłoki lub zawiesić -.B Vima. -Można także uruchomić poprzez argument "\-Z". .SH OPCJE Opcje można podać w dowolnej kolejności, przed lub po nazwach plików. Opcje bez argumentów można łączyć po pojedynczym myślniku. @@ -371,12 +329,6 @@ Tryb gadatliwy. Wypisz wiadomości o tym jaki pliki są wczytywane i o informacjach pobieranych i dodawanych do pliku viminfo. Opcjonalny argument N jest wartością 'verbose'. Domyślnie 10. .TP -\-v -Uruchom -.B Vima -w trybie Vi, tak jakby program był nazwany "vi". Ma znaczenie -tylko wtedy jeśli program nazwany jest "ex". -.TP \-w {plik} Wszystkie wciśnięcia klawiszy, aż do zakończenia działania programu, są zapisywane w {plik} . diff --git a/runtime/doc/manpages/ru/vim-ru.1 b/runtime/doc/manpages/ru/vim-ru.1 index c48fb6691a..90bdeddc0c 100644 --- a/runtime/doc/manpages/ru/vim-ru.1 +++ b/runtime/doc/manpages/ru/vim-ru.1 @@ -14,19 +14,6 @@ vim \- Vi IMproved (Улучшенный Vi), текстовый редакто .br .B vim [ключи] \-q [файл ошибок] -.PP -.br -.B ex -.br -.B view -.br -.B gvim -.B gview -.br -.B rvim -.B rview -.B rgvim -.B rgview .SH ОПИСАНИЕ .B Vim -- текстовый редактор, обратно-совместимый с Vi. @@ -90,32 +77,6 @@ vim \- Vi IMproved (Улучшенный Vi), текстовый редакто (по умолчанию: "AztecC.Err" для Amiga, "errors.err" для других систем). К следующим ошибкам можно перейти по команде ":cn". См. ":help quickfix". -.PP -.B Vim -ведёт себя по-разному в зависимости от имени команды (исполняемый файл может -быть одним и тем же). -.TP 10 -vim -"Нормальный" запуск, всё по умолчанию. -.TP -ex -Запуск в режиме Ex. Для перехода в нормальный режим -необходимо выполнить команду ":vi". Режим Ex включает -также ключ "\-e". -.TP -view -Запуск в режиме "только для чтения". Вы будете защищены от случайной записи -файла. То же самое можно сделать ключом "\-R". -.TP -gvim gview -Версия с графическим интерфейсом. Запускается в новом окне. -То же самое можно сделать при запуске с ключом "\-g". -.TP -rvim rview rgvim rgview -Как и предыдущие команды, но с ограничениями. Нельзя запускать команды оболочки -или приостанавливать работу -.B Vim. -Вместо приставки "r" можно использовать ключ "\-Z". .SH КЛЮЧИ Ключи могут быть указаны в любом порядке, до или после имён файлов. Ключи без аргументов могут быть объединены под одним @@ -329,12 +290,6 @@ rvim rview rgvim rgview "Болтливый" режим. Выводить сообщения о том, какие файлы читаются, и о чтении-записи файла viminfo. .TP -\-v -Запустить -.B Vim -в режиме Vi, как будто исполняемый файл имеет имя "vi". Имеет смысл только если -исполняемый файл имеет имя "ex". -.TP \-w {scriptout} Все символы, введённые с клавиатуры вплоть до момента завершения работы, записываются в файл {scriptout}. diff --git a/runtime/doc/manpages/vim.1 b/runtime/doc/manpages/vim.1 index c35fa78f0d..d4e9ab2ad8 100644 --- a/runtime/doc/manpages/vim.1 +++ b/runtime/doc/manpages/vim.1 @@ -14,19 +14,6 @@ vim \- Vi IMproved, a programmers text editor .br .B vim [options] \-q [errorfile] -.PP -.br -.B ex -.br -.B view -.br -.B gvim -.B gview -.br -.B rvim -.B rview -.B rgvim -.B rgview .SH DESCRIPTION .B Vim is a text editor that is upwards compatible to Vi. @@ -91,33 +78,6 @@ If [errorfile] is omitted, the filename is obtained from the 'errorfile' option (defaults to "errors.err"). Further errors can be jumped to with the ":cn" command. See ":help quickfix". -.PP -.B Vim -behaves differently, depending on the name of the command (the executable may -still be the same file). -.TP 10 -vim -The "normal" way, everything is default. -.TP -ex -Start in Ex mode. -Go to Normal mode with the ":vi" command. -Can also be done with the "\-e" argument. -.TP -view -Start in read-only mode. You will be protected from writing the files. Can -also be done with the "\-R" argument. -.TP -gvim gview -The GUI version. -Starts a new window. -Can also be done with the "\-g" argument. -.TP -rvim rview rgvim rgview -Like the above, but with restrictions. It will not be possible to start shell -commands, or suspend -.B Vim. -Can also be done with the "\-Z" argument. .SH OPTIONS The options may be given in any order, before or after filenames. Options without an argument can be combined after a single dash. @@ -188,12 +148,12 @@ script. \-e Start .B Vim -in Ex mode, just like the executable was called "ex". +in Ex mode. .TP \-E Start .B Vim -in improved Ex mode, just like the executable was called "exim". +in improved Ex mode. .TP \-f Foreground. For the GUI version, @@ -319,8 +279,7 @@ appended. See ":help recovery". .TP \-s -Silent mode. Only when started as "Ex" or when the "\-e" option was given -before the "\-s" option. +Silent mode. Only when the "\-e" option was given before the "\-s" option. .TP \-s {scriptin} The script file {scriptin} is read. @@ -357,12 +316,6 @@ Verbose. Give messages about which files are sourced and for reading and writing a viminfo file. The optional number N is the value for 'verbose'. Default is 10. .TP -\-v -Start -.B Vim -in Vi mode, just like the executable was called "vi". This only has effect -when the executable is called "ex". -.TP \-w {scriptout} All the characters that you type are recorded in the file {scriptout}, until you exit @@ -379,7 +332,7 @@ Don't connect to the X server. Shortens startup time in a terminal, but the window title and clipboard will not be used. .TP \-Z -Restricted mode. Works like the executable starts with "r". +Restricted mode. .TP \-\- Denotes the end of the options. diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index 0e4418ba6a..5d251e7b68 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -1128,7 +1128,6 @@ Context-sensitive completion on the command-line: |-+| +[num] put the cursor at line [num] (default: last line) |-+c| +{command} execute {command} after loading the file |-+/| +/{pat} {file} .. put the cursor at the first occurrence of {pat} -|-v| -v Vi mode, start ex in Normal mode |-e| -e Ex mode, start vim in Ex mode |-R| -R Read-only mode, implies -n |-m| -m modifications not allowed (resets 'write' option) diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 39cb522002..bb555e1666 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -19,11 +19,11 @@ Starting Vim *starting* Most often, Vim is started to edit a single file with the command - vim filename *-vim* + nvim filename *-vim* More generally, Vim is started with: - vim [option | filename] .. + nvim [option | filename] .. Option arguments and file name arguments can be mixed, and any number of them can be given. However, watch out for options that take an argument. @@ -39,7 +39,7 @@ filename One or more file names. The first one will be the current on the first line of the buffer. To avoid a file name starting with a '-' being interpreted as an option, precede the arglist with "--", e.g.: > - vim -- -filename + nvim -- -filename < All arguments after the "--" will be interpreted as file names, no other options or "+command" argument can follow. @@ -48,22 +48,18 @@ filename One or more file names. The first one will be the current mode is to be used. Starting in Normal mode: > - vim - - ex -v - + nvim - < Start editing a new buffer, which is filled with text that is read from stdin. The commands that would normally be read from stdin will now be read from stderr. Example: > - find . -name "*.c" -print | vim - + find . -name "*.c" -print | nvim - < The buffer will be marked modified, because it contains text that needs to be saved. Except when in readonly mode, then the buffer is not marked modified. Example: > - ls | view - -< + ls | nvim -R - Starting in Ex mode: > - ex - - vim -e - - exim - - vim -E + nvim -e - + nvim -E < Start editing in silent mode. See |-s-ex|. *-t* *-tag* @@ -85,32 +81,6 @@ filename One or more file names. The first one will be the current (nothing) Without one of the four items above, Vim will start editing a new buffer. It's empty and doesn't have a file name. - -The startup mode can be changed by using another name instead of "vim", which -is equal to giving options: -ex vim -e Start in Ex mode (see |Ex-mode|). *ex* -exim vim -E Start in improved Ex mode (see |Ex-mode|). *exim* - (normally not installed) -view vim -R Start in read-only mode (see |-R|). *view* -gvim vim -g Start the GUI (see |gui|). *gvim* -gex vim -eg Start the GUI in Ex mode. *gex* -gview vim -Rg Start the GUI in read-only mode. *gview* -rvim vim -Z Like "vim", but in restricted mode (see |-Z|) *rvim* -rview vim -RZ Like "view", but in restricted mode. *rview* -rgvim vim -gZ Like "gvim", but in restricted mode. *rgvim* -rgview vim -RgZ Like "gview", but in restricted mode. *rgview* - -Additional characters may follow, they are ignored. For example, you can have -"gvim-5" to start the GUI. You must have an executable by that name then, of -course. - -On Unix, you would normally have one executable called Vim, and links from the -different startup-names to that executable. If your system does not support -links and you do not want to have several copies of the executable, you could -use an alias instead. For example: > - alias view vim -R - alias gvim vim -g -< *startup-options* The option arguments may be given in any order. Single-letter options can be combined after one dash. There can be no option arguments after the "--" @@ -245,28 +215,20 @@ argument. -g Start Vim in GUI mode. See |gui|. For the opposite see |-v|. {not in Vi} - *-v* --v Start Ex in Vi mode. Only makes a difference when the - executable is called "ex" or "gvim". For gvim the GUI is not - started if possible. - *-e* --e Start Vim in Ex mode |Q|. Only makes a difference when the - executable is not called "ex". +-e Start Vim in Ex mode |Q|. *-E* --E Start Vim in improved Ex mode |gQ|. Only makes a difference - when the executable is not called "exim". - {not in Vi} +-E Start Vim in improved Ex mode |gQ|. *-s-ex* --s Silent or batch mode. Only when Vim was started as "ex" or - when preceded with the "-e" argument. Otherwise see |-s|, - which does take an argument while this use of "-s" doesn't. - To be used when Vim is used to execute Ex commands from a file - instead of a terminal. Switches off most prompts and - informative messages. Also warnings and error messages. - The output of these commands is displayed (to stdout): +-s Silent or batch mode. Only when "-s" is preceded by the "-e" + argument. Otherwise see |-s|, which does take an argument + while this use of "-s" doesn't. To be used when Vim is used + to execute Ex commands from a file instead of a terminal. + Switches off most prompts and informative messages. Also + warnings and error messages. The output of these commands is + displayed (to stdout): :print :list :number @@ -561,14 +523,6 @@ argument. Note that the implementation is still primitive. It won't work with all applications and the menu doesn't work. -If the executable is called "view", Vim will start in Readonly mode. This is -useful if you can make a hard or symbolic link from "view" to "vim". -Starting in Readonly mode can also be done with "vim -R". - -If the executable is called "ex", Vim will start in "Ex" mode. This means it -will accept only ":" commands. But when the "-v" argument is given, Vim will -start in Normal mode anyway. - Additional arguments are available on unix like systems when compiled with X11 GUI support. See |gui-resources|. diff --git a/runtime/doc/usr_90.txt b/runtime/doc/usr_90.txt index 4be0e93718..ab0b8156f8 100644 --- a/runtime/doc/usr_90.txt +++ b/runtime/doc/usr_90.txt @@ -434,27 +434,9 @@ someone supplied, you can't do this. Do delete the files manually, here is an example for when "/usr/local" was used as the root: > rm -rf /usr/local/share/vim/vim61 - rm /usr/local/bin/ex - rm /usr/local/bin/gview - rm /usr/local/bin/gvim - rm /usr/local/bin/gvim - rm /usr/local/bin/rgview - rm /usr/local/bin/rgvim - rm /usr/local/bin/rview - rm /usr/local/bin/rvim - rm /usr/local/bin/rvim - rm /usr/local/bin/view rm /usr/local/bin/vim rm /usr/local/bin/vimtutor rm /usr/local/bin/xxd - rm /usr/local/man/man1/ex.1 - rm /usr/local/man/man1/gview.1 - rm /usr/local/man/man1/gvim.1 - rm /usr/local/man/man1/rgview.1 - rm /usr/local/man/man1/rgvim.1 - rm /usr/local/man/man1/rview.1 - rm /usr/local/man/man1/rvim.1 - rm /usr/local/man/man1/view.1 rm /usr/local/man/man1/vim.1 rm /usr/local/man/man1/vimtutor.1 rm /usr/local/man/man1/xxd.1 diff --git a/runtime/doc/vi_diff.txt b/runtime/doc/vi_diff.txt index b4e621e516..919002cffd 100644 --- a/runtime/doc/vi_diff.txt +++ b/runtime/doc/vi_diff.txt @@ -830,10 +830,9 @@ Only Vim is able to accept options in between and after the file names. -D Vim: debug mode. --e Elvis, Nvi, Vim: Start in Ex mode, as if the executable is - called "ex". +-e Elvis, Nvi, Vim: Start in Ex mode. --E Vim: Start in improved Ex mode |gQ|, like "exim". +-E Vim: Start in improved Ex mode |gQ|. -f Vim: Run GUI in foreground. -f {session} Elvis: Use {session} as the session file. diff --git a/runtime/syntax/dirpager.vim b/runtime/syntax/dirpager.vim index 1a60063798..40137e4936 100644 --- a/runtime/syntax/dirpager.vim +++ b/runtime/syntax/dirpager.vim @@ -14,7 +14,7 @@ " License: VIM License " Vim is Charityware, see ":help Uganda" " -" Usage: $ ls -la | view -c "set ft=dirpager" - +" Usage: $ ls -la | nvim -R -c "set ft=dirpager" - " " ",----[ ls(1posix) ]-------------------------------------------------- diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index f852c8b561..587e19fe35 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -145,7 +145,7 @@ String vim_command_output(String str, Error *err) Object vim_eval(String str, Error *err) FUNC_ATTR_DEFERRED { - Object rv; + Object rv = OBJECT_INIT; // Evaluate the expression try_start(); typval_T *expr_result = eval_expr((char_u *) str.data, NULL); diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index c4abcd77b1..5ece645b0d 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -213,7 +213,7 @@ open_buffer ( * So the modelines have priority over auto commands. */ /* When reading stdin, the buffer contents always needs writing, so set - * the changed flag. Unless in readonly mode: "ls | gview -". + * the changed flag. Unless in readonly mode: "ls | nvim -R -". * When interrupted and 'cpoptions' contains 'i' set changed flag. */ if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL) || modified_was_set /* ":set modified" used in autocmd */ @@ -725,7 +725,7 @@ do_bufdel ( */ if (bnr == curbuf->b_fnum) do_current = bnr; - else if (do_buffer(command, DOBUF_FIRST, FORWARD, (int)bnr, + else if (do_buffer(command, DOBUF_FIRST, FORWARD, bnr, forceit) == OK) ++deleted; diff --git a/src/nvim/charset.c b/src/nvim/charset.c index b8fcd2de09..5e11e202a3 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -1103,7 +1103,7 @@ static int win_nolbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp) if ((*s == TAB) && (!wp->w_p_list || lcs_tab1)) { n = wp->w_buffer->b_p_ts; - return (int)(n - (col % n)); + return n - (col % n); } n = ptr2cells(s); diff --git a/src/nvim/edit.c b/src/nvim/edit.c index c6716dc870..14b3968f2d 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -545,7 +545,7 @@ edit ( mincol = curwin->w_wcol; validate_cursor_col(); - if ((int)curwin->w_wcol < mincol - curbuf->b_p_ts + if (curwin->w_wcol < mincol - curbuf->b_p_ts && curwin->w_wrow == curwin->w_winrow + curwin->w_height - 1 - p_so && (curwin->w_cursor.lnum != curwin->w_topline @@ -4893,7 +4893,7 @@ insertchar ( return; /* Check whether this character should end a comment. */ - if (did_ai && (int)c == end_comment_pending) { + if (did_ai && c == end_comment_pending) { char_u *line; char_u lead_end[COM_MAX_LEN]; /* end-comment string */ int middle_len, end_len; diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index e98032da5c..739243cbee 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -853,7 +853,7 @@ void do_bang(int addr_count, exarg_T *eap, int forceit, int do_in, int do_out) int scroll_save = msg_scroll; /* - * Disallow shell commands for "rvim". + * Disallow shell commands in restricted mode (-Z) * Disallow shell commands from .exrc and .vimrc in current directory for * security reasons. */ @@ -1217,7 +1217,7 @@ do_shell ( int save_nwr; /* - * Disallow shell commands for "rvim". + * Disallow shell commands in restricted mode (-Z) * Disallow shell commands from .exrc and .vimrc in current directory for * security reasons. */ @@ -3378,7 +3378,7 @@ void ex_z(exarg_T *eap) int check_restricted(void) { if (restricted) { - EMSG(_("E145: Shell commands not allowed in rvim")); + EMSG(_("E145: Shell commands not allowed in restricted mode")); return TRUE; } return FALSE; @@ -5136,7 +5136,7 @@ void fix_help_buffer(void) // Note: We cannot just do `&NameBuff` because it is a statically sized array // so `NameBuff == &NameBuff` according to C semantics. - char_u *buff_list[1] = {(char_u*) NameBuff}; + char_u *buff_list[1] = {NameBuff}; if (gen_expand_wildcards(1, buff_list, &fcount, &fnames, EW_FILE|EW_SILENT) == OK && fcount > 0) { @@ -5308,7 +5308,7 @@ void ex_helptags(exarg_T *eap) // Note: We cannot just do `&NameBuff` because it is a statically sized array // so `NameBuff == &NameBuff` according to C semantics. - char_u *buff_list[1] = {(char_u*) NameBuff}; + char_u *buff_list[1] = {NameBuff}; if (gen_expand_wildcards(1, buff_list, &filecount, &files, EW_FILE|EW_SILENT) == FAIL || filecount == 0) { @@ -5411,7 +5411,7 @@ helptags_one ( // Note: We cannot just do `&NameBuff` because it is a statically sized array // so `NameBuff == &NameBuff` according to C semantics. - char_u *buff_list[1] = {(char_u*) NameBuff}; + char_u *buff_list[1] = {NameBuff}; if (gen_expand_wildcards(1, buff_list, &filecount, &files, EW_FILE|EW_SILENT) == FAIL || filecount == 0) { diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 44cb2d48a2..07d63c9be5 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -387,7 +387,7 @@ int dbg_check_skipped(exarg_T *eap) debug_breakpoint_name = debug_skipped_name; /* eap->skip is TRUE */ eap->skip = FALSE; - (void)dbg_check_breakpoint(eap); + dbg_check_breakpoint(eap); eap->skip = TRUE; got_int |= prev_got_int; return TRUE; diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 4e835cc43a..8167824a41 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -3155,7 +3155,7 @@ get_address ( case '?': /* '/' or '?' - search */ c = *cmd++; if (skip) { /* skip "/pat/" */ - cmd = skip_regexp(cmd, c, (int)p_magic, NULL); + cmd = skip_regexp(cmd, c, p_magic, NULL); if (*cmd == c) ++cmd; } else { @@ -5375,9 +5375,7 @@ static void ex_hide(exarg_T *eap) */ static void ex_stop(exarg_T *eap) { - /* - * Disallow suspending for "rvim". - */ + // Disallow suspending in restricted mode (-Z) if (!check_restricted()) { if (!eap->forceit) { autowrite_all(); @@ -5883,13 +5881,13 @@ static void ex_resize(exarg_T *eap) n += curwin->w_width; else if (n == 0 && eap->arg[0] == NUL) /* default is very wide */ n = 9999; - win_setwidth_win((int)n, wp); + win_setwidth_win(n, wp); } else { if (*eap->arg == '-' || *eap->arg == '+') n += curwin->w_height; else if (n == 0 && eap->arg[0] == NUL) /* default is very wide */ n = 9999; - win_setheight_win((int)n, wp); + win_setheight_win(n, wp); } } @@ -6365,7 +6363,7 @@ static void ex_sleep(exarg_T *eap) if (cursor_valid()) { n = curwin->w_winrow + curwin->w_wrow - msg_scrolled; if (n >= 0) - ui_cursor_goto((int)n, curwin->w_wincol + curwin->w_wcol); + ui_cursor_goto(n, curwin->w_wincol + curwin->w_wcol); } len = eap->line2; diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c index 7a8920e2a0..d2774804f8 100644 --- a/src/nvim/ex_eval.c +++ b/src/nvim/ex_eval.c @@ -1815,7 +1815,7 @@ void leave_cleanup(cleanup_T *csp) if (aborting() || need_rethrow) { if (pending & CSTP_THROW) /* Cancel the pending exception (includes report). */ - discard_exception((except_T *)csp->exception, FALSE); + discard_exception(csp->exception, FALSE); else report_discard_pending(pending, NULL); diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 651c57f5b6..24fe547e56 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -1349,7 +1349,7 @@ retry: * conv_rest[]. */ if (tail != NULL) { conv_restlen = (int)((ptr + size) - tail); - memmove(conv_rest, (char_u *)tail, conv_restlen); + memmove(conv_rest, tail, conv_restlen); size -= conv_restlen; } @@ -3882,7 +3882,7 @@ static void msg_add_eol(void) static int check_mtime(buf_T *buf, FileInfo *file_info) { if (buf->b_mtime_read != 0 - && time_differs((long)file_info->stat.st_mtim.tv_sec, + && time_differs(file_info->stat.st_mtim.tv_sec, buf->b_mtime_read)) { msg_scroll = TRUE; /* don't overwrite messages here */ msg_silent = 0; /* must give this prompt */ @@ -4772,7 +4772,7 @@ buf_check_timestamp ( if (!(buf->b_flags & BF_NOTEDITED) && buf->b_mtime != 0 && (!(file_info_ok = os_fileinfo((char *)buf->b_ffname, &file_info)) - || time_differs((long)file_info.stat.st_mtim.tv_sec, buf->b_mtime) + || time_differs(file_info.stat.st_mtim.tv_sec, buf->b_mtime) || (int)file_info.stat.st_mode != buf->b_orig_mode )) { retval = 1; @@ -5084,7 +5084,7 @@ void buf_reload(buf_T *buf, int orig_mode) void buf_store_file_info(buf_T *buf, FileInfo *file_info) FUNC_ATTR_NONNULL_ALL { - buf->b_mtime = (long)file_info->stat.st_mtim.tv_sec; + buf->b_mtime = file_info->stat.st_mtim.tv_sec; buf->b_orig_size = os_fileinfo_size(file_info); buf->b_orig_mode = (int)file_info->stat.st_mode; } diff --git a/src/nvim/globals.h b/src/nvim/globals.h index b15db61f99..d7087ee928 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -601,7 +601,7 @@ EXTERN volatile int full_screen INIT(= FALSE); * otherwise only writing some messages */ EXTERN int restricted INIT(= FALSE); -/* TRUE when started as "rvim" */ +// TRUE when started in restricted mode (-Z) EXTERN int secure INIT(= FALSE); /* non-zero when only "safe" commands are * allowed, e.g. when sourcing .exrc or .vimrc diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c index db81746d73..f5eed26a2d 100644 --- a/src/nvim/hardcopy.c +++ b/src/nvim/hardcopy.c @@ -1988,7 +1988,7 @@ static void prt_page_margins(double width, double height, double *left, double * static void prt_font_metrics(int font_scale) { prt_line_height = (double)font_scale; - prt_char_width = (double)PRT_PS_FONT_TO_USER(font_scale, prt_ps_font->wx); + prt_char_width = PRT_PS_FONT_TO_USER(font_scale, prt_ps_font->wx); } @@ -2027,10 +2027,10 @@ static int prt_get_lpp(void) * font height (based on its bounding box) and the line height, handling the * case where the font height can exceed the line height. */ - prt_bgcol_offset = (double)PRT_PS_FONT_TO_USER(prt_line_height, + prt_bgcol_offset = PRT_PS_FONT_TO_USER(prt_line_height, prt_ps_font->bbox_min_y); if ((prt_ps_font->bbox_max_y - prt_ps_font->bbox_min_y) < 1000.0) { - prt_bgcol_offset -= (double)PRT_PS_FONT_TO_USER(prt_line_height, + prt_bgcol_offset -= PRT_PS_FONT_TO_USER(prt_line_height, (1000.0 - (prt_ps_font->bbox_max_y - prt_ps_font->bbox_min_y)) / 2); } diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index 09f4ecf519..df61afa398 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -772,7 +772,7 @@ err_closing: #endif /* expand the cscope exec for env var's */ prog = xmalloc(MAXPATHL + 1); - expand_env((char_u *)p_csprg, (char_u *)prog, MAXPATHL); + expand_env(p_csprg, (char_u *)prog, MAXPATHL); /* alloc space to hold the cscope command */ len = (int)(strlen(prog) + strlen(csinfo[i].fname) + 32); diff --git a/src/nvim/main.c b/src/nvim/main.c index 897f251bb3..a4f430e811 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -204,11 +204,9 @@ int main(int argc, char **argv) // Check if we have an interactive window. check_and_set_isatty(¶ms); - /* - * Figure out the way to work from the command name argv[0]. - * "view" sets "readonlymode", "rvim" sets "restricted", etc. - */ - parse_command_name(¶ms); + // Get the name with which Nvim was invoked, with and without path. + set_vim_var_string(VV_PROGPATH, (char_u *)argv[0], -1); + set_vim_var_string(VV_PROGNAME, path_tail((char_u *)argv[0]), -1); /* * Process the command line arguments. File names are put in the global @@ -820,69 +818,8 @@ static void init_locale(void) } TIME_MSG("locale set"); } - #endif -/* - * Check for: [r][g][vi|vim|view][ex[im]] - * If the executable name starts with "r" we disable shell commands. - * If the next character is "g" we run the GUI version. - * If the next characters are "view" we start in readonly mode. - * If the next characters are "ex" we start in Ex mode. If it's followed - * by "im" use improved Ex mode. - */ -static void parse_command_name(mparm_T *parmp) -{ - char_u *initstr; - - initstr = path_tail((char_u *)parmp->argv[0]); - - set_vim_var_string(VV_PROGNAME, initstr, -1); - set_vim_var_string(VV_PROGPATH, (char_u *)parmp->argv[0], -1); - - if (parse_string(&initstr, "editor", 6)) - return; - - if (parse_char_i(&initstr, 'r')) - restricted = TRUE; - - /* "gvim" starts the GUI. Also accept "Gvim" for MS-Windows. */ - if (parse_char_i(&initstr, 'g')) - main_start_gui(); - - if (parse_string(&initstr, "view", 4)) { - readonlymode = TRUE; - curbuf->b_p_ro = TRUE; - p_uc = 10000; /* don't update very often */ - } else { - parse_string(&initstr, "vim", 3); /* consume "vim" if it's there */ - } - - if (parse_string(&initstr, "ex", 2)) { - if (parse_string(&initstr, "im", 2)) - exmode_active = EXMODE_VIM; - else - exmode_active = EXMODE_NORMAL; - } -} - -static bool parse_char_i(char_u **input, char val) -{ - if (TOLOWER_ASC(**input) == val) { - *input += 1; /* or (*input)++ WITH parens */ - return true; - } - return false; -} - -static bool parse_string(char_u **input, char *val, int len) -{ - if (STRNICMP(*input, val, len) == 0) { - *input += len; - return true; - } - return false; -} /* * Scan the command line arguments. @@ -1134,10 +1071,6 @@ static void command_line_scan(mparm_T *parmp) } break; - case 'v': /* "-v" Vi-mode (as if called "vi") */ - exmode_active = 0; - break; - case 'w': /* "-w{number}" set window height */ /* "-w {scriptout}" write to script */ if (vim_isdigit(((char_u *)argv[0])[argv_idx])) { @@ -2034,13 +1967,12 @@ static void usage(void) #if !defined(UNIX) mch_msg(_(" --literal Don't expand wildcards\n")); #endif - mch_msg(_(" -v Vi mode (like \"vi\")\n")); - mch_msg(_(" -e Ex mode (like \"ex\")\n")); + mch_msg(_(" -e Ex mode\n")); mch_msg(_(" -E Improved Ex mode\n")); - mch_msg(_(" -s Silent (batch) mode (only for \"ex\")\n")); + mch_msg(_(" -s Silent (batch) mode (only for ex mode)\n")); mch_msg(_(" -d Diff mode\n")); - mch_msg(_(" -R Readonly mode (like \"view\")\n")); - mch_msg(_(" -Z Restricted mode (like \"rvim\")\n")); + mch_msg(_(" -R Readonly mode\n")); + mch_msg(_(" -Z Restricted mode\n")); mch_msg(_(" -m Modifications (writing files) not allowed\n")); mch_msg(_(" -M Modifications in text not allowed\n")); mch_msg(_(" -b Binary mode\n")); diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c index 5c89e9d8eb..fd6050f2d6 100644 --- a/src/nvim/mbyte.c +++ b/src/nvim/mbyte.c @@ -3956,8 +3956,8 @@ static int check_col(int col) { if (col < 0) return 0; - if (col >= (int)screen_Columns) - return (int)screen_Columns - 1; + if (col >= screen_Columns) + return screen_Columns - 1; return col; } @@ -3966,7 +3966,7 @@ static int check_row(int row) { if (row < 0) return 0; - if (row >= (int)screen_Rows) - return (int)screen_Rows - 1; + if (row >= screen_Rows) + return screen_Rows - 1; return row; } diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 1339671c92..1dc3a27415 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -689,7 +689,7 @@ static void set_b0_fname(ZERO_BL *b0p, buf_T *buf) } FileInfo file_info; if (os_fileinfo((char *)buf->b_ffname, &file_info)) { - long_to_char((long)file_info.stat.st_mtim.tv_sec, b0p->b0_mtime); + long_to_char(file_info.stat.st_mtim.tv_sec, b0p->b0_mtime); long_to_char((long)os_fileinfo_inode(&file_info), b0p->b0_ino); buf_store_file_info(buf, &file_info); buf->b_mtime_read = buf->b_mtime; diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 04551355ae..3ed6b416d6 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -1261,7 +1261,7 @@ plines_win_nofill ( lines = plines_win_nofold(wp, lnum); if (winheight > 0 && lines > wp->w_height) - return (int)wp->w_height; + return wp->w_height; return lines; } diff --git a/src/nvim/normal.c b/src/nvim/normal.c index c6250297c1..4c62b0c28d 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -1727,7 +1727,7 @@ static void op_colon(oparg_T *oap) stuffcharReadbuff('$'); else if (oap->start.lnum == curwin->w_cursor.lnum) { stuffReadbuff((char_u *)".+"); - stuffnumReadbuff((long)oap->line_count - 1); + stuffnumReadbuff(oap->line_count - 1); } else stuffnumReadbuff((long)oap->end.lnum); } @@ -3192,7 +3192,7 @@ static void nv_help(cmdarg_T *cap) static void nv_addsub(cmdarg_T *cap) { if (!checkclearopq(cap->oap) - && do_addsub((int)cap->cmdchar, cap->count1)) + && do_addsub(cap->cmdchar, cap->count1)) prep_redo_cmd(cap); } @@ -4038,7 +4038,7 @@ static void nv_colon(cmdarg_T *cap) stuffcharReadbuff('.'); if (cap->count0 > 1) { stuffReadbuff((char_u *)",.+"); - stuffnumReadbuff((long)cap->count0 - 1L); + stuffnumReadbuff(cap->count0 - 1L); } } @@ -4758,7 +4758,7 @@ static void nv_dollar(cmdarg_T *cap) if (!virtual_active() || gchar_cursor() != NUL || cap->oap->op_type == OP_NOP) curwin->w_curswant = MAXCOL; /* so we stay at the end */ - if (cursor_down((long)(cap->count1 - 1), + if (cursor_down(cap->count1 - 1, cap->oap->op_type == OP_NOP) == false) clearopbeep(cap->oap); else if ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP) @@ -6180,7 +6180,7 @@ static void nv_g_cmd(cmdarg_T *cap) cap->oap->motion_type = MCHAR; cap->oap->inclusive = true; curwin->w_curswant = MAXCOL; - if (cursor_down((long)(cap->count1 - 1), + if (cursor_down(cap->count1 - 1, cap->oap->op_type == OP_NOP) == false) clearopbeep(cap->oap); else { diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 062fc1bbfa..7f2df8199c 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1494,7 +1494,7 @@ int op_delete(oparg_T *oap) if (oap->line_count > 1) { lnum = curwin->w_cursor.lnum; ++curwin->w_cursor.lnum; - del_lines((long)(oap->line_count - 1), TRUE); + del_lines(oap->line_count - 1, TRUE); curwin->w_cursor.lnum = lnum; } if (u_save_cursor() == FAIL) @@ -1607,7 +1607,7 @@ int op_delete(oparg_T *oap) curpos = curwin->w_cursor; /* remember curwin->w_cursor */ ++curwin->w_cursor.lnum; - del_lines((long)(oap->line_count - 2), FALSE); + del_lines(oap->line_count - 2, FALSE); if (delete_last_line) oap->end.lnum = curbuf->b_ml.ml_line_count; diff --git a/src/nvim/option.c b/src/nvim/option.c index 3d596f81cc..a9e271517d 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -396,7 +396,7 @@ static vimoption_T {(char_u *)FALSE, (char_u *)FALSE} SCRIPTID_INIT}, {"arabic", "arab", P_BOOL|P_VI_DEF|P_VIM|P_CURSWANT, - (char_u *)VAR_WIN, PV_ARAB, + VAR_WIN, PV_ARAB, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"arabicshape", "arshape", P_BOOL|P_VI_DEF|P_VIM|P_RCLR, (char_u *)&p_arshape, PV_NONE, @@ -476,11 +476,11 @@ static vimoption_T {(char_u *)" \t!@*-+;:,./?", (char_u *)0L} SCRIPTID_INIT}, {"breakindent", "bri", P_BOOL|P_VI_DEF|P_VIM|P_RWIN, - (char_u *)VAR_WIN, PV_BRI, + VAR_WIN, PV_BRI, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"breakindentopt", "briopt", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF|P_COMMA|P_NODUP, - (char_u *)VAR_WIN, PV_BRIOPT, + VAR_WIN, PV_BRIOPT, {(char_u *)"", (char_u *)NULL} SCRIPTID_INIT}, {"browsedir", "bsdir",P_STRING|P_VI_DEF, @@ -541,7 +541,7 @@ static vimoption_T (char_u *)&p_cwh, PV_NONE, {(char_u *)7L, (char_u *)0L} SCRIPTID_INIT}, {"colorcolumn", "cc", P_STRING|P_VI_DEF|P_COMMA|P_NODUP|P_RWIN, - (char_u *)VAR_WIN, PV_CC, + VAR_WIN, PV_CC, {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {"columns", "co", P_NUM|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RCLR, (char_u *)&Columns, PV_NONE, @@ -566,11 +566,11 @@ static vimoption_T {(char_u *)".,w,b,u,t,i", (char_u *)0L} SCRIPTID_INIT}, {"concealcursor","cocu", P_STRING|P_ALLOCED|P_RWIN|P_VI_DEF, - (char_u *)VAR_WIN, PV_COCU, + VAR_WIN, PV_COCU, {(char_u *)"", (char_u *)NULL} SCRIPTID_INIT}, {"conceallevel","cole", P_NUM|P_RWIN|P_VI_DEF, - (char_u *)VAR_WIN, PV_COLE, + VAR_WIN, PV_COLE, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, {"completefunc", "cfu", P_STRING|P_ALLOCED|P_VI_DEF|P_SECURE, @@ -615,13 +615,13 @@ static vimoption_T (char_u *)&p_csverbose, PV_NONE, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, {"cursorbind", "crb", P_BOOL|P_VI_DEF, - (char_u *)VAR_WIN, PV_CRBIND, + VAR_WIN, PV_CRBIND, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"cursorcolumn", "cuc", P_BOOL|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_CUC, + VAR_WIN, PV_CUC, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"cursorline", "cul", P_BOOL|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_CUL, + VAR_WIN, PV_CUL, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"debug", NULL, P_STRING|P_VI_DEF, (char_u *)&p_debug, PV_NONE, @@ -637,7 +637,7 @@ static vimoption_T (char_u *)&p_dict, PV_DICT, {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {"diff", NULL, P_BOOL|P_VI_DEF|P_RWIN|P_NOGLOB, - (char_u *)VAR_WIN, PV_DIFF, + VAR_WIN, PV_DIFF, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"diffexpr", "dex", P_STRING|P_VI_DEF|P_SECURE|P_CURSWANT, (char_u *)&p_dex, PV_NONE, @@ -743,44 +743,44 @@ static vimoption_T (char_u *)&p_fcl, PV_NONE, {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, {"foldcolumn", "fdc", P_NUM|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_FDC, + VAR_WIN, PV_FDC, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"foldenable", "fen", P_BOOL|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_FEN, + VAR_WIN, PV_FEN, {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, {"foldexpr", "fde", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_FDE, + VAR_WIN, PV_FDE, {(char_u *)"0", (char_u *)NULL} SCRIPTID_INIT}, {"foldignore", "fdi", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_FDI, + VAR_WIN, PV_FDI, {(char_u *)"#", (char_u *)NULL} SCRIPTID_INIT}, {"foldlevel", "fdl", P_NUM|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_FDL, + VAR_WIN, PV_FDL, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, {"foldlevelstart","fdls", P_NUM|P_VI_DEF|P_CURSWANT, (char_u *)&p_fdls, PV_NONE, {(char_u *)-1L, (char_u *)0L} SCRIPTID_INIT}, {"foldmarker", "fmr", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF| P_RWIN|P_COMMA|P_NODUP, - (char_u *)VAR_WIN, PV_FMR, + VAR_WIN, PV_FMR, {(char_u *)"{{{,}}}", (char_u *)NULL} SCRIPTID_INIT}, {"foldmethod", "fdm", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_FDM, + VAR_WIN, PV_FDM, {(char_u *)"manual", (char_u *)NULL} SCRIPTID_INIT}, {"foldminlines","fml", P_NUM|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_FML, + VAR_WIN, PV_FML, {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, {"foldnestmax", "fdn", P_NUM|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_FDN, + VAR_WIN, PV_FDN, {(char_u *)20L, (char_u *)0L} SCRIPTID_INIT}, {"foldopen", "fdo", P_STRING|P_VI_DEF|P_COMMA|P_NODUP|P_CURSWANT, (char_u *)&p_fdo, PV_NONE, {(char_u *)"block,hor,mark,percent,quickfix,search,tag,undo", (char_u *)0L} SCRIPTID_INIT}, {"foldtext", "fdt", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_FDT, + VAR_WIN, PV_FDT, {(char_u *)"foldtext()", (char_u *)NULL} SCRIPTID_INIT}, {"formatexpr", "fex", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM, @@ -1037,7 +1037,7 @@ static vimoption_T (char_u *)&p_lz, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"linebreak", "lbr", P_BOOL|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_LBR, + VAR_WIN, PV_LBR, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"lines", NULL, P_NUM|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RCLR, (char_u *)&Rows, PV_NONE, @@ -1057,7 +1057,7 @@ static vimoption_T {(char_u *)LISPWORD_VALUE, (char_u *)0L} SCRIPTID_INIT}, {"list", NULL, P_BOOL|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_LIST, + VAR_WIN, PV_LIST, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"listchars", "lcs", P_STRING|P_VI_DEF|P_RALL|P_COMMA|P_NODUP, (char_u *)&p_lcs, PV_NONE, @@ -1161,10 +1161,10 @@ static vimoption_T {(char_u *)"octal,hex", (char_u *)0L} SCRIPTID_INIT}, {"number", "nu", P_BOOL|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_NU, + VAR_WIN, PV_NU, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"numberwidth", "nuw", P_NUM|P_RWIN|P_VIM, - (char_u *)VAR_WIN, PV_NUW, + VAR_WIN, PV_NUW, {(char_u *)8L, (char_u *)4L} SCRIPTID_INIT}, {"omnifunc", "ofu", P_STRING|P_ALLOCED|P_VI_DEF|P_SECURE, (char_u *)&p_ofu, PV_OFU, @@ -1213,7 +1213,7 @@ static vimoption_T (char_u *)&p_pvh, PV_NONE, {(char_u *)12L, (char_u *)0L} SCRIPTID_INIT}, {"previewwindow", "pvw", P_BOOL|P_VI_DEF|P_RSTAT|P_NOGLOB, - (char_u *)VAR_WIN, PV_PVW, + VAR_WIN, PV_PVW, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"printdevice", "pdev", P_STRING|P_VI_DEF|P_SECURE, (char_u *)&p_pdev, PV_NONE, @@ -1273,7 +1273,7 @@ static vimoption_T (char_u *)&p_re, PV_NONE, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, {"relativenumber", "rnu", P_BOOL|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_RNU, + VAR_WIN, PV_RNU, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"remap", NULL, P_BOOL|P_VI_DEF, (char_u *)&p_remap, PV_NONE, @@ -1288,10 +1288,10 @@ static vimoption_T (char_u *)&p_ri, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"rightleft", "rl", P_BOOL|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_RL, + VAR_WIN, PV_RL, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"rightleftcmd", "rlc", P_STRING|P_ALLOCED|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_RLC, + VAR_WIN, PV_RLC, {(char_u *)"search", (char_u *)NULL} SCRIPTID_INIT}, {"ruler", "ru", P_BOOL|P_VI_DEF|P_VIM|P_RSTAT, @@ -1305,10 +1305,10 @@ static vimoption_T {(char_u *)DFLT_RUNTIMEPATH, (char_u *)0L} SCRIPTID_INIT}, {"scroll", "scr", P_NUM|P_NO_MKRC|P_VI_DEF, - (char_u *)VAR_WIN, PV_SCROLL, + VAR_WIN, PV_SCROLL, {(char_u *)12L, (char_u *)0L} SCRIPTID_INIT}, {"scrollbind", "scb", P_BOOL|P_VI_DEF, - (char_u *)VAR_WIN, PV_SCBIND, + VAR_WIN, PV_SCBIND, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"scrolljump", "sj", P_NUM|P_VI_DEF|P_VIM, (char_u *)&p_sj, PV_NONE, @@ -1449,7 +1449,7 @@ static vimoption_T (char_u *)NULL, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"spell", NULL, P_BOOL|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_SPELL, + VAR_WIN, PV_SPELL, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"spellcapcheck", "spc", P_STRING|P_ALLOCED|P_VI_DEF|P_RBUF, (char_u *)&p_spc, PV_SPC, @@ -1687,10 +1687,10 @@ static vimoption_T (char_u *)&p_wh, PV_NONE, {(char_u *)1L, (char_u *)0L} SCRIPTID_INIT}, {"winfixheight", "wfh", P_BOOL|P_VI_DEF|P_RSTAT, - (char_u *)VAR_WIN, PV_WFH, + VAR_WIN, PV_WFH, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"winfixwidth", "wfw", P_BOOL|P_VI_DEF|P_RSTAT, - (char_u *)VAR_WIN, PV_WFW, + VAR_WIN, PV_WFW, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"winminheight", "wmh", P_NUM|P_VI_DEF, (char_u *)&p_wmh, PV_NONE, @@ -1702,7 +1702,7 @@ static vimoption_T (char_u *)&p_wiw, PV_NONE, {(char_u *)20L, (char_u *)0L} SCRIPTID_INIT}, {"wrap", NULL, P_BOOL|P_VI_DEF|P_RWIN, - (char_u *)VAR_WIN, PV_WRAP, + VAR_WIN, PV_WRAP, {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, {"wrapmargin", "wm", P_NUM|P_VI_DEF, (char_u *)&p_wm, PV_WM, diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index 242f8fb461..6200685076 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -42,8 +42,6 @@ int os_chdir(const char *path) int os_dirname(char_u *buf, size_t len) FUNC_ATTR_NONNULL_ALL { - assert(buf && len); - int error_number; if ((error_number = uv_cwd((char *)buf, &len)) != kLibuvSuccess) { STRLCPY(buf, uv_strerror(error_number), len); diff --git a/src/nvim/os/unix_defs.h b/src/nvim/os/unix_defs.h index e518ac67e5..28ae89ff77 100644 --- a/src/nvim/os/unix_defs.h +++ b/src/nvim/os/unix_defs.h @@ -1,7 +1,7 @@ #ifndef NVIM_OS_UNIX_DEFS_H #define NVIM_OS_UNIX_DEFS_H -#define TEMP_DIR_NAMES {"$TMPDIR", "/tmp", ".", "$HOME"} +#define TEMP_DIR_NAMES {"$TMPDIR", "/tmp", ".", "~"} #define TEMP_FILE_PATH_MAXLEN 256 #endif // NVIM_OS_UNIX_DEFS_H diff --git a/src/nvim/os_unix_defs.h b/src/nvim/os_unix_defs.h index 40230c7944..e5ab9fd4f7 100644 --- a/src/nvim/os_unix_defs.h +++ b/src/nvim/os_unix_defs.h @@ -101,9 +101,6 @@ #ifndef SYS_VIMRC_FILE # define SYS_VIMRC_FILE "$VIM/nvimrc" #endif -#ifndef SYS_GVIMRC_FILE -# define SYS_GVIMRC_FILE "$VIM/ngvimrc" -#endif #ifndef DFLT_HELPFILE # define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt" #endif @@ -130,12 +127,12 @@ #endif #ifndef USR_EXRC_FILE -# define USR_EXRC_FILE "$HOME/.exrc" +# define USR_EXRC_FILE "~/.exrc" #endif #ifndef USR_VIMRC_FILE -# define USR_VIMRC_FILE "$HOME/.nvimrc" +# define USR_VIMRC_FILE "~/.nvimrc" #endif @@ -143,18 +140,8 @@ # define USR_VIMRC_FILE2 "~/.nvim/nvimrc" #endif - -#ifndef USR_GVIMRC_FILE -# define USR_GVIMRC_FILE "$HOME/.ngvimrc" -#endif - -#ifndef USR_GVIMRC_FILE2 -# define USR_GVIMRC_FILE2 "~/.nvim/ngvimrc" -#endif - - # ifndef VIMINFO_FILE -# define VIMINFO_FILE "$HOME/.nviminfo" +# define VIMINFO_FILE "~/.nviminfo" # endif #ifndef EXRC_FILE @@ -179,7 +166,7 @@ #endif #ifndef DFLT_VDIR -# define DFLT_VDIR "$HOME/.nvim/view" /* default for 'viewdir' */ +# define DFLT_VDIR "~/.nvim/view" // default for 'viewdir' #endif #define DFLT_ERRORFILE "errors.err" diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index b025d3a5e1..39117b262a 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -3554,7 +3554,7 @@ void ex_helpgrep(exarg_T *eap) // Note: We cannot just do `&NameBuff` because it is a statically sized array // so `NameBuff == &NameBuff` according to C semantics. - char_u *buff_list[1] = {(char_u*) NameBuff}; + char_u *buff_list[1] = {NameBuff}; if (gen_expand_wildcards(1, buff_list, &fcount, &fnames, EW_FILE|EW_SILENT) == OK && fcount > 0) { diff --git a/src/nvim/screen.c b/src/nvim/screen.c index f26c74998e..757bdb34b1 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -1500,7 +1500,7 @@ static void win_update(win_T *wp) */ screen_fill(wp->w_winrow + wp->w_height - 1, wp->w_winrow + wp->w_height, - (int)W_ENDCOL(wp) - 3, (int)W_ENDCOL(wp), + W_ENDCOL(wp) - 3, W_ENDCOL(wp), '@', '@', hl_attr(HLF_AT)); set_empty_rows(wp, srow); wp->w_botline = lnum; @@ -1593,7 +1593,7 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h if (n > wp->w_width) n = wp->w_width; screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, - W_ENDCOL(wp) - n, (int)W_ENDCOL(wp), + W_ENDCOL(wp) - n, W_ENDCOL(wp), ' ', ' ', hl_attr(HLF_FC)); } @@ -1605,7 +1605,7 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h nn = wp->w_width; } screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, - W_ENDCOL(wp) - nn, (int)W_ENDCOL(wp) - n, + W_ENDCOL(wp) - nn, W_ENDCOL(wp) - n, ' ', ' ', hl_attr(HLF_SC)); n = nn; } @@ -1653,7 +1653,7 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h } screen_fill(wp->w_winrow + row, wp->w_winrow + endrow, - wp->w_wincol + FDC_OFF, (int)W_ENDCOL(wp), + wp->w_wincol + FDC_OFF, W_ENDCOL(wp), c1, c2, hl_attr(hl)); } set_empty_rows(wp, row); @@ -4779,7 +4779,7 @@ void win_redr_status(win_T *wp) this_ru_col + wp->w_wincol, fillchar, fillchar, attr); if (get_keymap_str(wp, NameBuff, MAXPATHL) - && (int)(this_ru_col - len) > (int)(STRLEN(NameBuff) + 1)) + && this_ru_col - len > (int)(STRLEN(NameBuff) + 1)) screen_puts(NameBuff, row, (int)(this_ru_col - STRLEN(NameBuff) - 1 + wp->w_wincol), attr); @@ -6204,7 +6204,7 @@ void setcursor(void) curwin->w_wincol + ( /* With 'rightleft' set and the cursor on a double-wide * character, position it on the leftmost column. */ - curwin->w_p_rl ? ((int)curwin->w_width - curwin->w_wcol - ( + curwin->w_p_rl ? (curwin->w_width - curwin->w_wcol - ( (has_mbyte && (*mb_ptr2cells)(get_cursor_pos_ptr()) == 2 && vim_isprintc(gchar_cursor())) ? 2 : @@ -6265,7 +6265,7 @@ int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear) if (lastrow > Rows) lastrow = Rows; screen_fill(nextrow - line_count, lastrow - line_count, - wp->w_wincol, (int)W_ENDCOL(wp), + wp->w_wincol, W_ENDCOL(wp), ' ', ' ', 0); } @@ -6345,7 +6345,7 @@ static int win_do_lines(win_T *wp, int row, int line_count, int mayclear, int de // Delete all remaining lines if (row + line_count >= wp->w_height) { screen_fill(wp->w_winrow + row, wp->w_winrow + wp->w_height, - wp->w_wincol, (int)W_ENDCOL(wp), + wp->w_wincol, W_ENDCOL(wp), ' ', ' ', 0); return OK; } @@ -7103,7 +7103,7 @@ static void win_redr_ruler(win_T *wp, int always) i = redraw_cmdline; screen_fill(row, row + 1, this_ru_col + off + (int)STRLEN(buffer), - (int)(off + width), + off + width, fillchar, fillchar, attr); /* don't redraw the cmdline because of showing the ruler */ redraw_cmdline = i; diff --git a/src/nvim/search.c b/src/nvim/search.c index 3b8f0bb6ba..6e2824bc8e 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -986,7 +986,7 @@ int do_search( * If there is a matching '/' or '?', toss it. */ ps = strcopy; - p = skip_regexp(pat, dirc, (int)p_magic, &strcopy); + p = skip_regexp(pat, dirc, p_magic, &strcopy); if (strcopy != ps) { /* made a copy of "pat" to change "\?" to "?" */ searchcmdlen += (int)(STRLEN(pat) - STRLEN(strcopy)); @@ -3811,7 +3811,7 @@ current_search ( flags = SEARCH_END; int result = searchit(curwin, curbuf, &pos, (dir ? FORWARD : BACKWARD), - spats[last_idx].pat, (long) (i ? count : 1), + spats[last_idx].pat, i ? count : 1, SEARCH_KEEP | flags, RE_SEARCH, 0, NULL); /* First search may fail, but then start searching from the diff --git a/src/nvim/sha256.c b/src/nvim/sha256.c index 46b8d47c00..17b80f013b 100644 --- a/src/nvim/sha256.c +++ b/src/nvim/sha256.c @@ -333,7 +333,7 @@ bool sha256_self_test(void) memset(buf, 'a', 1000); for (size_t j = 0; j < 1000; j++) { - sha256_update(&ctx, (char_u *) buf, 1000); + sha256_update(&ctx, buf, 1000); } sha256_finish(&ctx, sha256sum); diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 126a435463..6708ad2aa7 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -2541,7 +2541,7 @@ spell_load_file ( EMSG2(_(e_notopen), fname); else if (p_verbose > 2) { verbose_enter(); - smsg((char_u *)e_notopen, fname); + smsg(e_notopen, fname); verbose_leave(); } goto endFAIL; @@ -5480,7 +5480,7 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile) } // Store the word in the hashtable to be able to find duplicates. - dw = (char_u *)getroom_save(spin, w); + dw = getroom_save(spin, w); if (dw == NULL) { retval = FAIL; free(pc); @@ -10904,7 +10904,7 @@ stp_sal_score ( char_u goodword[MAXWLEN]; int lendiff; - lendiff = (int)(su->su_badlen - stp->st_orglen); + lendiff = su->su_badlen - stp->st_orglen; if (lendiff >= 0) pbad = badsound; else { diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 4f67507ea2..07f18bf93b 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -3223,8 +3223,8 @@ static void syn_clear_one(int id, int syncing) /* Clear keywords only when not ":syn sync clear group-name" */ if (!syncing) { - (void)syn_clear_keyword(id, &curwin->w_s->b_keywtab); - (void)syn_clear_keyword(id, &curwin->w_s->b_keywtab_ic); + syn_clear_keyword(id, &curwin->w_s->b_keywtab); + syn_clear_keyword(id, &curwin->w_s->b_keywtab_ic); } /* clear the patterns for "id" */ @@ -6068,7 +6068,7 @@ do_highlight ( if (ends_excmd(*line)) { for (int i = 1; i <= highlight_ga.ga_len && !got_int; ++i) /* TODO: only call when the group has attributes set */ - highlight_list_one((int)i); + highlight_list_one(i); return; } diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 9e6a65cef3..1bb18bee6e 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -1003,7 +1003,7 @@ static int tag_strnicmp(char_u *s1, char_u *s2, size_t len) int i; while (len > 0) { - i = (int)TOUPPER_ASC(*s1) - (int)TOUPPER_ASC(*s2); + i = TOUPPER_ASC(*s1) - TOUPPER_ASC(*s2); if (i != 0) return i; /* this character different */ if (*s1 == NUL) @@ -1583,7 +1583,7 @@ parse_line: */ i = (int)tagp.tagname[0]; if (sortic) - i = (int)TOUPPER_ASC(tagp.tagname[0]); + i = TOUPPER_ASC(tagp.tagname[0]); if (i < search_info.low_char || i > search_info.high_char) sort_error = TRUE; @@ -2590,7 +2590,7 @@ static char_u *expand_tag_fname(char_u *fname, char_u *tag_fname, int expand) if (expand && mch_has_wildcard(fname)) { ExpandInit(&xpc); xpc.xp_context = EXPAND_FILES; - expanded_fname = ExpandOne(&xpc, (char_u *)fname, NULL, + expanded_fname = ExpandOne(&xpc, fname, NULL, WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE); if (expanded_fname != NULL) fname = expanded_fname; diff --git a/src/nvim/tempfile.c b/src/nvim/tempfile.c index f81aff53a1..0750be0ab9 100644 --- a/src/nvim/tempfile.c +++ b/src/nvim/tempfile.c @@ -66,7 +66,7 @@ void vim_deltempdir(void) // Note: We cannot just do `&NameBuff` because it is a statically // sized array so `NameBuff == &NameBuff` according to C semantics. - char_u *buff_list[1] = {(char_u*) NameBuff}; + char_u *buff_list[1] = {NameBuff}; if (gen_expand_wildcards(1, buff_list, &file_count, &files, EW_DIR|EW_FILE|EW_SILENT) == OK) { for (int i = 0; i < file_count; ++i) { diff --git a/src/nvim/testdir/test100.in b/src/nvim/testdir/test100.in deleted file mode 100644 index bc1a55e4d3..0000000000 --- a/src/nvim/testdir/test100.in +++ /dev/null @@ -1,53 +0,0 @@ -Tests for 'undolevel' setting being global-local - -STARTTEST -:so small.vim -:set ul=5 -:fu! FillBuffer() - :for i in range(1,13) - :put=i - :exe "setg ul=" . &g:ul - :endfor -:endfu -:fu! UndoLevel() - :redir @a | setglobal undolevels? | echon ' global' | setlocal undolevels? | echon ' local' |redir end - :$put a -:endfu -:new one -:0put ='ONE: expecting global undolevels: 5, local undolevels: -123456 (default)' -:call FillBuffer() -:earlier 10 -:call UndoLevel() -:set ff=unix -:%w! test.out -:new two -:0put ='TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards)' -:setlocal ul=2 -:call FillBuffer() -:earlier 10 -:call UndoLevel() -:setlocal ul=10 -:call UndoLevel() -:set ff=unix -:%w >> test.out -:wincmd p -:redir >>test.out | echo "global value shouldn't be changed and still be 5!" | echo 'ONE: expecting global undolevels: 5, local undolevels: -123456 (default)'|:setglobal undolevels? | echon ' global' | setlocal undolevels? | echon ' local' |echo "" |redir end -:new three -:setglobal ul=50 -:1put ='global value should be changed to 50' -:2put ='THREE: expecting global undolevels: 50, local undolevels: -123456 (default)' -:call UndoLevel() -:set ff=unix -:%w >> test.out -:"sleep 10 -:" -:" Testing 'lispwords' -:" -:setglobal lispwords=foo,bar,baz -:setlocal lispwords-=foo | setlocal lispwords+=quux -:redir >> test.out | echon "\nTesting 'lispwords' local value" | setglobal lispwords? | setlocal lispwords? | echo &lispwords . "\n" | redir end -:setlocal lispwords< -:redir >> test.out | echon "\nTesting 'lispwords' value reset" | setglobal lispwords? | setlocal lispwords? | echo &lispwords . "\n" | redir end -:qa! -ENDTEST - diff --git a/src/nvim/testdir/test100.ok b/src/nvim/testdir/test100.ok deleted file mode 100644 index 477106b8f2..0000000000 --- a/src/nvim/testdir/test100.ok +++ /dev/null @@ -1,51 +0,0 @@ -ONE: expecting global undolevels: 5, local undolevels: -123456 (default) -1 -2 -3 -4 -5 -6 -7 - - - undolevels=5 global - undolevels=-123456 local -TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards) -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 - - - undolevels=5 global - undolevels=2 local - - undolevels=5 global - undolevels=10 local - -global value shouldn't be changed and still be 5! -ONE: expecting global undolevels: 5, local undolevels: -123456 (default) - undolevels=5 global - undolevels=-123456 local - -global value should be changed to 50 -THREE: expecting global undolevels: 50, local undolevels: -123456 (default) - - undolevels=50 global - undolevels=-123456 local - -Testing 'lispwords' local value - lispwords=foo,bar,baz - lispwords=bar,baz,quux -bar,baz,quux - -Testing 'lispwords' value reset - lispwords=foo,bar,baz - lispwords=foo,bar,baz -foo,bar,baz diff --git a/src/nvim/testdir/test103.in b/src/nvim/testdir/test103.in deleted file mode 100644 index 7c7591e3b9..0000000000 --- a/src/nvim/testdir/test103.in +++ /dev/null @@ -1,37 +0,0 @@ -Test for visual mode not being reset causing E315 error. -STARTTEST -:so small.vim -:enew -:let g:msg="Everything's fine." -:function! TriggerTheProblem() -: " At this point there is no visual selection because :call reset it. -: " Let's restore the selection: -: normal gv -: '<,'>del _ -: try -: exe "normal \<Esc>" -: catch /^Vim\%((\a\+)\)\=:E315/ -: echom 'Snap! E315 error!' -: let g:msg='Snap! E315 error!' -: endtry -:endfunction -:enew -:setl buftype=nofile -:call append(line('$'), 'Delete this line.') -:" -:" -:" NOTE: this has to be done by a call to a function because executing :del the -:" ex-way will require the colon operator which resets the visual mode thus -:" preventing the problem: -:" -GV:call TriggerTheProblem() -:%del _ -:call append(line('$'), g:msg) -:w! test.out -:brewind -ENDTEST - -STARTTEST -:qa! -ENDTEST - diff --git a/src/nvim/testdir/test103.ok b/src/nvim/testdir/test103.ok deleted file mode 100644 index 9ea6dd6eea..0000000000 --- a/src/nvim/testdir/test103.ok +++ /dev/null @@ -1,2 +0,0 @@ - -Everything's fine. diff --git a/src/nvim/testdir/test15.in b/src/nvim/testdir/test15.in deleted file mode 100644 index 60d8717278..0000000000 --- a/src/nvim/testdir/test15.in +++ /dev/null @@ -1,135 +0,0 @@ -Tests for :right on text with embedded TAB. -Also test formatting a paragraph. -Also test undo after ":%s" and formatting. - -STARTTEST -:so small.vim -:set tw=65 - -:/^\s*test for :left/,/^\s*test for :center/ left -:/^\s*test for :center/,/^\s*test for :right/ center -:/^\s*test for :right/,/^xxx/-1 right -:set fo+=tcroql tw=72 -/xxxxxxxx$ -0gq6kk -:" undo/redo here to make the next undo only work on the following changes -u -:map gg :.,.+2s/^/x/<CR>kk:set tw=3<CR>gqq -/^aa -ggu -:?test for :left?,$w! test.out -:qa! -ENDTEST - - test for :left - a a - fa a - dfa a - sdfa a - asdfa a - xasdfa a -asxxdfa a - - test for :center - a a - fa afd asdf - dfa a - sdfa afd asdf - asdfa a - xasdfa asdfasdfasdfasdfasdf -asxxdfa a - - test for :right - a a - fa a - dfa a - sdfa a - asdfa a - xasdfa a - asxxdfa a - asxa;ofa a - asdfaqwer a - a ax - fa ax - dfa ax - sdfa ax - asdfa ax - xasdfa ax - asxxdfa ax - asxa;ofa ax - asdfaqwer ax - a axx - fa axx - dfa axx - sdfa axx - asdfa axx - xasdfa axx - asxxdfa axx - asxa;ofa axx - asdfaqwer axx - a axxx - fa axxx - dfa axxx - sdfa axxx - asdfa axxx - xasdfa axxx - asxxdfa axxx - asxa;ofa axxx - asdfaqwer axxx - a axxxo - fa axxxo - dfa axxxo - sdfa axxxo - asdfa axxxo - xasdfa axxxo - asxxdfa axxxo - asxa;ofa axxxo - asdfaqwer axxxo - a axxxoi - fa axxxoi - dfa axxxoi - sdfa axxxoi - asdfa axxxoi - xasdfa axxxoi - asxxdfa axxxoi - asxa;ofa axxxoi - asdfaqwer axxxoi - a axxxoik - fa axxxoik - dfa axxxoik - sdfa axxxoik - asdfa axxxoik - xasdfa axxxoik - asxxdfa axxxoik - asxa;ofa axxxoik - asdfaqwer axxxoik - a axxxoike - fa axxxoike - dfa axxxoike - sdfa axxxoike - asdfa axxxoike - xasdfa axxxoike - asxxdfa axxxoike - asxa;ofa axxxoike - asdfaqwer axxxoike - a axxxoikey - fa axxxoikey - dfa axxxoikey - sdfa axxxoikey - asdfa axxxoikey - xasdfa axxxoikey - asxxdfa axxxoikey - asxa;ofa axxxoikey - asdfaqwer axxxoikey - -xxxxx xx xxxxxx -xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx -xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx -xx xxxxxxx. xxxx xxxx. - -> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx -> xxxxxx xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx - -aa aa aa aa -bb bb bb bb -cc cc cc cc diff --git a/src/nvim/testdir/test15.ok b/src/nvim/testdir/test15.ok deleted file mode 100644 index bc09f5e7db..0000000000 --- a/src/nvim/testdir/test15.ok +++ /dev/null @@ -1,111 +0,0 @@ -test for :left -a a -fa a -dfa a -sdfa a -asdfa a -xasdfa a -asxxdfa a - - test for :center - a a - fa afd asdf - dfa a - sdfa afd asdf - asdfa a - xasdfa asdfasdfasdfasdfasdf - asxxdfa a - - test for :right - a a - fa a - dfa a - sdfa a - asdfa a - xasdfa a - asxxdfa a - asxa;ofa a - asdfaqwer a - a ax - fa ax - dfa ax - sdfa ax - asdfa ax - xasdfa ax - asxxdfa ax - asxa;ofa ax - asdfaqwer ax - a axx - fa axx - dfa axx - sdfa axx - asdfa axx - xasdfa axx - asxxdfa axx - asxa;ofa axx - asdfaqwer axx - a axxx - fa axxx - dfa axxx - sdfa axxx - asdfa axxx - xasdfa axxx - asxxdfa axxx - asxa;ofa axxx - asdfaqwer axxx - a axxxo - fa axxxo - dfa axxxo - sdfa axxxo - asdfa axxxo - xasdfa axxxo - asxxdfa axxxo - asxa;ofa axxxo - asdfaqwer axxxo - a axxxoi - fa axxxoi - dfa axxxoi - sdfa axxxoi - asdfa axxxoi - xasdfa axxxoi - asxxdfa axxxoi - asxa;ofa axxxoi - asdfaqwer axxxoi - a axxxoik - fa axxxoik - dfa axxxoik - sdfa axxxoik - asdfa axxxoik - xasdfa axxxoik - asxxdfa axxxoik - asxa;ofa axxxoik - asdfaqwer axxxoik - a axxxoike - fa axxxoike - dfa axxxoike - sdfa axxxoike - asdfa axxxoike - xasdfa axxxoike - asxxdfa axxxoike - asxa;ofa axxxoike - asdfaqwer axxxoike - a axxxoikey - fa axxxoikey - dfa axxxoikey - sdfa axxxoikey - asdfa axxxoikey - xasdfa axxxoikey - asxxdfa axxxoikey - asxa;ofa axxxoikey - asdfaqwer axxxoikey - -xxxxx xx xxxxxx xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx -xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx xx xxxxxxx. -xxxx xxxx. - -> xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx xxxxxx -> xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx - -aa aa aa aa -bb bb bb bb -cc cc cc cc diff --git a/src/nvim/testdir/test84.in b/src/nvim/testdir/test84.in deleted file mode 100644 index 25482db54c..0000000000 --- a/src/nvim/testdir/test84.in +++ /dev/null @@ -1,35 +0,0 @@ -Tests for curswant not changing when setting an option - -STARTTEST -:so small.vim -:/^start target options$/+1,/^end target options$/-1 yank -:let target_option_names = split(@0) -:function TestCurswant(option_name) -: normal! ggf8j -: let curswant_before = winsaveview().curswant -: execute 'let' '&'.a:option_name '=' '&'.a:option_name -: let curswant_after = winsaveview().curswant -: return [a:option_name, curswant_before, curswant_after] -:endfunction -: -:new -:put =['1234567890', '12345'] -:1 delete _ -:let result = [] -:for option_name in target_option_names -: call add(result, TestCurswant(option_name)) -:endfor -: -:new -:put =map(copy(result), 'join(v:val, '' '')') -:1 delete _ -:write test.out -: -:qall! -ENDTEST - -start target options - tabstop - timeoutlen - ttimeoutlen -end target options diff --git a/src/nvim/testdir/test84.ok b/src/nvim/testdir/test84.ok deleted file mode 100644 index 8b8e4ee824..0000000000 --- a/src/nvim/testdir/test84.ok +++ /dev/null @@ -1,3 +0,0 @@ -tabstop 7 4 -timeoutlen 7 7 -ttimeoutlen 7 7 diff --git a/src/nvim/testdir/test90.in b/src/nvim/testdir/test90.in deleted file mode 100644 index 3c0d8c030c..0000000000 --- a/src/nvim/testdir/test90.in +++ /dev/null @@ -1,53 +0,0 @@ -Tests for sha256() function. vim: set ft=vim et ts=2 sw=2 : - -STARTTEST -:so small.vim -:if !exists('*sha256') - e! test.ok - wq! test.out -:endif -:" -:let testcase='test for empty string: ' -:if sha256("") ==# 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' -: let res='ok' -:else -: let res='ng' -:endif -:$put =testcase.res -:" -:let testcase='test for 1 char: ' -:if sha256("a") ==# 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb' -: let res='ok' -:else -: let res='ng' -:endif -:$put =testcase.res -:" -:let testcase='test for 3 chars: ' -:if sha256("abc") ==# 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad' -: let res='ok' -:else -: let res='ng' -:endif -:$put =testcase.res -:" -:let testcase='test for contains meta char: ' -:if sha256("foo\nbar") ==# '807eff6267f3f926a21d234f7b0cf867a86f47e07a532f15e8cc39ed110ca776' -: let res='ok' -:else -: let res='ng' -:endif -:$put =testcase.res -:" -:let testcase='test for contains non-ascii char: ' -:if sha256("\xde\xad\xbe\xef") ==# '5f78c33274e43fa9de5659265c1d917e25c03722dcb0b8d27db8d5feaa813953' -: let res='ok' -:else -: let res='ng' -:endif -:$put =testcase.res -" -:/^start:/,$wq! test.out -ENDTEST - -start: diff --git a/src/nvim/testdir/test90.ok b/src/nvim/testdir/test90.ok deleted file mode 100644 index 9a8e7fe961..0000000000 --- a/src/nvim/testdir/test90.ok +++ /dev/null @@ -1,6 +0,0 @@ -start: -test for empty string: ok -test for 1 char: ok -test for 3 chars: ok -test for contains meta char: ok -test for contains non-ascii char: ok diff --git a/src/nvim/testdir/test91.in b/src/nvim/testdir/test91.in deleted file mode 100644 index b66776b1e4..0000000000 --- a/src/nvim/testdir/test91.in +++ /dev/null @@ -1,112 +0,0 @@ -Tests for getbufvar(), getwinvar(), gettabvar() and gettabwinvar(). -vim: set ft=vim : - -STARTTEST -:so small.vim -:so mbyte.vim -:" -:" Test for getbufvar() -:" Use strings to test for memory leaks. -:let b:var_num = '1234' -:let def_num = '5678' -:$put =string(getbufvar(1, 'var_num')) -:$put =string(getbufvar(1, 'var_num', def_num)) -:$put =string(getbufvar(1, '')) -:$put =string(getbufvar(1, '', def_num)) -:unlet b:var_num -:$put =string(getbufvar(1, 'var_num', def_num)) -:$put =string(getbufvar(1, '')) -:$put =string(getbufvar(1, '', def_num)) -:$put =string(getbufvar(9, '')) -:$put =string(getbufvar(9, '', def_num)) -:unlet def_num -:$put =string(getbufvar(1, '&autoindent')) -:$put =string(getbufvar(1, '&autoindent', 1)) -:" -:" Open new window with forced option values -:set fileformats=unix,dos -:new ++ff=dos ++bin ++enc=iso-8859-2 -:let otherff = getbufvar(bufnr('%'), '&fileformat') -:let otherbin = getbufvar(bufnr('%'), '&bin') -:let otherfenc = getbufvar(bufnr('%'), '&fenc') -:close -:$put =otherff -:$put =string(otherbin) -:$put =otherfenc -:unlet otherff otherbin otherfenc -:" test for getwinvar() -:let w:var_str = "Dance" -:let def_str = "Chance" -:$put =string(getwinvar(1, 'var_str')) -:$put =string(getwinvar(1, 'var_str', def_str)) -:$put =string(getwinvar(1, '')) -:$put =string(getwinvar(1, '', def_str)) -:unlet w:var_str -:$put =string(getwinvar(1, 'var_str', def_str)) -:$put =string(getwinvar(1, '')) -:$put =string(getwinvar(1, '', def_str)) -:$put =string(getwinvar(9, '')) -:$put =string(getwinvar(9, '', def_str)) -:$put =string(getwinvar(1, '&nu')) -:$put =string(getwinvar(1, '&nu', 1)) -:unlet def_str -:" -:" test for gettabvar() -:tabnew -:tabnew -:let t:var_list = [1, 2, 3] -:let t:other = 777 -:let def_list = [4, 5, 6, 7] -:tabrewind -:$put =string(gettabvar(3, 'var_list')) -:$put =string(gettabvar(3, 'var_list', def_list)) -:$put =string(gettabvar(3, '')) -:$put =string(gettabvar(3, '', def_list)) -:tablast -:unlet t:var_list -:tabrewind -:$put =string(gettabvar(3, 'var_list', def_list)) -:$put =string(gettabvar(9, '')) -:$put =string(gettabvar(9, '', def_list)) -:$put =string(gettabvar(3, '&nu')) -:$put =string(gettabvar(3, '&nu', def_list)) -:unlet def_list -:tabonly -:" -:" test for gettabwinvar() -:tabnew -:tabnew -:tabprev -:split -:split -:wincmd w -:vert split -:wincmd w -:let w:var_dict = {'dict': 'tabwin'} -:let def_dict = {'dict2': 'newval'} -:wincmd b -:tabrewind -:$put =string(gettabwinvar(2, 3, 'var_dict')) -:$put =string(gettabwinvar(2, 3, 'var_dict', def_dict)) -:$put =string(gettabwinvar(2, 3, '')) -:$put =string(gettabwinvar(2, 3, '', def_dict)) -:tabnext -:3wincmd w -:unlet w:var_dict -:tabrewind -:$put =string(gettabwinvar(2, 3, 'var_dict', def_dict)) -:$put =string(gettabwinvar(2, 3, '')) -:$put =string(gettabwinvar(2, 3, '', def_dict)) -:$put =string(gettabwinvar(2, 9, '')) -:$put =string(gettabwinvar(2, 9, '', def_dict)) -:$put =string(gettabwinvar(9, 3, '')) -:$put =string(gettabwinvar(9, 3, '', def_dict)) -:unlet def_dict -:$put =string(gettabwinvar(2, 3, '&nux')) -:$put =string(gettabwinvar(2, 3, '&nux', 1)) -:tabonly -:" -:/^start/,$wq! test.out -ENDTEST - -start: diff --git a/src/nvim/testdir/test91.ok b/src/nvim/testdir/test91.ok deleted file mode 100644 index 809952b69d..0000000000 --- a/src/nvim/testdir/test91.ok +++ /dev/null @@ -1,48 +0,0 @@ -start: -'1234' -'1234' -{'var_num': '1234'} -{'var_num': '1234'} -'5678' -{} -{} -'' -'5678' -0 -0 -dos -1 -iso-8859-2 -'Dance' -'Dance' -{'var_str': 'Dance'} -{'var_str': 'Dance'} -'Chance' -{} -{} -'' -'Chance' -0 -0 -[1, 2, 3] -[1, 2, 3] -{'var_list': [1, 2, 3], 'other': 777} -{'var_list': [1, 2, 3], 'other': 777} -[4, 5, 6, 7] -'' -[4, 5, 6, 7] -'' -[4, 5, 6, 7] -{'dict': 'tabwin'} -{'dict': 'tabwin'} -{'var_dict': {'dict': 'tabwin'}} -{'var_dict': {'dict': 'tabwin'}} -{'dict2': 'newval'} -{} -{} -'' -{'dict2': 'newval'} -'' -{'dict2': 'newval'} -'' -1 diff --git a/src/nvim/testdir/test95.in b/src/nvim/testdir/test95.in deleted file mode 100644 index 221b550487..0000000000 --- a/src/nvim/testdir/test95.in +++ /dev/null @@ -1,140 +0,0 @@ -Test for regexp patterns with multi-byte support, using utf-8. -See test64 for the non-multi-byte tests. - -A pattern that gives the expected result produces OK, so that we know it was -actually tried. - -STARTTEST -:so small.vim -:so mbyte.vim -:set encoding=utf-8 nomore -:" tl is a List of Lists with: -:" 2: test auto/old/new 0: test auto/old 1: test auto/new -:" regexp pattern -:" text to test the pattern on -:" expected match (optional) -:" expected submatch 1 (optional) -:" expected submatch 2 (optional) -:" etc. -:" When there is no match use only the first two items. -:let tl = [] - -:"""" Multi-byte character tests. -:call add(tl, [2, '[[:alpha:][=a=]]\+', '879 aiaãâaiuvna ', 'aiaãâaiuvna']) -:call add(tl, [2, '[[=a=]]\+', 'ddaãâbcd', 'aãâ']) " equivalence classes -:call add(tl, [2, '[^ม ]\+', 'มม oijasoifjos ifjoisj f osij j มมมมม abcd', 'oijasoifjos']) -:call add(tl, [2, ' [^ ]\+', 'start มabcdม ', ' มabcdม']) -:call add(tl, [2, '[ม[:alpha:][=a=]]\+', '879 aiaãมâมaiuvna ', 'aiaãมâมaiuvna']) - -:" this is not a normal "i" but 0xec -:call add(tl, [2, '\p\+', 'ìa', 'ìa']) -:call add(tl, [2, '\p*', 'aあ', 'aあ']) - -:"""" Test recognition of some character classes -:call add(tl, [2, '\i\+', '&*¨xx ', 'xx']) -:call add(tl, [2, '\f\+', '&*fname ', 'fname']) - -:"""" Test composing character matching -:call add(tl, [2, '.ม', 'xม่x yมy', 'yม']) -:call add(tl, [2, '.ม่', 'xม่x yมy', 'xม่']) -:call add(tl, [2, "\u05b9", " x\u05b9 ", "x\u05b9"]) -:call add(tl, [2, ".\u05b9", " x\u05b9 ", "x\u05b9"]) -:call add(tl, [2, "\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) -:call add(tl, [2, ".\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) -:call add(tl, [2, "\u05bb\u05b9", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) -:call add(tl, [2, ".\u05bb\u05b9", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) -:call add(tl, [2, "\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"]) -:call add(tl, [2, ".\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"]) -:call add(tl, [2, "\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"]) -:call add(tl, [2, ".\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"]) -:call add(tl, [1, "\u05b9\u05bb", " y\u05b9 x\u05b9\u05bb ", "x\u05b9\u05bb"]) -:call add(tl, [2, ".\u05b9\u05bb", " y\u05bb x\u05b9\u05bb ", "x\u05b9\u05bb"]) -:call add(tl, [2, "a", "ca\u0300t"]) -:call add(tl, [2, "ca", "ca\u0300t"]) -:call add(tl, [2, "a\u0300", "ca\u0300t", "a\u0300"]) -:call add(tl, [2, 'a\%C', "ca\u0300t", "a\u0300"]) -:call add(tl, [2, 'ca\%C', "ca\u0300t", "ca\u0300"]) -:call add(tl, [2, 'ca\%Ct', "ca\u0300t", "ca\u0300t"]) - - -:"""" Test \Z -:call add(tl, [2, 'ú\Z', 'x']) -:call add(tl, [2, 'יהוה\Z', 'יהוה', 'יהוה']) -:call add(tl, [2, 'יְהוָה\Z', 'יהוה', 'יהוה']) -:call add(tl, [2, 'יהוה\Z', 'יְהוָה', 'יְהוָה']) -:call add(tl, [2, 'יְהוָה\Z', 'יְהוָה', 'יְהוָה']) -:call add(tl, [2, 'יְ\Z', 'וְיַ', 'יַ']) -:call add(tl, [2, "ק\u200d\u05b9x\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"]) -:call add(tl, [2, "ק\u200d\u05b9x\\Z", "xק\u200dxy", "ק\u200dx"]) -:call add(tl, [2, "ק\u200dx\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"]) -:call add(tl, [2, "ק\u200dx\\Z", "xק\u200dxy", "ק\u200dx"]) -:call add(tl, [2, "\u05b9\\Z", "xyz"]) -:call add(tl, [2, "\\Z\u05b9", "xyz"]) -:call add(tl, [2, "\u05b9\\Z", "xy\u05b9z", "y\u05b9"]) -:call add(tl, [2, "\\Z\u05b9", "xy\u05b9z", "y\u05b9"]) -:call add(tl, [1, "\u05b9\\+\\Z", "xy\u05b9z\u05b9 ", "y\u05b9z\u05b9"]) -:call add(tl, [1, "\\Z\u05b9\\+", "xy\u05b9z\u05b9 ", "y\u05b9z\u05b9"]) - -:"""" Combining different tests and features -:call add(tl, [2, '[^[=a=]]\+', 'ddaãâbcd', 'dd']) - -:"""" Run the tests - -:" -:for t in tl -: let re = t[0] -: let pat = t[1] -: let text = t[2] -: let matchidx = 3 -: for engine in [0, 1, 2] -: if engine == 2 && re == 0 || engine == 1 && re == 1 -: continue -: endif -: let ®expengine = engine -: try -: let l = matchlist(text, pat) -: catch -: $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", caused an exception: \"' . v:exception . '\"' -: endtry -:" check the match itself -: if len(l) == 0 && len(t) > matchidx -: $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", did not match, expected: \"' . t[matchidx] . '\"' -: elseif len(l) > 0 && len(t) == matchidx -: $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected no match' -: elseif len(t) > matchidx && l[0] != t[matchidx] -: $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected: \"' . t[matchidx] . '\"' -: else -: $put ='OK ' . engine . ' - ' . pat -: endif -: if len(l) > 0 -:" check all the nine submatches -: for i in range(1, 9) -: if len(t) <= matchidx + i -: let e = '' -: else -: let e = t[matchidx + i] -: endif -: if l[i] != e -: $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", submatch ' . i . ': \"' . l[i] . '\", expected: \"' . e . '\"' -: endif -: endfor -: unlet i -: endif -: endfor -:endfor -:unlet t tl e l - -:" check that 'ambiwidth' does not change the meaning of \p -:set regexpengine=1 ambiwidth=single -:$put ='eng 1 ambi single: ' . match(\"\u00EC\", '\p') -:set regexpengine=1 ambiwidth=double -:$put ='eng 1 ambi double: ' . match(\"\u00EC\", '\p') -:set regexpengine=2 ambiwidth=single -:$put ='eng 2 ambi single: ' . match(\"\u00EC\", '\p') -:set regexpengine=2 ambiwidth=double -:$put ='eng 2 ambi double: ' . match(\"\u00EC\", '\p') - -:/\%#=1^Results/,$wq! test.out -ENDTEST - -Results of test95: diff --git a/src/nvim/testdir/test95.ok b/src/nvim/testdir/test95.ok deleted file mode 100644 index 6762994c12..0000000000 --- a/src/nvim/testdir/test95.ok +++ /dev/null @@ -1,140 +0,0 @@ -Results of test95: -OK 0 - [[:alpha:][=a=]]\+ -OK 1 - [[:alpha:][=a=]]\+ -OK 2 - [[:alpha:][=a=]]\+ -OK 0 - [[=a=]]\+ -OK 1 - [[=a=]]\+ -OK 2 - [[=a=]]\+ -OK 0 - [^ม ]\+ -OK 1 - [^ม ]\+ -OK 2 - [^ม ]\+ -OK 0 - [^ ]\+ -OK 1 - [^ ]\+ -OK 2 - [^ ]\+ -OK 0 - [ม[:alpha:][=a=]]\+ -OK 1 - [ม[:alpha:][=a=]]\+ -OK 2 - [ม[:alpha:][=a=]]\+ -OK 0 - \p\+ -OK 1 - \p\+ -OK 2 - \p\+ -OK 0 - \p* -OK 1 - \p* -OK 2 - \p* -OK 0 - \i\+ -OK 1 - \i\+ -OK 2 - \i\+ -OK 0 - \f\+ -OK 1 - \f\+ -OK 2 - \f\+ -OK 0 - .ม -OK 1 - .ม -OK 2 - .ม -OK 0 - .ม่ -OK 1 - .ม่ -OK 2 - .ม่ -OK 0 - ֹ -OK 1 - ֹ -OK 2 - ֹ -OK 0 - .ֹ -OK 1 - .ֹ -OK 2 - .ֹ -OK 0 - ֹֻ -OK 1 - ֹֻ -OK 2 - ֹֻ -OK 0 - .ֹֻ -OK 1 - .ֹֻ -OK 2 - .ֹֻ -OK 0 - ֹֻ -OK 1 - ֹֻ -OK 2 - ֹֻ -OK 0 - .ֹֻ -OK 1 - .ֹֻ -OK 2 - .ֹֻ -OK 0 - ֹ -OK 1 - ֹ -OK 2 - ֹ -OK 0 - .ֹ -OK 1 - .ֹ -OK 2 - .ֹ -OK 0 - ֹ -OK 1 - ֹ -OK 2 - ֹ -OK 0 - .ֹ -OK 1 - .ֹ -OK 2 - .ֹ -OK 0 - ֹֻ -OK 2 - ֹֻ -OK 0 - .ֹֻ -OK 1 - .ֹֻ -OK 2 - .ֹֻ -OK 0 - a -OK 1 - a -OK 2 - a -OK 0 - ca -OK 1 - ca -OK 2 - ca -OK 0 - à -OK 1 - à -OK 2 - à -OK 0 - a\%C -OK 1 - a\%C -OK 2 - a\%C -OK 0 - ca\%C -OK 1 - ca\%C -OK 2 - ca\%C -OK 0 - ca\%Ct -OK 1 - ca\%Ct -OK 2 - ca\%Ct -OK 0 - ú\Z -OK 1 - ú\Z -OK 2 - ú\Z -OK 0 - יהוה\Z -OK 1 - יהוה\Z -OK 2 - יהוה\Z -OK 0 - יְהוָה\Z -OK 1 - יְהוָה\Z -OK 2 - יְהוָה\Z -OK 0 - יהוה\Z -OK 1 - יהוה\Z -OK 2 - יהוה\Z -OK 0 - יְהוָה\Z -OK 1 - יְהוָה\Z -OK 2 - יְהוָה\Z -OK 0 - יְ\Z -OK 1 - יְ\Z -OK 2 - יְ\Z -OK 0 - קֹx\Z -OK 1 - קֹx\Z -OK 2 - קֹx\Z -OK 0 - קֹx\Z -OK 1 - קֹx\Z -OK 2 - קֹx\Z -OK 0 - קx\Z -OK 1 - קx\Z -OK 2 - קx\Z -OK 0 - קx\Z -OK 1 - קx\Z -OK 2 - קx\Z -OK 0 - ֹ\Z -OK 1 - ֹ\Z -OK 2 - ֹ\Z -OK 0 - \Zֹ -OK 1 - \Zֹ -OK 2 - \Zֹ -OK 0 - ֹ\Z -OK 1 - ֹ\Z -OK 2 - ֹ\Z -OK 0 - \Zֹ -OK 1 - \Zֹ -OK 2 - \Zֹ -OK 0 - ֹ\+\Z -OK 2 - ֹ\+\Z -OK 0 - \Zֹ\+ -OK 2 - \Zֹ\+ -OK 0 - [^[=a=]]\+ -OK 1 - [^[=a=]]\+ -OK 2 - [^[=a=]]\+ -eng 1 ambi single: 0 -eng 1 ambi double: 0 -eng 2 ambi single: 0 -eng 2 ambi double: 0 diff --git a/src/nvim/testdir/test98.in b/src/nvim/testdir/test98.in deleted file mode 100644 index 83ccba09e9..0000000000 --- a/src/nvim/testdir/test98.in +++ /dev/null @@ -1,43 +0,0 @@ -Test for 'scrollbind' causing an unexpected scroll of one of the windows. -STARTTEST -:so small.vim -:" We don't want the status line to cause problems: -:set laststatus=0 -:let g:totalLines = &lines * 20 -:let middle = g:totalLines / 2 -:wincmd n -:wincmd o -:for i in range(1, g:totalLines) -: call setline(i, 'LINE ' . i) -:endfor -:exe string(middle) -:normal zt -:normal M -:aboveleft vert new -:for i in range(1, g:totalLines) -: call setline(i, 'line ' . i) -:endfor -:exe string(middle) -:normal zt -:normal M -:" Execute the following two command at once to reproduce the problem. -:setl scb | wincmd p -:setl scb -:wincmd w -:let topLineLeft = line('w0') -:wincmd p -:let topLineRight = line('w0') -:setl noscrollbind -:wincmd p -:setl noscrollbind -:q! -:%del _ -:call setline(1, 'Difference between the top lines (left - right): ' . string(topLineLeft - topLineRight)) -:w! test.out -:brewind -ENDTEST - -STARTTEST -:qa! -ENDTEST - diff --git a/src/nvim/testdir/test98.ok b/src/nvim/testdir/test98.ok deleted file mode 100644 index 356ddd8eac..0000000000 --- a/src/nvim/testdir/test98.ok +++ /dev/null @@ -1 +0,0 @@ -Difference between the top lines (left - right): 0 diff --git a/src/nvim/testdir/test_listlbr_utf8.in b/src/nvim/testdir/test_listlbr_utf8.in deleted file mode 100644 index 23b3098786..0000000000 --- a/src/nvim/testdir/test_listlbr_utf8.in +++ /dev/null @@ -1,53 +0,0 @@ -Test for linebreak and list option in utf-8 mode - -STARTTEST -:so small.vim -:if !exists("+linebreak") | e! test.ok | w! test.out | qa! | endif -:set wildchar=^E -:so mbyte.vim -:if &enc !=? 'utf-8'|:e! test.ok|:w! test.out|qa!|endif -:10new|:vsp|:vert resize 20 -:put =\"\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP \" -:norm! zt -:set ts=4 sw=4 sts=4 linebreak sbr=+ wrap -:fu! ScreenChar(width) -: let c='' -: for j in range(1,4) -: for i in range(1,a:width) -: let c.=nr2char(screenchar(j, i)) -: endfor -: let c.="\n" -: endfor -: return c -:endfu -:fu! DoRecordScreen() -: wincmd l -: $put =printf(\"\n%s\", g:test) -: $put =g:line -: wincmd p -:endfu -:let g:test ="Test 1: set linebreak + set list + fancy listchars" -:exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6" -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:" -:let g:test ="Test 2: set nolinebreak list" -:set list nolinebreak -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:" -:let g:test ="Test 3: set linebreak nolist" -:$put =\"\t*mask = nil;\" -:$ -:norm! zt -:set nolist linebreak -:redraw! -:let line=ScreenChar(winwidth(0)) -:call DoRecordScreen() -:" -:%w! test.out -:qa! -ENDTEST -dummy text diff --git a/src/nvim/testdir/test_listlbr_utf8.ok b/src/nvim/testdir/test_listlbr_utf8.ok deleted file mode 100644 index 634cf3906d..0000000000 --- a/src/nvim/testdir/test_listlbr_utf8.ok +++ /dev/null @@ -1,21 +0,0 @@ - - abcdef hijklmn pqrstuvwxyz 1060ABCDEFGHIJKLMNOP - -Test 1: set linebreak + set list + fancy listchars -▕———abcdef -+hijklmn▕——— -+pqrstuvwxyz␣1060ABC -+DEFGHIJKLMNOPˑ¶ - -Test 2: set nolinebreak list -▕———abcdef hijklmn▕— -+pqrstuvwxyz␣1060ABC -+DEFGHIJKLMNOPˑ¶ -¶ - *mask = nil; - -Test 3: set linebreak nolist - *mask = nil; -~ -~ -~ diff --git a/src/nvim/testdir/test_qf_title.in b/src/nvim/testdir/test_qf_title.in deleted file mode 100644 index fce0c260e3..0000000000 --- a/src/nvim/testdir/test_qf_title.in +++ /dev/null @@ -1,18 +0,0 @@ -Tests for quickfix window's title vim: set ft=vim : - -STARTTEST -:so small.vim -:if !has('quickfix') | e! test.ok | wq! test.out | endif -:set efm=%E%f:%l:%c:%m -:cgetexpr ['file:1:1:message'] -:let qflist=getqflist() -:call setqflist(qflist, 'r') -:copen -:let g:quickfix_title=w:quickfix_title -:wincmd p -:$put =g:quickfix_title -:/^Results/,$w test.out -:qa! -ENDTEST - -Results of test_qf_title: diff --git a/src/nvim/testdir/test_qf_title.ok b/src/nvim/testdir/test_qf_title.ok deleted file mode 100644 index 4ebdbeff3b..0000000000 --- a/src/nvim/testdir/test_qf_title.ok +++ /dev/null @@ -1,2 +0,0 @@ -Results of test_qf_title: -:setqflist() diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index dec2840fdb..b95a22d48b 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -110,7 +110,7 @@ void tui_start(void) unibi_out(ui, unibi_enter_ca_mode); unibi_out(ui, unibi_clear_screen); // Enable bracketed paste - unibi_out(ui, (int)data->unibi_ext.enable_bracketed_paste); + unibi_out(ui, data->unibi_ext.enable_bracketed_paste); // setup output handle in a separate event loop(we wanna do synchronous // write to the tty) @@ -172,7 +172,7 @@ static void tui_stop(UI *ui) unibi_out(ui, unibi_cursor_normal); unibi_out(ui, unibi_exit_ca_mode); // Disable bracketed paste - unibi_out(ui, (int)data->unibi_ext.disable_bracketed_paste); + unibi_out(ui, data->unibi_ext.disable_bracketed_paste); flush_buf(ui); uv_tty_reset_mode(); uv_close((uv_handle_t *)&data->output_handle, NULL); @@ -355,25 +355,25 @@ static void tui_cursor_off(UI *ui) static void tui_mouse_on(UI *ui) { TUIData *data = ui->data; - unibi_out(ui, (int)data->unibi_ext.enable_mouse); + unibi_out(ui, data->unibi_ext.enable_mouse); } static void tui_mouse_off(UI *ui) { TUIData *data = ui->data; - unibi_out(ui, (int)data->unibi_ext.disable_mouse); + unibi_out(ui, data->unibi_ext.disable_mouse); } static void tui_insert_mode(UI *ui) { TUIData *data = ui->data; - unibi_out(ui, (int)data->unibi_ext.enter_insert_mode); + unibi_out(ui, data->unibi_ext.enter_insert_mode); } static void tui_normal_mode(UI *ui) { TUIData *data = ui->data; - unibi_out(ui, (int)data->unibi_ext.exit_insert_mode); + unibi_out(ui, data->unibi_ext.exit_insert_mode); } static void tui_set_scroll_region(UI *ui, int top, int bot, int left, diff --git a/src/nvim/version.c b/src/nvim/version.c index 474dbf73f8..2c819c6f42 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -183,7 +183,7 @@ static int included_patches[] = { //618, //617, //616, - //615, + 615, //614, //613, //612, diff --git a/src/nvim/window.c b/src/nvim/window.c index 8b6f925928..7b5848c124 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -4764,7 +4764,7 @@ void command_height(void) /* clear the lines added to cmdline */ if (full_screen) - screen_fill((int)(cmdline_row), (int)Rows, 0, + screen_fill(cmdline_row, (int)Rows, 0, (int)Columns, ' ', ' ', 0); msg_row = cmdline_row; redraw_cmdline = TRUE; diff --git a/test/functional/legacy/005_bufleave_delete_buffer.lua b/test/functional/legacy/005_bufleave_delete_buffer_spec.lua index e8459ad4a7..e6989a6674 100644 --- a/test/functional/legacy/005_bufleave_delete_buffer.lua +++ b/test/functional/legacy/005_bufleave_delete_buffer_spec.lua @@ -38,18 +38,15 @@ describe('test5', function() -- Write current file contents. execute('?start?,$yank A') - -- Delete alternate buffer. - execute('bwipe test.out') - execute('au bufleave test5.in bwipe') - -- Delete current buffer, get an empty one. execute('bwipe!') + -- Append an extra line to the output register. feed('ithis is another test line<esc>:yank A<cr>') -- Output results execute('%d') execute('0put a') - execute('1d | $d') + execute('$d') -- Assert buffer contents. expect([[ diff --git a/test/functional/legacy/015_alignment_spec.lua b/test/functional/legacy/015_alignment_spec.lua new file mode 100644 index 0000000000..e71f9d1c90 --- /dev/null +++ b/test/functional/legacy/015_alignment_spec.lua @@ -0,0 +1,258 @@ +-- Tests for :right on text with embedded TAB. +-- Also test formatting a paragraph. +-- Also test undo after ":%s" and formatting. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('alignment', function() + setup(clear) + + it('is working', function() + insert([[ + test for :left + a a + fa a + dfa a + sdfa a + asdfa a + xasdfa a + asxxdfa a + + test for :center + a a + fa afd asdf + dfa a + sdfa afd asdf + asdfa a + xasdfa asdfasdfasdfasdfasdf + asxxdfa a + + test for :right + a a + fa a + dfa a + sdfa a + asdfa a + xasdfa a + asxxdfa a + asxa;ofa a + asdfaqwer a + a ax + fa ax + dfa ax + sdfa ax + asdfa ax + xasdfa ax + asxxdfa ax + asxa;ofa ax + asdfaqwer ax + a axx + fa axx + dfa axx + sdfa axx + asdfa axx + xasdfa axx + asxxdfa axx + asxa;ofa axx + asdfaqwer axx + a axxx + fa axxx + dfa axxx + sdfa axxx + asdfa axxx + xasdfa axxx + asxxdfa axxx + asxa;ofa axxx + asdfaqwer axxx + a axxxo + fa axxxo + dfa axxxo + sdfa axxxo + asdfa axxxo + xasdfa axxxo + asxxdfa axxxo + asxa;ofa axxxo + asdfaqwer axxxo + a axxxoi + fa axxxoi + dfa axxxoi + sdfa axxxoi + asdfa axxxoi + xasdfa axxxoi + asxxdfa axxxoi + asxa;ofa axxxoi + asdfaqwer axxxoi + a axxxoik + fa axxxoik + dfa axxxoik + sdfa axxxoik + asdfa axxxoik + xasdfa axxxoik + asxxdfa axxxoik + asxa;ofa axxxoik + asdfaqwer axxxoik + a axxxoike + fa axxxoike + dfa axxxoike + sdfa axxxoike + asdfa axxxoike + xasdfa axxxoike + asxxdfa axxxoike + asxa;ofa axxxoike + asdfaqwer axxxoike + a axxxoikey + fa axxxoikey + dfa axxxoikey + sdfa axxxoikey + asdfa axxxoikey + xasdfa axxxoikey + asxxdfa axxxoikey + asxa;ofa axxxoikey + asdfaqwer axxxoikey + + xxxxx xx xxxxxx + xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx + xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx + xx xxxxxxx. xxxx xxxx. + + > xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx + > xxxxxx xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx + + aa aa aa aa + bb bb bb bb + cc cc cc cc]]) + + execute('set tw=65') + + feed([[:/^\s*test for :left/,/^\s*test for :center/ left<cr>]]) + feed([[:/^\s*test for :center/,/^\s*test for :right/ center<cr>]]) + feed([[:/^\s*test for :right/,/^xxx/-1 right<cr>]]) + + execute('set fo+=tcroql tw=72') + + feed('/xxxxxxxx$<cr>') + feed('0gq6kk<cr>') + + -- Undo/redo here to make the next undo only work on the following changes. + feed('u<cr>') + execute('map gg :.,.+2s/^/x/<CR>kk:set tw=3<CR>gqq') + execute('/^aa') + feed('ggu<cr>') + + -- Assert buffer contents. + expect([[ + test for :left + a a + fa a + dfa a + sdfa a + asdfa a + xasdfa a + asxxdfa a + + test for :center + a a + fa afd asdf + dfa a + sdfa afd asdf + asdfa a + xasdfa asdfasdfasdfasdfasdf + asxxdfa a + + test for :right + a a + fa a + dfa a + sdfa a + asdfa a + xasdfa a + asxxdfa a + asxa;ofa a + asdfaqwer a + a ax + fa ax + dfa ax + sdfa ax + asdfa ax + xasdfa ax + asxxdfa ax + asxa;ofa ax + asdfaqwer ax + a axx + fa axx + dfa axx + sdfa axx + asdfa axx + xasdfa axx + asxxdfa axx + asxa;ofa axx + asdfaqwer axx + a axxx + fa axxx + dfa axxx + sdfa axxx + asdfa axxx + xasdfa axxx + asxxdfa axxx + asxa;ofa axxx + asdfaqwer axxx + a axxxo + fa axxxo + dfa axxxo + sdfa axxxo + asdfa axxxo + xasdfa axxxo + asxxdfa axxxo + asxa;ofa axxxo + asdfaqwer axxxo + a axxxoi + fa axxxoi + dfa axxxoi + sdfa axxxoi + asdfa axxxoi + xasdfa axxxoi + asxxdfa axxxoi + asxa;ofa axxxoi + asdfaqwer axxxoi + a axxxoik + fa axxxoik + dfa axxxoik + sdfa axxxoik + asdfa axxxoik + xasdfa axxxoik + asxxdfa axxxoik + asxa;ofa axxxoik + asdfaqwer axxxoik + a axxxoike + fa axxxoike + dfa axxxoike + sdfa axxxoike + asdfa axxxoike + xasdfa axxxoike + asxxdfa axxxoike + asxa;ofa axxxoike + asdfaqwer axxxoike + a axxxoikey + fa axxxoikey + dfa axxxoikey + sdfa axxxoikey + asdfa axxxoikey + xasdfa axxxoikey + asxxdfa axxxoikey + asxa;ofa axxxoikey + asdfaqwer axxxoikey + + xxxxx xx xxxxxx xxxxxxx xxxxxxxxx xxx xxxx xxxxx xxxxx xxx xx + xxxxxxxxxxxxxxxxxx xxxxx xxxx, xxxx xxxx xxxx xxxx xxx xx xx xx xxxxxxx. + xxxx xxxx. + + > xx xx, xxxx xxxx xxx xxxx xxx xxxxx xxx xxx xxxxxxx xxx xxxxx xxxxxx + > xxxxxxx: xxxx xxxxxxx, xx xxxxxx xxxx xxxxxxxxxx + + aa aa aa aa + bb bb bb bb + cc cc cc cc]]) + end) +end) diff --git a/test/functional/legacy/084_curswant_spec.lua b/test/functional/legacy/084_curswant_spec.lua new file mode 100644 index 0000000000..55df5d3e73 --- /dev/null +++ b/test/functional/legacy/084_curswant_spec.lua @@ -0,0 +1,48 @@ +-- Tests for curswant not changing when setting an option. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('curswant', function() + setup(clear) + + it('is working', function() + insert([[ + start target options + tabstop + timeoutlen + ttimeoutlen + end target options]]) + + source([[ + /^start target options$/+1,/^end target options$/-1 yank + let target_option_names = split(@0) + function TestCurswant(option_name) + normal! ggf8j + let curswant_before = winsaveview().curswant + execute 'let' '&'.a:option_name '=' '&'.a:option_name + let curswant_after = winsaveview().curswant + return [a:option_name, curswant_before, curswant_after] + endfunction + + new + put =['1234567890', '12345'] + 1 delete _ + let result = [] + for option_name in target_option_names + call add(result, TestCurswant(option_name)) + endfor + + new + put =map(copy(result), 'join(v:val, '' '')') + 1 delete _ + ]]) + + -- Assert buffer contents. + expect([[ + tabstop 7 4 + timeoutlen 7 7 + ttimeoutlen 7 7]]) + end) +end) diff --git a/test/functional/legacy/090_sha256_spec.lua b/test/functional/legacy/090_sha256_spec.lua new file mode 100644 index 0000000000..35fbd5752e --- /dev/null +++ b/test/functional/legacy/090_sha256_spec.lua @@ -0,0 +1,64 @@ +-- Tests for sha256() function. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('sha256()', function() + setup(clear) + + it('is working', function() + insert("start:") + + source([[ + let testcase='test for empty string: ' + if sha256("") ==# 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' + let res='ok' + else + let res='ng' + endif + $put =testcase.res + + let testcase='test for 1 char: ' + if sha256("a") ==# 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb' + let res='ok' + else + let res='ng' + endif + $put =testcase.res + + let testcase='test for 3 chars: ' + if sha256("abc") ==# 'ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad' + let res='ok' + else + let res='ng' + endif + $put =testcase.res + + let testcase='test for contains meta char: ' + if sha256("foo\nbar") ==# '807eff6267f3f926a21d234f7b0cf867a86f47e07a532f15e8cc39ed110ca776' + let res='ok' + else + let res='ng' + endif + $put =testcase.res + + let testcase='test for contains non-ascii char: ' + if sha256("\xde\xad\xbe\xef") ==# '5f78c33274e43fa9de5659265c1d917e25c03722dcb0b8d27db8d5feaa813953' + let res='ok' + else + let res='ng' + endif + $put =testcase.res + ]]) + + -- Assert buffer contents. + expect([[ + start: + test for empty string: ok + test for 1 char: ok + test for 3 chars: ok + test for contains meta char: ok + test for contains non-ascii char: ok]]) + end) +end) diff --git a/test/functional/legacy/091_context_variables_spec.lua b/test/functional/legacy/091_context_variables_spec.lua new file mode 100644 index 0000000000..bb9c32b84f --- /dev/null +++ b/test/functional/legacy/091_context_variables_spec.lua @@ -0,0 +1,176 @@ +-- Tests for getbufvar(), getwinvar(), gettabvar() and gettabwinvar(). + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('context variables', function() + setup(clear) + + it('is working', function() + insert("start:") + + -- Test for getbufvar(). + -- Use strings to test for memory leaks. + source([[ + let b:var_num = '1234' + let def_num = '5678' + $put =string(getbufvar(1, 'var_num')) + $put =string(getbufvar(1, 'var_num', def_num)) + $put =string(getbufvar(1, '')) + $put =string(getbufvar(1, '', def_num)) + unlet b:var_num + $put =string(getbufvar(1, 'var_num', def_num)) + $put =string(getbufvar(1, '')) + $put =string(getbufvar(1, '', def_num)) + $put =string(getbufvar(9, '')) + $put =string(getbufvar(9, '', def_num)) + unlet def_num + $put =string(getbufvar(1, '&autoindent')) + $put =string(getbufvar(1, '&autoindent', 1)) + ]]) + + -- Open new window with forced option values. + source([[ + set fileformats=unix,dos + new ++ff=dos ++bin ++enc=iso-8859-2 + let otherff = getbufvar(bufnr('%'), '&fileformat') + let otherbin = getbufvar(bufnr('%'), '&bin') + let otherfenc = getbufvar(bufnr('%'), '&fenc') + close + $put =otherff + $put =string(otherbin) + $put =otherfenc + unlet otherff otherbin otherfenc + ]]) + + -- Test for getwinvar(). + source([[ + let w:var_str = "Dance" + let def_str = "Chance" + $put =string(getwinvar(1, 'var_str')) + $put =string(getwinvar(1, 'var_str', def_str)) + $put =string(getwinvar(1, '')) + $put =string(getwinvar(1, '', def_str)) + unlet w:var_str + $put =string(getwinvar(1, 'var_str', def_str)) + $put =string(getwinvar(1, '')) + $put =string(getwinvar(1, '', def_str)) + $put =string(getwinvar(9, '')) + $put =string(getwinvar(9, '', def_str)) + $put =string(getwinvar(1, '&nu')) + $put =string(getwinvar(1, '&nu', 1)) + unlet def_str + ]]) + + -- Test for gettabvar(). + source([[ + tabnew + tabnew + let t:var_list = [1, 2, 3] + let t:other = 777 + let def_list = [4, 5, 6, 7] + tabrewind + $put =string(gettabvar(3, 'var_list')) + $put =string(gettabvar(3, 'var_list', def_list)) + $put =string(gettabvar(3, '')) + $put =string(gettabvar(3, '', def_list)) + tablast + unlet t:var_list + tabrewind + $put =string(gettabvar(3, 'var_list', def_list)) + $put =string(gettabvar(9, '')) + $put =string(gettabvar(9, '', def_list)) + $put =string(gettabvar(3, '&nu')) + $put =string(gettabvar(3, '&nu', def_list)) + unlet def_list + tabonly + ]]) + + -- Test for gettabwinvar(). + source([[ + tabnew + tabnew + tabprev + split + split + wincmd w + vert split + wincmd w + let w:var_dict = {'dict': 'tabwin'} + let def_dict = {'dict2': 'newval'} + wincmd b + tabrewind + $put =string(gettabwinvar(2, 3, 'var_dict')) + $put =string(gettabwinvar(2, 3, 'var_dict', def_dict)) + $put =string(gettabwinvar(2, 3, '')) + $put =string(gettabwinvar(2, 3, '', def_dict)) + tabnext + 3wincmd w + unlet w:var_dict + tabrewind + $put =string(gettabwinvar(2, 3, 'var_dict', def_dict)) + $put =string(gettabwinvar(2, 3, '')) + $put =string(gettabwinvar(2, 3, '', def_dict)) + $put =string(gettabwinvar(2, 9, '')) + $put =string(gettabwinvar(2, 9, '', def_dict)) + $put =string(gettabwinvar(9, 3, '')) + $put =string(gettabwinvar(9, 3, '', def_dict)) + unlet def_dict + $put =string(gettabwinvar(2, 3, '&nux')) + $put =string(gettabwinvar(2, 3, '&nux', 1)) + tabonly + ]]) + + -- Assert buffer contents. + expect([[ + start: + '1234' + '1234' + {'var_num': '1234'} + {'var_num': '1234'} + '5678' + {} + {} + '' + '5678' + 0 + 0 + dos + 1 + iso-8859-2 + 'Dance' + 'Dance' + {'var_str': 'Dance'} + {'var_str': 'Dance'} + 'Chance' + {} + {} + '' + 'Chance' + 0 + 0 + [1, 2, 3] + [1, 2, 3] + {'var_list': [1, 2, 3], 'other': 777} + {'var_list': [1, 2, 3], 'other': 777} + [4, 5, 6, 7] + '' + [4, 5, 6, 7] + '' + [4, 5, 6, 7] + {'dict': 'tabwin'} + {'dict': 'tabwin'} + {'var_dict': {'dict': 'tabwin'}} + {'var_dict': {'dict': 'tabwin'}} + {'dict2': 'newval'} + {} + {} + '' + {'dict2': 'newval'} + '' + {'dict2': 'newval'} + '' + 1]]) + end) +end) diff --git a/test/functional/legacy/095_regexp_multibyte_spec.lua b/test/functional/legacy/095_regexp_multibyte_spec.lua new file mode 100644 index 0000000000..a72fb669d2 --- /dev/null +++ b/test/functional/legacy/095_regexp_multibyte_spec.lua @@ -0,0 +1,270 @@ +-- Test for regexp patterns with multi-byte support, using utf-8. +-- See test64 for the non-multi-byte tests. +-- A pattern that gives the expected result produces OK, so that we know it was +-- actually tried. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('regex with multi-byte', function() + setup(clear) + + it('is working', function() + insert([[ + Results of test95:]]) + + source([=[ + set encoding=utf-8 nomore + let tl = [] + + call add(tl, [2, '[[:alpha:][=a=]]\+', '879 aiaãâaiuvna ', 'aiaãâaiuvna']) + call add(tl, [2, '[[=a=]]\+', 'ddaãâbcd', 'aãâ']) " equivalence classes + call add(tl, [2, '[^ม ]\+', 'มม oijasoifjos ifjoisj f osij j มมมมม abcd', 'oijasoifjos']) + call add(tl, [2, ' [^ ]\+', 'start มabcdม ', ' มabcdม']) + call add(tl, [2, '[ม[:alpha:][=a=]]\+', '879 aiaãมâมaiuvna ', 'aiaãมâมaiuvna']) + + call add(tl, [2, '\p\+', 'ìa', 'ìa']) + call add(tl, [2, '\p*', 'aあ', 'aあ']) + + call add(tl, [2, '\i\+', '&*¨xx ', 'xx']) + call add(tl, [2, '\f\+', '&*fname ', 'fname']) + + call add(tl, [2, '.ม', 'xม่x yมy', 'yม']) + call add(tl, [2, '.ม่', 'xม่x yมy', 'xม่']) + call add(tl, [2, "\u05b9", " x\u05b9 ", "x\u05b9"]) + call add(tl, [2, ".\u05b9", " x\u05b9 ", "x\u05b9"]) + call add(tl, [2, "\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, ".\u05b9\u05bb", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, "\u05bb\u05b9", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, ".\u05bb\u05b9", " x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, "\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"]) + call add(tl, [2, ".\u05b9", " y\u05bb x\u05b9 ", "x\u05b9"]) + call add(tl, [2, "\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"]) + call add(tl, [2, ".\u05b9", " y\u05bb\u05b9 x\u05b9 ", "y\u05bb\u05b9"]) + call add(tl, [1, "\u05b9\u05bb", " y\u05b9 x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, ".\u05b9\u05bb", " y\u05bb x\u05b9\u05bb ", "x\u05b9\u05bb"]) + call add(tl, [2, "a", "ca\u0300t"]) + call add(tl, [2, "ca", "ca\u0300t"]) + call add(tl, [2, "a\u0300", "ca\u0300t", "a\u0300"]) + call add(tl, [2, 'a\%C', "ca\u0300t", "a\u0300"]) + call add(tl, [2, 'ca\%C', "ca\u0300t", "ca\u0300"]) + call add(tl, [2, 'ca\%Ct', "ca\u0300t", "ca\u0300t"]) + + call add(tl, [2, 'ú\Z', 'x']) + call add(tl, [2, 'יהוה\Z', 'יהוה', 'יהוה']) + call add(tl, [2, 'יְהוָה\Z', 'יהוה', 'יהוה']) + call add(tl, [2, 'יהוה\Z', 'יְהוָה', 'יְהוָה']) + call add(tl, [2, 'יְהוָה\Z', 'יְהוָה', 'יְהוָה']) + call add(tl, [2, 'יְ\Z', 'וְיַ', 'יַ']) + call add(tl, [2, "ק\u200d\u05b9x\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"]) + call add(tl, [2, "ק\u200d\u05b9x\\Z", "xק\u200dxy", "ק\u200dx"]) + call add(tl, [2, "ק\u200dx\\Z", "xק\u200d\u05b9xy", "ק\u200d\u05b9x"]) + call add(tl, [2, "ק\u200dx\\Z", "xק\u200dxy", "ק\u200dx"]) + call add(tl, [2, "\u05b9\\Z", "xyz"]) + call add(tl, [2, "\\Z\u05b9", "xyz"]) + call add(tl, [2, "\u05b9\\Z", "xy\u05b9z", "y\u05b9"]) + call add(tl, [2, "\\Z\u05b9", "xy\u05b9z", "y\u05b9"]) + call add(tl, [1, "\u05b9\\+\\Z", "xy\u05b9z\u05b9 ", "y\u05b9z\u05b9"]) + call add(tl, [1, "\\Z\u05b9\\+", "xy\u05b9z\u05b9 ", "y\u05b9z\u05b9"]) + + call add(tl, [2, '[^[=a=]]\+', 'ddaãâbcd', 'dd']) + + for t in tl + let re = t[0] + let pat = t[1] + let text = t[2] + let matchidx = 3 + for engine in [0, 1, 2] + if engine == 2 && re == 0 || engine == 1 && re == 1 + continue + endif + let ®expengine = engine + try + let l = matchlist(text, pat) + catch + $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", caused an exception: \"' . v:exception . '\"' + endtry + if len(l) == 0 && len(t) > matchidx + $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", did not match, expected: \"' . t[matchidx] . '\"' + elseif len(l) > 0 && len(t) == matchidx + $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected no match' + elseif len(t) > matchidx && l[0] != t[matchidx] + $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected: \"' . t[matchidx] . '\"' + else + $put ='OK ' . engine . ' - ' . pat + endif + if len(l) > 0 + for i in range(1, 9) + if len(t) <= matchidx + i + let e = '' + else + let e = t[matchidx + i] + endif + if l[i] != e + $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", submatch ' . i . ': \"' . l[i] . '\", expected: \"' . e . '\"' + endif + endfor + unlet i + endif + endfor + endfor + unlet t tl e l + + set regexpengine=1 ambiwidth=single + $put ='eng 1 ambi single: ' . match(\"\u00EC\", '\p') + + set regexpengine=1 ambiwidth=double + $put ='eng 1 ambi double: ' . match(\"\u00EC\", '\p') + + set regexpengine=2 ambiwidth=single + $put ='eng 2 ambi single: ' . match(\"\u00EC\", '\p') + + set regexpengine=2 ambiwidth=double + $put ='eng 2 ambi double: ' . match(\"\u00EC\", '\p') + ]=]) + + -- Assert buffer contents. + expect([=[ + Results of test95: + OK 0 - [[:alpha:][=a=]]\+ + OK 1 - [[:alpha:][=a=]]\+ + OK 2 - [[:alpha:][=a=]]\+ + OK 0 - [[=a=]]\+ + OK 1 - [[=a=]]\+ + OK 2 - [[=a=]]\+ + OK 0 - [^ม ]\+ + OK 1 - [^ม ]\+ + OK 2 - [^ม ]\+ + OK 0 - [^ ]\+ + OK 1 - [^ ]\+ + OK 2 - [^ ]\+ + OK 0 - [ม[:alpha:][=a=]]\+ + OK 1 - [ม[:alpha:][=a=]]\+ + OK 2 - [ม[:alpha:][=a=]]\+ + OK 0 - \p\+ + OK 1 - \p\+ + OK 2 - \p\+ + OK 0 - \p* + OK 1 - \p* + OK 2 - \p* + OK 0 - \i\+ + OK 1 - \i\+ + OK 2 - \i\+ + OK 0 - \f\+ + OK 1 - \f\+ + OK 2 - \f\+ + OK 0 - .ม + OK 1 - .ม + OK 2 - .ม + OK 0 - .ม่ + OK 1 - .ม่ + OK 2 - .ม่ + OK 0 - ֹ + OK 1 - ֹ + OK 2 - ֹ + OK 0 - .ֹ + OK 1 - .ֹ + OK 2 - .ֹ + OK 0 - ֹֻ + OK 1 - ֹֻ + OK 2 - ֹֻ + OK 0 - .ֹֻ + OK 1 - .ֹֻ + OK 2 - .ֹֻ + OK 0 - ֹֻ + OK 1 - ֹֻ + OK 2 - ֹֻ + OK 0 - .ֹֻ + OK 1 - .ֹֻ + OK 2 - .ֹֻ + OK 0 - ֹ + OK 1 - ֹ + OK 2 - ֹ + OK 0 - .ֹ + OK 1 - .ֹ + OK 2 - .ֹ + OK 0 - ֹ + OK 1 - ֹ + OK 2 - ֹ + OK 0 - .ֹ + OK 1 - .ֹ + OK 2 - .ֹ + OK 0 - ֹֻ + OK 2 - ֹֻ + OK 0 - .ֹֻ + OK 1 - .ֹֻ + OK 2 - .ֹֻ + OK 0 - a + OK 1 - a + OK 2 - a + OK 0 - ca + OK 1 - ca + OK 2 - ca + OK 0 - à + OK 1 - à + OK 2 - à + OK 0 - a\%C + OK 1 - a\%C + OK 2 - a\%C + OK 0 - ca\%C + OK 1 - ca\%C + OK 2 - ca\%C + OK 0 - ca\%Ct + OK 1 - ca\%Ct + OK 2 - ca\%Ct + OK 0 - ú\Z + OK 1 - ú\Z + OK 2 - ú\Z + OK 0 - יהוה\Z + OK 1 - יהוה\Z + OK 2 - יהוה\Z + OK 0 - יְהוָה\Z + OK 1 - יְהוָה\Z + OK 2 - יְהוָה\Z + OK 0 - יהוה\Z + OK 1 - יהוה\Z + OK 2 - יהוה\Z + OK 0 - יְהוָה\Z + OK 1 - יְהוָה\Z + OK 2 - יְהוָה\Z + OK 0 - יְ\Z + OK 1 - יְ\Z + OK 2 - יְ\Z + OK 0 - קֹx\Z + OK 1 - קֹx\Z + OK 2 - קֹx\Z + OK 0 - קֹx\Z + OK 1 - קֹx\Z + OK 2 - קֹx\Z + OK 0 - קx\Z + OK 1 - קx\Z + OK 2 - קx\Z + OK 0 - קx\Z + OK 1 - קx\Z + OK 2 - קx\Z + OK 0 - ֹ\Z + OK 1 - ֹ\Z + OK 2 - ֹ\Z + OK 0 - \Zֹ + OK 1 - \Zֹ + OK 2 - \Zֹ + OK 0 - ֹ\Z + OK 1 - ֹ\Z + OK 2 - ֹ\Z + OK 0 - \Zֹ + OK 1 - \Zֹ + OK 2 - \Zֹ + OK 0 - ֹ\+\Z + OK 2 - ֹ\+\Z + OK 0 - \Zֹ\+ + OK 2 - \Zֹ\+ + OK 0 - [^[=a=]]\+ + OK 1 - [^[=a=]]\+ + OK 2 - [^[=a=]]\+ + eng 1 ambi single: 0 + eng 1 ambi double: 0 + eng 2 ambi single: 0 + eng 2 ambi double: 0]=]) + end) +end) diff --git a/test/functional/legacy/098_scrollbind_spec.lua b/test/functional/legacy/098_scrollbind_spec.lua new file mode 100644 index 0000000000..7b2059e38b --- /dev/null +++ b/test/functional/legacy/098_scrollbind_spec.lua @@ -0,0 +1,48 @@ +-- Test for 'scrollbind' causing an unexpected scroll of one of the windows. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('scrollbind', function() + setup(clear) + + it('is working', function() + source([[ + set laststatus=0 + let g:totalLines = &lines * 20 + let middle = g:totalLines / 2 + wincmd n + wincmd o + for i in range(1, g:totalLines) + call setline(i, 'LINE ' . i) + endfor + exe string(middle) + normal zt + normal M + aboveleft vert new + for i in range(1, g:totalLines) + call setline(i, 'line ' . i) + endfor + exe string(middle) + normal zt + normal M + setl scb | wincmd p + setl scb + wincmd w + let topLineLeft = line('w0') + wincmd p + let topLineRight = line('w0') + setl noscrollbind + wincmd p + setl noscrollbind + q! + %del _ + call setline(1, 'Difference between the top lines (left - right): ' . string(topLineLeft - topLineRight)) + brewind + ]]) + + -- Assert buffer contents. + expect("Difference between the top lines (left - right): 0") + end) +end) diff --git a/test/functional/legacy/100_undo_level_spec.lua b/test/functional/legacy/100_undo_level_spec.lua new file mode 100644 index 0000000000..9143d9e540 --- /dev/null +++ b/test/functional/legacy/100_undo_level_spec.lua @@ -0,0 +1,142 @@ +-- Tests for 'undolevel' setting being global-local + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('undolevel', function() + setup(clear) + + it('is working', function() + source([[ + set ul=5 + fu! FillBuffer() + for i in range(1,13) + put=i + exe "setg ul=" . &g:ul + endfor + endfu + fu! UndoLevel() + redir @z + setglobal undolevels? + echon ' global' + setlocal undolevels? + echon ' local' + redir end + $put z + endfu + + 0put ='ONE: expecting global undolevels: 5, local undolevels: -123456 (default)' + call FillBuffer() + setlocal undolevels< + earlier 10 + call UndoLevel() + set ff=unix + %yank A + %delete + + 0put ='TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards)' + setlocal ul=2 + call FillBuffer() + earlier 10 + call UndoLevel() + setlocal ul=10 + call UndoLevel() + set ff=unix + %yank A + %delete + setlocal undolevels< + redir @A + echo "global value shouldn't be changed and still be 5!" + echo 'ONE: expecting global undolevels: 5, local undolevels: -123456 (default)' + setglobal undolevels? + echon ' global' + setlocal undolevels? + echon ' local' + echo "" + redir end + + setglobal ul=50 + 1put ='global value should be changed to 50' + 2put ='THREE: expecting global undolevels: 50, local undolevels: -123456 (default)' + call UndoLevel() + set ff=unix + %yank A + %delete + setglobal lispwords=foo,bar,baz + setlocal lispwords-=foo + setlocal lispwords+=quux + redir @A + echo "Testing 'lispwords' local value" + setglobal lispwords? + setlocal lispwords? + echo &lispwords + echo '' + redir end + setlocal lispwords< + redir @A + echo "Testing 'lispwords' value reset" + setglobal lispwords? + setlocal lispwords? + echo &lispwords + redir end + + 0put a + $d + ]]) + + -- Assert buffer contents. + expect([[ + ONE: expecting global undolevels: 5, local undolevels: -123456 (default) + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + + undolevels=5 global + undolevels=-123456 local + TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards) + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + + undolevels=5 global + undolevels=2 local + + undolevels=5 global + undolevels=10 local + + global value shouldn't be changed and still be 5! + ONE: expecting global undolevels: 5, local undolevels: -123456 (default) + undolevels=5 global + undolevels=-123456 local + + global value should be changed to 50 + THREE: expecting global undolevels: 50, local undolevels: -123456 (default) + + undolevels=50 global + undolevels=-123456 local + + Testing 'lispwords' local value + lispwords=foo,bar,baz + lispwords=bar,baz,quux + bar,baz,quux + + Testing 'lispwords' value reset + lispwords=foo,bar,baz + lispwords=foo,bar,baz + foo,bar,baz]]) + end) +end) diff --git a/test/functional/legacy/103_visual_mode_reset_spec.lua b/test/functional/legacy/103_visual_mode_reset_spec.lua new file mode 100644 index 0000000000..6b2f3bc1b6 --- /dev/null +++ b/test/functional/legacy/103_visual_mode_reset_spec.lua @@ -0,0 +1,47 @@ +-- Test for visual mode not being reset causing E315 error. + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('E315 error', function() + setup(clear) + + it('is working', function() + -- At this point there is no visual selection because :call reset it. + -- Let's restore the selection: + source([[ + let g:msg="Everything's fine." + function! TriggerTheProblem() + normal gv + '<,'>del _ + try + exe "normal \<Esc>" + catch /^Vim\%((\a\+)\)\=:E315/ + echom 'Snap! E315 error!' + let g:msg='Snap! E315 error!' + endtry + endfunction + enew + enew + setl buftype=nofile + call append(line('$'), 'Delete this line.') + ]]) + + -- NOTE: this has to be done by a call to a function because executing + -- :del the ex-way will require the colon operator which resets the + -- visual mode thus preventing the problem: + feed('GV:call TriggerTheProblem()<cr>') + + source([[ + %del _ + call append(line('$'), g:msg) + brewind + ]]) + + -- Assert buffer contents. + expect([[ + + Everything's fine.]]) + end) +end) diff --git a/test/functional/legacy/104_let_assignment.lua b/test/functional/legacy/104_let_assignment_spec.lua index a2431da835..a2431da835 100644 --- a/test/functional/legacy/104_let_assignment.lua +++ b/test/functional/legacy/104_let_assignment_spec.lua diff --git a/test/functional/legacy/listlbr_utf8_spec.lua b/test/functional/legacy/listlbr_utf8_spec.lua new file mode 100644 index 0000000000..303596976f --- /dev/null +++ b/test/functional/legacy/listlbr_utf8_spec.lua @@ -0,0 +1,79 @@ +-- Test for linebreak and list option in utf-8 mode + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('linebreak', function() + setup(clear) + + it('is working', function() + source([[ + set wildchar=^E + 10new + vsp + vert resize 20 + put =\"\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP \" + norm! zt + set ts=4 sw=4 sts=4 linebreak sbr=+ wrap + fu! ScreenChar(width) + let c='' + for j in range(1,4) + for i in range(1,a:width) + let c.=nr2char(screenchar(j, i)) + endfor + let c.="\n" + endfor + return c + endfu + fu! DoRecordScreen() + wincmd l + $put =printf(\"\n%s\", g:test) + $put =g:line + wincmd p + endfu + let g:test ="Test 1: set linebreak + set list + fancy listchars" + exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6" + redraw! + let line=ScreenChar(winwidth(0)) + call DoRecordScreen() + let g:test ="Test 2: set nolinebreak list" + set list nolinebreak + redraw! + let line=ScreenChar(winwidth(0)) + call DoRecordScreen() + let g:test ="Test 3: set linebreak nolist" + $put =\"\t*mask = nil;\" + $ + norm! zt + set nolist linebreak + redraw! + let line=ScreenChar(winwidth(0)) + call DoRecordScreen() + ]]) + + -- Assert buffer contents. + expect([[ + + abcdef hijklmn pqrstuvwxyz 1060ABCDEFGHIJKLMNOP + + Test 1: set linebreak + set list + fancy listchars + ▕———abcdef + +hijklmn▕——— + +pqrstuvwxyz␣1060ABC + +DEFGHIJKLMNOPˑ¶ + + Test 2: set nolinebreak list + ▕———abcdef hijklmn▕— + +pqrstuvwxyz␣1060ABC + +DEFGHIJKLMNOPˑ¶ + ¶ + *mask = nil; + + Test 3: set linebreak nolist + *mask = nil; + ~ + ~ + ~ ]]) + end) +end) diff --git a/test/functional/legacy/qf_title_spec.lua b/test/functional/legacy/qf_title_spec.lua new file mode 100644 index 0000000000..aa005117be --- /dev/null +++ b/test/functional/legacy/qf_title_spec.lua @@ -0,0 +1,30 @@ +-- Tests for quickfix window's title + +local helpers = require('test.functional.helpers') +local feed, insert, source = helpers.feed, helpers.insert, helpers.source +local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect + +describe('qf_title', function() + setup(clear) + + it('is working', function() + insert([[ + Results of test_qf_title:]]) + + source([[ + set efm=%E%f:%l:%c:%m + cgetexpr ['file:1:1:message'] + let qflist=getqflist() + call setqflist(qflist, 'r') + copen + let g:quickfix_title=w:quickfix_title + wincmd p + $put =g:quickfix_title + ]]) + + -- Assert buffer contents. + expect([[ + Results of test_qf_title: + :setqflist()]]) + end) +end) |