Review fixes: exception-safe AdoptOriginal; Qt draws cells straddling the left edge
AdoptOriginal cleared the table before allocating its piece list, so a bad_alloc left a live buffer with the file's size and no pieces; OpenFromFile no longer caught it either. The piece list is now built before anything is touched (the rest cannot throw) and OpenFromFile again reports "File too large to load" with the buffer unchanged. Qt skipped every character starting left of the horizontal scroll offset, so a tab or wide character straddling it left blank columns while selection and cursor still used the real ones. Such a character is now drawn at its own column and clipped by the viewport. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015rcVQiiWyTzoNrsvLSaAfB
This commit is contained in:
@@ -86,6 +86,7 @@ public:
|
||||
|
||||
// Replace the content with `bytes`, taken over without copying (a loaded
|
||||
// file). Undo spans into the old storage are invalidated, as by Clear().
|
||||
// If it throws (std::bad_alloc), the content is unchanged.
|
||||
void AdoptOriginal(std::string &&bytes);
|
||||
|
||||
// Accessors
|
||||
|
||||
Reference in New Issue
Block a user