Skip to content

Commit aa36f99

Browse files
committed
Document CTRL_ constants
1 parent bdfb130 commit aa36f99

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

src/Key.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,43 @@ class Key
3636

3737
const END = "\e[4~";
3838

39+
/**
40+
* Cancel/SIGINT
41+
*/
3942
const CTRL_C = "\x03";
4043

44+
/**
45+
* Previous/Up
46+
*/
4147
const CTRL_P = "\x10";
4248

49+
/**
50+
* Next/Down
51+
*/
4352
const CTRL_N = "\x0E";
4453

54+
/**
55+
* Forward/Right
56+
*/
4557
const CTRL_F = "\x06";
4658

59+
/**
60+
* Back/Left
61+
*/
4762
const CTRL_B = "\x02";
4863

64+
/**
65+
* Backspace
66+
*/
4967
const CTRL_H = "\x08";
5068

69+
/**
70+
* Home
71+
*/
5172
const CTRL_A = "\x01";
5273

74+
/**
75+
* End
76+
*/
5377
const CTRL_E = "\x05";
5478
}

src/SearchPrompt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(
4848
Key::UP, Key::UP_ARROW, Key::SHIFT_TAB, Key::CTRL_P => $this->highlightPrevious(),
4949
Key::DOWN, Key::DOWN_ARROW, Key::TAB, Key::CTRL_N => $this->highlightNext(),
5050
Key::ENTER => $this->highlighted !== null ? $this->submit() : $this->search(),
51-
Key::LEFT, Key::LEFT_ARROW, Key::RIGHT, Key::RIGHT_ARROW, Key::CTRL_B, Key::CTRL_F, Key::HOME, KEY::END, Key::CTRL_A, Key::CTRL_E => $this->highlighted = null,
51+
Key::LEFT, Key::LEFT_ARROW, Key::RIGHT, Key::RIGHT_ARROW, Key::CTRL_B, Key::CTRL_F, Key::HOME, Key::END, Key::CTRL_A, Key::CTRL_E => $this->highlighted = null,
5252
default => $this->search(),
5353
});
5454
}

src/SuggestPrompt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function __construct(
5858
Key::UP, Key::UP_ARROW, Key::SHIFT_TAB, Key::CTRL_P => $this->highlightPrevious(),
5959
Key::DOWN, Key::DOWN_ARROW, Key::TAB, Key::CTRL_N => $this->highlightNext(),
6060
Key::ENTER => $this->selectHighlighted(),
61-
Key::LEFT, Key::LEFT_ARROW, Key::RIGHT, Key::RIGHT_ARROW, Key::CTRL_B, Key::CTRL_F, Key::HOME, KEY::END, Key::CTRL_A, Key::CTRL_E => $this->highlighted = null,
61+
Key::LEFT, Key::LEFT_ARROW, Key::RIGHT, Key::RIGHT_ARROW, Key::CTRL_B, Key::CTRL_F, Key::HOME, Key::END, Key::CTRL_A, Key::CTRL_E => $this->highlighted = null,
6262
default => (function () {
6363
$this->highlighted = null;
6464
$this->matches = null;

0 commit comments

Comments
 (0)