Skip to content

Cleanup: Simplify open document#1773

Open
jeremypw wants to merge 13 commits into
masterfrom
jeremypw/open-document/simplify
Open

Cleanup: Simplify open document#1773
jeremypw wants to merge 13 commits into
masterfrom
jeremypw/open-document/simplify

Conversation

@jeremypw

@jeremypw jeremypw commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator
  • Move creation of Document objects into DocumentView and change first parameter to string (path)
  • Only create new objects when needed
  • Update calls to this function appropriately
  • Lose unneeded intermediate functions in MainWindow and call the Document View function directly
  • Simplify the open_document function by DRYing and treating all documents the same regarding focus, cursor_position and range, whether newly created or existing .

The foldermanagerview member of window is temporarily made public but after #1778 this will not be necessary as that function will be moved to GitManager

@jeremypw
jeremypw marked this pull request as ready for review July 22, 2026 17:08
@danirabbit

Copy link
Copy Markdown
Member

@jeremypw can you resolve conflicts please

@jeremypw
jeremypw marked this pull request as draft July 22, 2026 17:49
@jeremypw

Copy link
Copy Markdown
Collaborator Author

Converting back to draft for testing after tricky merge

@jeremypw
jeremypw marked this pull request as ready for review July 22, 2026 18:13
@jeremypw
jeremypw requested a review from danirabbit July 22, 2026 18:18
// to confine Document creation to this class.
// Documents are treated the same regarding the focus, cursor_position and range parameters
// whether already open or not.
// Cursor position may have any value > -2 to set cursor. Lower values are ignored (default)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why did this change to -2?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Because -1 and 0 are valid values, sending the cursor to the start or end of the document. So I chose -2 or anything more negative to mean leave the cursor where it is.

Comment thread src/Widgets/SourceView.vala Outdated
@jeremypw
jeremypw requested a review from danirabbit July 23, 2026 10:21
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.

2 participants