Skip to content

✨ Modified file indicator #1437

Closed
Closed
@matthijseikelenboom

Description

@matthijseikelenboom

Description

As a user
I want to be able to see an indicator when I modify a file
Because I want to know if I still need to save my changes to disk.

Acceptance criteria

  • There is a visible indicator on the tab that is open that shows up when there are modifications that haven't been saved yet
  • These indicators show up on both the active tab and non active tabs
  • When trying to close a tab with this indicator, a popup should show up that gives the option to:
    • Save the changes
    • Discard the changes
    • Cancel the action and do nothing

Scope

In scope

  • Adding an indicator for tabs that have unsaved modifications
  • Adding a popup when trying to close a tab that has unsaved modifications

Out of scope

  • Anything else

Implementation design

A good place to start is probably in the CodeEdit/CodeEdit/Features/CodeFile/ folder. Specifically CodeFile.swift where the content of the file itself is loaded into. To check if a file has unsaved changes we can be solved in multiple ways. But the best way to do it, is probably to hash the content of a file from disk and to create a hash of the current content in memory and compare them. If they are equal, there are no changes and if they are not equal, there are changes and the indicator has to be shown on the tab.

We need two new Views: One for the indicator and one for the popup. These files can be put in the feature folder Editor/Tabs.

image

Tasks

  • Make a boolean variable that can be used to show the indicator when needed
  • Make a View that represents the indicator
    • (This should be a small circle, like the one in VSCode)
  • Add the indicator the tab View with correct conditional cases
  • Make a popup View with close options
  • Create PR & merge
  • Indicator in red close window control – ✨ Show an unsaved indicator when file has been edited but not saved #1173

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds refinementThis issue is not complete and has to be refined by the maintainers

    Type

    No type

    Projects

    Status

    🏁 Complete

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions