|
1 | | -*eval.txt* For Vim version 8.1. Last change: 2019 Sep 15 |
| 1 | +*eval.txt* For Vim version 8.1. Last change: 2019 Sep 19 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -2595,7 +2595,7 @@ or({expr}, {expr}) Number bitwise OR |
2595 | 2595 | pathshorten({expr}) String shorten directory names in a path |
2596 | 2596 | perleval({expr}) any evaluate |Perl| expression |
2597 | 2597 | popup_atcursor({what}, {options}) Number create popup window near the cursor |
2598 | | -popup_beval({what}, {options}) Number create popup window for 'ballooneval' |
| 2598 | +popup_beval({what}, {options}) Number create popup window for 'ballooneval' |
2599 | 2599 | popup_clear() none close all popup windows |
2600 | 2600 | popup_close({id} [, {result}]) none close popup window {id} |
2601 | 2601 | popup_create({what}, {options}) Number create a popup window |
@@ -9048,31 +9048,36 @@ state([{what}]) *state()* |
9048 | 9048 | current state. Mostly useful in callbacks that want to do |
9049 | 9049 | work that may not always be safe. Roughly this works like: |
9050 | 9050 | - callback uses state() to check if work is safe to do. |
9051 | | - If yes, then do it right away. |
9052 | | - Otherwise add to work queue and add SafeState and/or |
9053 | | - SafeStateAgain autocommand. |
9054 | | - - When SafeState or SafeStateAgain is triggered, check with |
9055 | | - state() if the work can be done now, and if yes remove it |
9056 | | - from the queue and execute. |
| 9051 | + Yes: then do it right away. |
| 9052 | + No: add to work queue and add a |SafeState| and/or |
| 9053 | + |SafeStateAgain| autocommand (|SafeState| triggers at |
| 9054 | + toplevel, |SafeStateAgain| triggers after handling |
| 9055 | + messages and callbacks). |
| 9056 | + - When SafeState or SafeStateAgain is triggered and executes |
| 9057 | + your autocommand, check with `state()` if the work can be |
| 9058 | + done now, and if yes remove it from the queue and execute. |
| 9059 | + Remove the autocommand if the queue is now empty. |
9057 | 9060 | Also see |mode()|. |
9058 | 9061 |
|
9059 | 9062 | When {what} is given only characters in this string will be |
9060 | 9063 | added. E.g, this checks if the screen has scrolled: > |
9061 | | - if state('s') != '' |
| 9064 | + if state('s') == '' |
| 9065 | + " screen has not scrolled |
9062 | 9066 | < |
9063 | 9067 | These characters indicate the state, generally indicating that |
9064 | 9068 | something is busy: |
9065 | | - m halfway a mapping, :normal command, feedkeys() or |
9066 | | - stuffed command |
9067 | | - o operator pending or waiting for a command argument |
9068 | | - a Insert mode autocomplete active |
9069 | | - x executing an autocommand |
9070 | | - w blocked on waiting, e.g. ch_evalexpr() and |
9071 | | - ch_read(), ch_readraw() when reading json. |
9072 | | - S not triggering SafeState or SafeStateAgain |
9073 | | - c callback invoked, including timer (repeats for |
9074 | | - recursiveness up to "ccc") |
9075 | | - s screen has scrolled for messages |
| 9069 | + m halfway a mapping, :normal command, feedkeys() or |
| 9070 | + stuffed command |
| 9071 | + o operator pending or waiting for a command argument, |
| 9072 | + e.g. after |f| |
| 9073 | + a Insert mode autocomplete active |
| 9074 | + x executing an autocommand |
| 9075 | + w blocked on waiting, e.g. ch_evalexpr() and |
| 9076 | + ch_read(), ch_readraw() when reading json. |
| 9077 | + S not triggering SafeState or SafeStateAgain |
| 9078 | + c callback invoked, including timer (repeats for |
| 9079 | + recursiveness up to "ccc") |
| 9080 | + s screen has scrolled for messages |
9076 | 9081 |
|
9077 | 9082 | str2float({expr}) *str2float()* |
9078 | 9083 | Convert String {expr} to a Float. This mostly works the same |
|
0 commit comments