Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New tabs after current focused tab#1704 #1715

Merged

Conversation

Shivam-Parekh
Copy link
Contributor

@Shivam-Parekh Shivam-Parekh commented May 13, 2024

Description

Fixed issue where new tabs opened at the end of all opened files instead of next to currently selected file.

Within the open tab function, found the currently selected tab and appended the file to be opened in the next index.

Related Issues

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

Screen Recording 2024-05-13 at 6 49 48 PM

changed tab append to tab insert at index after selected tab
Fixed issue where tab deleted tab next to it.
Copy link
Collaborator

@austincondiff austincondiff left a comment

Choose a reason for hiding this comment

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

Nice work!

@thecoolwinter thecoolwinter merged commit 5724c72 into CodeEditApp:main May 14, 2024
2 checks passed
@Shivam-Parekh
Copy link
Contributor Author

Hey guys. I found an issue in this PR. When you open up a side window with a file and attempt to close that side window, it throws an exception. It occurs because the guard portion returns without completing the rest of the function. (The history and openfile portion). I'm new to the repo(open source in general) so I don't know what the right steps to take are.
Screenshot 2024-05-15 at 6 08 07 PM

@Wouter01
Copy link
Member

Instead of using a guard, you could use an if let:

if let selectedTab, let currentIndex = tabs.firstIndex(of: selectedTab) {
    tabs.insert(item, at: tabs.index(after: currentIndex)
} else {
    tabs.append(item)
}

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.

None yet

4 participants