From ab1f4d5ba1783e0da73da22647fd62ce064fa793 Mon Sep 17 00:00:00 2001 From: nadrad Date: Fri, 23 Sep 2022 11:02:32 +0200 Subject: [PATCH] fixed ctrl+bs in the beginning of lines --- h-m-m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/h-m-m b/h-m-m index e826464..9c3a946 100755 --- a/h-m-m +++ b/h-m-m @@ -1148,8 +1148,7 @@ function magic_readline(&$mm, $title) // ctrl+backspace elseif ($in=="\010") { - $from = mb_strrpos($title, ' ', min(1,$cursor-mb_strlen($title)-3)); - if ($from === false) $from=1; + $from = max(0, mb_strrpos($title, ' ', max(0,min(1,$cursor-mb_strlen($title)-3)))); $title = mb_substr($title, 0, $from) . mb_substr($title,$cursor-1); $cursor = $from+1; }