fixed ctrl+delete in the editor

This commit is contained in:
nadrad 2022-09-25 09:14:33 +02:00
parent 8116d7ad4b
commit b655e0e928

24
h-m-m
View file

@ -1166,7 +1166,8 @@ function magic_readline(&$mm, $title)
; ;
$title = $title =
mb_substr($title, 0, $from + ($from>0) ) mb_substr($title, 0, $from + ($from>0) )
.mb_substr($title, $cursor-1); .mb_substr($title, $cursor-1)
;
$cursor = $from+1+($from>0); $cursor = $from+1+($from>0);
} }
@ -1194,8 +1195,25 @@ function magic_readline(&$mm, $title)
// ctrl+delete // ctrl+delete
elseif ($in=="\033\133\63\073\065\176") elseif ($in=="\033\133\63\073\065\176")
{ {
$title = ''; $len = mb_strlen($title);
$cursor = 1; $from =
mb_strpos
(
$title
,' '
,min
(
$cursor+1
,$len
)
)
;
if ($from===false)
$from=$len;
$title =
mb_substr($title, 0, $cursor-1)
.mb_substr($title, $from+1 )
;
} }
// delete // delete