Skip to content

Add drag and drop file support#13

Open
RatinCN wants to merge 1 commit into
PlummersSoftwareLLC:mainfrom
RatinCN:drag-drop-support
Open

Add drag and drop file support#13
RatinCN wants to merge 1 commit into
PlummersSoftwareLLC:mainfrom
RatinCN:drag-drop-support

Conversation

@RatinCN

@RatinCN RatinCN commented Jun 19, 2026

Copy link
Copy Markdown

Summary

  • Enable dropped files on the main window with WS_EX_ACCEPTFILES
  • Handle WM_DROPFILES by prompting to save dirty edits, querying the dropped path, and loading it
  • Call DragFinish on the shared drop exit path to release the HDROP

Notes

  • This keeps the change scoped to trpad.asm

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread trpad.asm
Comment on lines +2681 to +2684
call LoadStartupFile
xor eax, eax
mov fDirty, eax
call ApplyTitle

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@RatinCN RatinCN Jun 20, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant