The code for handling the case insensitive searches was created with the assumption that converting the string to the lowercase cannot alter its byte size. This is not true.
It could strip the grep output if specific pattern that has lower byte size when converted to lowercase is used for the case insensitive search.
The grep code was modified to correctly handle such cases when the byte size gets altered during the conversion to lowercase.
The case insensitive searches work correctly and doesn't truncate the grep output.