Mercurial > vim
comparison runtime/doc/eval.txt @ 11639:71d7b5ed08a0 v8.0.0702
patch 8.0.0702: an error in a timer can make Vim unusable
commit https://github.com/vim/vim/commit/c577d813b7978345dec4310b2d8f5d5624a681f6
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 8 22:37:34 2017 +0200
patch 8.0.0702: an error in a timer can make Vim unusable
Problem: An error in a timer can make Vim unusable.
Solution: Don't set the error flag or exception from a timer. Stop a timer
if it causes an error 3 out of 3 times. Discard an exception
caused inside a timer.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 08 Jul 2017 22:45:03 +0200 |
parents | 6f11697fb92c |
children | 49c12c93abf3 |
comparison
equal
deleted
inserted
replaced
11638:8bac0b53882b | 11639:71d7b5ed08a0 |
---|---|
1 *eval.txt* For Vim version 8.0. Last change: 2017 Jun 25 | 1 *eval.txt* For Vim version 8.0. Last change: 2017 Jul 08 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
4187 Return zero otherwise. | 4187 Return zero otherwise. |
4188 If [expr] is 1, only check if a character is available, it is | 4188 If [expr] is 1, only check if a character is available, it is |
4189 not consumed. Return zero if no character available. | 4189 not consumed. Return zero if no character available. |
4190 | 4190 |
4191 Without [expr] and when [expr] is 0 a whole character or | 4191 Without [expr] and when [expr] is 0 a whole character or |
4192 special key is returned. If it is an 8-bit character, the | 4192 special key is returned. If it is a single character, the |
4193 result is a number. Use nr2char() to convert it to a String. | 4193 result is a number. Use nr2char() to convert it to a String. |
4194 Otherwise a String is returned with the encoded character. | 4194 Otherwise a String is returned with the encoded character. |
4195 For a special key it's a sequence of bytes starting with 0x80 | 4195 For a special key it's a String with a sequence of bytes |
4196 (decimal: 128). This is the same value as the string | 4196 starting with 0x80 (decimal: 128). This is the same value as |
4197 "\<Key>", e.g., "\<Left>". The returned value is also a | 4197 the String "\<Key>", e.g., "\<Left>". The returned value is |
4198 String when a modifier (shift, control, alt) was used that is | 4198 also a String when a modifier (shift, control, alt) was used |
4199 not included in the character. | 4199 that is not included in the character. |
4200 | 4200 |
4201 When [expr] is 0 and Esc is typed, there will be a short delay | 4201 When [expr] is 0 and Esc is typed, there will be a short delay |
4202 while Vim waits to see if this is the start of an escape | 4202 while Vim waits to see if this is the start of an escape |
4203 sequence. | 4203 sequence. |
4204 | 4204 |
8015 | 8015 |
8016 {options} is a dictionary. Supported entries: | 8016 {options} is a dictionary. Supported entries: |
8017 "repeat" Number of times to repeat calling the | 8017 "repeat" Number of times to repeat calling the |
8018 callback. -1 means forever. When not present | 8018 callback. -1 means forever. When not present |
8019 the callback will be called once. | 8019 the callback will be called once. |
8020 If the timer causes an error three times in a | |
8021 row the repeat is cancelled. This avoids that | |
8022 Vim becomes unusable because of all the error | |
8023 messages. | |
8020 | 8024 |
8021 Example: > | 8025 Example: > |
8022 func MyHandler(timer) | 8026 func MyHandler(timer) |
8023 echo 'Handler called' | 8027 echo 'Handler called' |
8024 endfunc | 8028 endfunc |