MCPcopy
hub / github.com/philc/vimium / constructor

Method constructor

content_scripts/mode_find.js:6–27  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

4// #1415. Only used by PostFindMode, below.
5class SuppressPrintable extends Mode {
6 constructor(options) {
7 super();
8 super.init(options);
9 const handler = (event) =>
10 KeyboardUtils.isPrintable(event) ? this.suppressEvent : this.continueBubbling;
11 const initialType = globalThis.getSelection().type;
12
13 // We use unshift here, so we see events after normal mode, so we only see unmapped keys.
14 this.unshift({
15 _name: `mode-${this.id}/suppress-printable`,
16 keydown: handler,
17 keypress: handler,
18 keyup: () => {
19 // If the selection type has changed (usually, no longer "Range"), then the user is
20 // interacting with the input element, so we get out of the way. See discussion of option 5c
21 // from #1415.
22 if (globalThis.getSelection().type !== initialType) {
23 return this.exit();
24 }
25 },
26 });
27 }
28}
29
30// When we use find, the selection/focus can land in a focusable/editable element. In this

Callers

nothing calls this directly

Calls 3

initMethod · 0.45
unshiftMethod · 0.45
exitMethod · 0.45

Tested by

no test coverage detected