Skip to content

feat(editor): add multi-buffer find-file#57

Merged
owainlewis merged 5 commits into
mainfrom
issue-30-buffers
Jul 12, 2026
Merged

feat(editor): add multi-buffer find-file#57
owainlewis merged 5 commits into
mainfrom
issue-30-buffers

Conversation

@owainlewis

Copy link
Copy Markdown
Owner

Summary

  • add an editor-level buffer list with per-buffer text, dirty state, and view state
  • make C-x C-f accept existing files, missing files, and directories
  • add C-x b switching by exact path or unique file name
  • protect dirty inactive buffers on quit and preserve directory picker browsing
  • document the workflow and implementation plan

Why

Cortex could create a missing path through the CLI or /open, but C-x C-f only exposed existing picker entries and replacing the current buffer could discard workflow context. This adds the Emacs-shaped find-file and buffer switching behavior requested in issue #30.

Acceptance proof

  • Multiple buffers retain independent unsaved text and view state: covered by editor and app tests.
  • Dirty state is per buffer; save writes only the active buffer: covered by editor tests.
  • Quit warns when an inactive buffer is dirty: covered by app tests.
  • C-x C-f accepts existing, missing, whitespace-bearing, and directory paths: covered by app and editor tests.
  • Missing files are created on save, while missing parent directories return an error: covered by buffer and editor tests.
  • C-x b switches by exact path or unique file name and reports ambiguity: covered by keymap, app, and editor tests.
  • Existing directory browsing and single-file behavior remain covered by the full test suite and terminal smoke test.

Test plan

  • cargo fmt --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test (155 passed)
  • git diff --check
  • terminal smoke: created and saved /tmp/cortex-issue-30-smoke-created.txt, switched back to README.md, exited with status 0, and verified terminal cleanup
  • terminal smoke: entered . through C-x C-f, confirmed the directory picker opened, canceled back to the buffer, and exited with status 0
  • fresh-agent review: initial findings fixed; second review returned no findings

Risks

Path identity now resolves the nearest existing ancestor so relative and absolute aliases for missing files share one buffer. The switch prompt currently requires an exact path or unique file name and has no completion.

Related issue

Closes #30

@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: b60c1ba225

ℹ️ 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 src/editor.rs
@owainlewis

Copy link
Copy Markdown
Owner Author

@codex review

@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: a186f6fe64

ℹ️ 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 src/editor.rs Outdated
@owainlewis

Copy link
Copy Markdown
Owner Author

@codex review

@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: 540dd69ff2

ℹ️ 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 src/editor.rs Outdated
@owainlewis

Copy link
Copy Markdown
Owner Author

@codex review

@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: c0788df933

ℹ️ 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 src/app.rs Outdated
@owainlewis

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 564f70c84a

ℹ️ 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".

@owainlewis
owainlewis merged commit 80c84b1 into main Jul 12, 2026
1 check passed
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.

[v0.3] Add multiple buffers, find-file, and switch-buffer

1 participant