Add drag and drop file support#13
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 73267f96c6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| call LoadStartupFile | ||
| xor eax, eax | ||
| mov fDirty, eax | ||
| call ApplyTitle |
There was a problem hiding this comment.
Preserve state when a dropped path cannot load
When DragQueryFileA returns a path that LoadStartupFile cannot open/read (for example a dropped directory, an unreadable file, or a path truncated by MAX_CMD_PATH), LoadStartupFile simply returns without replacing the editor contents, but this new path still clears fDirty and applies the dropped name as the title. In that scenario the previous buffer remains visible but is now marked clean/renamed, so closing afterward can skip the save prompt for edits that were not actually replaced by the drop.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Thanks, this is a valid edge case, but I am going to keep the current behavior for this PR because it matches the existing File > Open path and avoids adding more code size. The existing open flow has the same tradeoff:
(1) CmdFileOpen calls LoadStartupFile and then unconditionally clears fDirty and applies the title
(2) LoadStartupFile does not currently report success or failure
(3) PickOpenFile writes directly into CmdFile, even clearing CmdFile before showing the dialog.
Drag/drop can reach a few more bad inputs, such as directories or truncated paths, but fixing that properly would require extra state preservation or a success return path. Since this project prioritizes final binary size over edge-case polish, I prefer to keep this behavior consistent with the existing open logic.
Summary
WS_EX_ACCEPTFILESWM_DROPFILESby prompting to save dirty edits, querying the dropped path, and loading itDragFinishon the shared drop exit path to release theHDROPNotes
trpad.asm