From bdd4deff6d4d414169df275f357123189da73040 Mon Sep 17 00:00:00 2001 From: Maksim Kita Date: Wed, 26 Jul 2023 17:16:44 +0300 Subject: [PATCH] Multiline input history previous line crash fix --- src/replxx_impl.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/replxx_impl.cxx b/src/replxx_impl.cxx index 9633447..4cb561d 100644 --- a/src/replxx_impl.cxx +++ b/src/replxx_impl.cxx @@ -1883,7 +1883,7 @@ Replxx::ACTION_RESULT Replxx::ReplxxImpl::line_previous( char32_t ) { } int prevNewlinePosition( prev_newline_position( _pos ) ); if ( prevNewlinePosition == _pos ) { - prevNewlinePosition = prev_newline_position( _pos - 1 ); + prevNewlinePosition = _pos > 0 ? prev_newline_position( _pos - 1 ) : -1; } if ( prevNewlinePosition < 0 ) { break;