Selection and copy to clipboard not working in THexViewWnd
Borland's Object Windows Library for the modern age
Brought to you by:
jogybl,
sebas_ledesma
Claude Code analysis:
Why the selection drew wrong
DrawLinedrew each line's hex and ASCII text in its normal colours. The only selection painting was a one-character block after the ASCII column, carried over from the text editor's end-of-line marker. It now highlights selected bytes in both columns, and the space between two selected bytes is filled too so the block looks continuous. I removed the end-of-line block.Client2Textreturned position (0,0) for any point outside a data column. That included the address column, the gap between the hex and ASCII columns, and the area past the end of a line. Dragging across the gap jumped the selection back to the start of the file. The same bug moved the cursor to (0,0) after End or Ctrl+End, becauseScrollToCaretconverts the position to screen coordinates and back. Such points now map to the nearest position in the current column.Client2Text, so hit-testing was wrong after scrolling sideways.MouseDownPosmember.EvLButtonUpno longer recalculates the end of the selection, which was moving it on release.GetTxColorreturned the background colour instead of the text colour (in the header).Why copy didn't work
48 65 6C..for unprintable ones.GMEM_DDESHARE. The clipboard needs moveable memory. Copy andSetDragDatanow useTClipboard::AllocateData.TStreamSelection::Copyworked out the byte count wrongly for selections over more than one line. It subtracted the start position on every line, which could give a negative count passed toos.write. It now copies by byte offset.TLineSelection::Copywas changed the same way.os << ends) was appended to the copied data. I removed it.PRECONDITIONinCopySelectionso Ctrl+C with nothing selected doesn't assert, andSelectAllnow does nothing when the file is empty.Fix implemented by Claude Code in [r8933].
Related
Commit: [r8933]
Diff: