Skip to content

Commit

Permalink
Ignore underlong completions.
Browse files Browse the repository at this point in the history
  • Loading branch information
AmokHuginnsson committed Jun 6, 2020
1 parent 737c8e8 commit 4dae7e2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/replxx_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1670,12 +1670,12 @@ Replxx::ACTION_RESULT Replxx::ReplxxImpl::complete( bool previous_ ) {
newSelection = static_cast<int>( _completions.size() ) - 1;
}
if ( _completionSelection != -1 ) {
int oldCompletionLength( _completions[_completionSelection].text().length() - _completionContextLength );
int oldCompletionLength( max( _completions[_completionSelection].text().length() - _completionContextLength, 0 ) );
_pos -= oldCompletionLength;
_data.erase( _pos, oldCompletionLength );
}
if ( newSelection != -1 ) {
int newCompletionLength( _completions[newSelection].text().length() - _completionContextLength );
int newCompletionLength( max( _completions[newSelection].text().length() - _completionContextLength, 0 ) );
_data.insert( _pos, _completions[newSelection].text(), _completionContextLength, newCompletionLength );
_pos += newCompletionLength;
}
Expand Down Expand Up @@ -1948,7 +1948,7 @@ Replxx::ACTION_RESULT Replxx::ReplxxImpl::bracketed_paste( char32_t ) {
if ( c == KEY::PASTE_FINISH ) {
break;
}
if ( c == '\r' ) {
if ( ( c == '\r' ) || ( c == KEY::control( 'M' ) ) ) {
c = '\n';
}
buf.push_back( c );
Expand Down

0 comments on commit 4dae7e2

Please sign in to comment.