Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/qhexedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -995,11 +995,16 @@ void QHexEdit::paintEvent(QPaintEvent *event)
if (_editAreaIsAscii)
{
// every 2 hex there is 1 ascii
int ch = (uchar)_dataShown.at(hexPos / 2);
if (ch < ' ' || ch > '~')
ch = _defaultChar;
int asciiPos = hexPos / 2;
// The cursor can go out of the currently displayed data
if (asciiPos < _dataShown.size())
{
int ch = (uchar)_dataShown.at(asciiPos);
if (ch < ' ' || ch > '~')
ch = '.';

painter.drawText(_pxCursorX - pxOfsX, _pxCursorY, QChar(ch));
painter.drawText(_pxCursorX - pxOfsX, _pxCursorY, QChar(ch));
}
}
else
{
Expand Down