brackets-archive / bracketsIssues

Archive of issues in brackets.
0 stars 0 forks source link

[CLOSED] Fix for issue #104 on the mac. #1915

Open core-ai-bot opened 3 years ago

core-ai-bot commented 3 years ago

Issue by jeffslofish Saturday Oct 27, 2012 at 07:28 GMT Originally opened as https://github.com/adobe/brackets/pull/1969


Close file icon is not displayed until mouse is moved.

Fix for issue #104 on the mac.


jeffslofish included the following code: https://github.com/adobe/brackets/pull/1969/commits

core-ai-bot commented 3 years ago

Comment by redmunds Sunday Oct 28, 2012 at 23:31 GMT


Jeffrey,

Thanks for taking this one. I'm the one that filed he original bug, so obviously it bugs me :)

I think hard-coding the second param works for you because you only tested closing the file with the x icon. Try this:

  1. Open 2 files in working set
  2. Make second file dirty
  3. Select first file
  4. Close first file using File > Close

Results: Remaining file should have dirty flag, but it has x icon.

It has the x icon because the third param is hard-coded to true. After fixing that, the dirty flag still is not set because the second param is hard-coded to false. Both need to be determined. Here's what I did, but give it some more testing to see if there are other cases:

var $nextListItem = $listItem.next();
if ($nextListItem && $nextListItem.length > 0) {
    var canClose = ($nextListItem.find(".can-close").length === 1);
    var isDirty = isOpenAndDirty($nextListItem.data(_FILE_KEY));
    _updateFileStatusIcon($nextListItem, isDirty, canClose);
}

Note that $listItem.next() always returns an Object -- you need to make sure length > 0;

Also, Brackets requires tabbing of 4 spaces and passing JSLint (which you can turn on using View > JSLint).

Thanks, Randy

core-ai-bot commented 3 years ago

Comment by jeffslofish Monday Oct 29, 2012 at 00:28 GMT


Randy, thanks for the feedback. I have done a little testing with your solution, and I think there is still a bug. Here are the steps:

  1. Open 2 files in working set
  2. Make second file dirty
  3. Click the X on the first file

Results: Even though the mouse will be hovering over the second file, it will not have an X, but rather the dirty file icon, until you move the mouse.

I assume that it should also show an X in this case too, right?

core-ai-bot commented 3 years ago

Comment by redmunds Monday Oct 29, 2012 at 15:10 GMT


Good catch! Need to determine canClose for the original file (not next file) since that's where next file will be after delete:

var canClose = ($listItem.find(".can-close").length === 1);

I thought of another case to also test:

  1. Open 2 files in working set
  2. Make second file dirty
  3. Select the first file
  4. Move mouse over file name (but not over X icon) so X appears for first file
  5. Press Cmd-W to close file
core-ai-bot commented 3 years ago

Comment by redmunds Friday Nov 02, 2012 at 02:14 GMT


Jeff,

Can you submit these changes so I can merge this into master?

Thanks, Randy

core-ai-bot commented 3 years ago

Comment by redmunds Friday Nov 02, 2012 at 22:28 GMT


Looks good. Merging.