浏览文件
caret-poll.mjs
16 行 · 661 B历史下载| 1 | // Focus and the caret nearly always move because of the viewer's own input. |
| 2 | // Read them quickly while the viewer acts, and rarely once they stop: every |
| 3 | // reading is a round trip into the guest, and on Linux also a probe key. |
| 4 | export const caretPollFast = 250; |
| 5 | export const caretPollSlow = 2000; |
| 6 | |
| 7 | export function caretPollDelay(quiet) { |
| 8 | if (quiet < 3000) return caretPollFast; |
| 9 | if (quiet < 8000) return 500; |
| 10 | if (quiet < 20000) return 1000; |
| 11 | return caretPollSlow; |
| 12 | } |
| 13 | |
| 14 | // A composition may begin from the reading of the last slow interval. The |
| 15 | // guest still rejects a context that changed in the meantime. |
| 16 | export const caretFreshFor = caretPollSlow + 500; |

