From b655e0e92822b1e8e7cf10cefe95f8ca0e76886b Mon Sep 17 00:00:00 2001 From: nadrad Date: Sun, 25 Sep 2022 09:14:33 +0200 Subject: [PATCH] fixed ctrl+delete in the editor --- h-m-m | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/h-m-m b/h-m-m index e747316..245ec42 100755 --- a/h-m-m +++ b/h-m-m @@ -1166,7 +1166,8 @@ function magic_readline(&$mm, $title) ; $title = mb_substr($title, 0, $from + ($from>0) ) - .mb_substr($title, $cursor-1); + .mb_substr($title, $cursor-1) + ; $cursor = $from+1+($from>0); } @@ -1194,8 +1195,25 @@ function magic_readline(&$mm, $title) // ctrl+delete elseif ($in=="\033\133\63\073\065\176") { - $title = ''; - $cursor = 1; + $len = mb_strlen($title); + $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