File Manager Lite
Dir:
/home/codewavebd/public_html/vendor/psy/psysh/src/Readline/Interactive/Actions
Upload
[..]
AcceptSuggestionAction.php (1.12 KB)
Edit
Rename
Del
AcceptSuggestionWordAction.php (1.43 KB)
Edit
Rename
Del
ActionInterface.php (848 B)
Edit
Rename
Del
ClearScreenAction.php (975 B)
Edit
Rename
Del
DedentLeadingIndentationAction.php (1.99 KB)
Edit
Rename
Del
DeleteBackwardCharAction.php (818 B)
Edit
Rename
Del
DeleteBracketPairAction.php (1016 B)
Edit
Rename
Del
ExitIfEmptyAction.php (965 B)
Edit
Rename
Del
HistoryExpansionAction.php (9.65 KB)
Edit
Rename
Del
InsertIndentOnTabAction.php (1.23 KB)
Edit
Rename
Del
InsertLineBreakOnIncompleteStatementAction.php (1.53 KB)
Edit
Rename
Del
KillLineAction.php (801 B)
Edit
Rename
Del
KillWholeLineAction.php (816 B)
Edit
Rename
Del
KillWordAction.php (803 B)
Edit
Rename
Del
MoveToStartAction.php (1.33 KB)
Edit
Rename
Del
MoveWordLeftAction.php (880 B)
Edit
Rename
Del
MoveWordRightAction.php (875 B)
Edit
Rename
Del
PreviousHistoryAction.php (2.12 KB)
Edit
Rename
Del
RejectSyntaxErrorAction.php (2.23 KB)
Edit
Rename
Del
Edit: AcceptSuggestionWordAction.php
<?php /* * This file is part of Psy Shell. * * (c) 2012-2026 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Psy\Readline\Interactive\Actions; use Psy\Readline\Interactive\Input\Buffer; use Psy\Readline\Interactive\Input\WordNavigationPolicy; use Psy\Readline\Interactive\Readline; use Psy\Readline\Interactive\Terminal; /** * Accept one word from the current suggestion. */ class AcceptSuggestionWordAction implements ActionInterface { /** * {@inheritdoc} */ public function execute(Buffer $buffer, Terminal $terminal, Readline $readline): bool { $suggestion = $readline->getCurrentSuggestion(); if ($suggestion === null) { return false; } // Word-accept currently supports append-only suggestions. if (!$suggestion->isAppendOnly($buffer->getCursor())) { return false; } $text = $suggestion->getAcceptText(); $wordEnd = (new WordNavigationPolicy())->findNextWord($text, 0); $firstWord = \mb_substr($text, 0, $wordEnd); if ($firstWord === '') { return false; } $buffer->insert($firstWord); $readline->clearSuggestion(); return true; } /** * {@inheritdoc} */ public function getName(): string { return 'accept-suggestion-word'; } }
Simpan