Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Conversation

@peterflynn
Copy link
Member

We should land PR #10850 first, and then the diff for this will be simplified. (done)

For now, this link previews what the diff will be after 10850 lands: thehogfather/brackets@issue10846...adobe:pflynn/codefolding-tweaks

Improve visual appearance of code folding:

  • Fainter, smaller gutter triangle icons
  • Gutter triangle icons become less faint on mouseover (or when collapsed)
  • Vertically align gutter triangle icons with text better
  • Change inline collapsed placeholder to more readable arrow icon
  • Better colors in dark theme
  • Less horizontal gap between line numbers and triangle icons (without reducing gap between line numbers and text, if folding gutter disabled)

Usability: rename "fadeFoldButtons" pref to clearer "hideUntilMouseover"

And tweak code style issues:

  • Remove most of ignored, unneeded package.json
  • Preserve original CodeMirror copyright on CM-derived files
  • Rename a few things for clarity
  • Remove some unneeded code
  • Tweak formatting & spelling in comments

Update - adds a few more fixes/cleanups:

More rigorous enable/disable flow for code folding: instead of piecemeal checking whether each bit has already initialized, atomically track whether init is done yet or not. Init/deinit all extant editors at once instead of doing each editor as it is activated, since splitview means editors may be already visible but not yet active. Fix listener leaks from repeated inits.

And keep menu items in a more predictable order:

  • Add menu items at startup before user extensions load (at htmlReady instead of appReady), so core menu items like these don't move around as user extension load order changes
  • Place QuickView menu item more explicitly, so it doesn't move unpredictably relative to Code Folding menu items (within the extensions/default folder, load order is arbitrary)
  • Properly clean up menu divider, which used to get duplicated on each init pass

Copy link
Member Author

Choose a reason for hiding this comment

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

editor._codeMirror can never be null for any Editor, so I removed this check (the editor arg itself could be null -- e.g. in rare case where the "documentRefreshed" listener fires on a Document with no _masterEditor -- so I left that check above in place.

Copy link
Contributor

Choose a reason for hiding this comment

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

good to know :)

@peterflynn
Copy link
Member Author

A few other things we should probably do before this story closes down:

  • Update wiki docs on writing themes (themes now need to consider changing the gutter triangle & inline placeholder colors)
  • Add folding-related preferences to table in "How to Use Brackets" wiki (once the churn has settled)
  • Add notes to extension-writing wiki docs about how to add folding support for new languages

I'm happy to help with those three.

Lastly, @abose are you already tracking a task for creating unit tests to go with this feature? If not, should we create a bug or Trello card to track that work?

@thehogfather
Copy link
Contributor

@peterflynn Happy with these changes. I'll update PR #10850 later this evening and you can merge this.

@thehogfather
Copy link
Contributor

@peterflynn just to let you know I updated PR #10850. Merge your changes whenever you're ready.

@marcelgerber
Copy link
Contributor

@peterflynn You got point 2 wrong for dark themes. Collapsed ones are brighter (= more outstanding) than expanded ones.

@peterflynn
Copy link
Member Author

@marcelgerber That's by design -- collapsed should be more prominent. So in the default light theme collapsed = darker, while in the dark theme collapsed = lighter. Third-party themes can override these styles though. I'll reword the bullet at top for clarity.

@marcelgerber
Copy link
Contributor

Oh sorry, I got those wrong. What I meant was:
Expanded ones are brighter (= more outstanding) than collapsed ones.

@peterflynn
Copy link
Member Author

@marcelgerber Hmm, that doesn't repro for me:

screen shot 2015-04-09 at 5 31 49 pm

Do you have a third-party theme installed that might be interfering with the styles, or anything?

@peterflynn
Copy link
Member Author

@thehogfather Fyi, I pushed a few more updates to this PR -- see updated description at top for details and a link to the correct diff view. It should now enable/disable dynamically much more cleanly, keeping the menus in proper order better and working better with splitview (and hopefully with slightly simpler code).

I've rebased on top of your PR now, so until that's merged, this PR here will show the diff from both combined.

@peterflynn peterflynn added this to the Release 1.3 milestone Apr 10, 2015
@abose
Copy link
Contributor

abose commented Apr 10, 2015

image
The icon is not rendered in my machine.

@marcelgerber
Copy link
Contributor

@peterflynn Yeah you're right, it's an issue with my third-party theme (https://github.com/Brackets-Themes/Lion).
I'll file an issue over there as soon as this PR lands in master.

- Fainter, smaller gutter triangle icons
- Gutter triangle icons get less faint on mouseover (or when collapsed)
- Vertically align gutter triangle icons with text better
- Change inline collapsed placeholder to more readable arrow icon
- Better colors in dark theme
- Less horizontal gap between line numbers and triangle icons (without
  reducing gap between line numbers and text, if folding gutter disabled)

Usability: rename "fadeFoldButtons" pref to clearer "hideUntilMouseover"

And tweak code style issues:
- Remove most of ignored, unneeded package.json
- Preserve original CodeMirror copyright on CM-derived files
- Rename a few things for clarity
- Remove some unneeded code
- Tweak formatting & spelling in comments
checking whether each bit has already initialized, atomically track whether
init is done yet or not. Init/deinit all extant editors at once instead of
doing each editor as it is activated, since splitview means editors may be
already visible but not yet active. Fix listener leaks from repeated inits.

And keep menu items in a more predictable order:
- Add menu items at startup before user extensions load (at htmlReady instead
of appReady), so core menu items like these don't move around as user extension
load order changes
- Place QuickView menu item more explicitly, so it doesn't move unpredictably
relative to Code Folding menu items (within the extensions/default folder,
load order is arbitrary)
- Properly clean up menu divider, which used to get duplicated on each init
pass
Remove unused `#code-folding-settings-dialog` CSS rule
Fix some comment whitespace
@peterflynn peterflynn force-pushed the pflynn/codefolding-tweaks branch from 82afac3 to 43a3ed1 Compare April 10, 2015 22:49
@peterflynn
Copy link
Member Author

@abose What OS are you on? Does it show the other arrow icon (that the code on master uses) properly?

@abose
Copy link
Contributor

abose commented Apr 12, 2015

Windows 8.1. yes, it shows the arrow icon as in master properly.

@abose
Copy link
Contributor

abose commented Apr 12, 2015

@peterflynn I was only fixing the unit test failures caused by the code folding extension in master.

I think it's best to add an issue to add unit test cases here as this is one of the core features now.

@abose
Copy link
Contributor

abose commented Apr 13, 2015

Now that PR #10850 has been merged, can this be merged?

@abose abose mentioned this pull request Apr 13, 2015
@marcelgerber
Copy link
Contributor

@abose Fixing the "code folding state doesn't get saved" issue (#10850 (comment)) is probably also something @peterflynn wants to fix in this PR (it's easy, even).

@abose
Copy link
Contributor

abose commented Apr 13, 2015

@peterflynn pull #10885 has the fix for the issue (#10850 (comment)), being a simple it can be done as part of this PR itself - or merge that pr after merging this .

@peterflynn
Copy link
Member Author

Let me just fix the Unicode issue @abose pointed out -- then I think this is good to merge.

@peterflynn
Copy link
Member Author

Ok, I spent a while playing with this and decided to switch from arrows to a simple "...":

screen shot 2015-04-13 at 7 16 24 pm

I actually like this a bit better than the wide arrows this PR had previously:

screen shot 2015-04-13 at 7 17 02 pm

And it's definitely way more legible than the original narrow arrows:

screen shot 2015-04-13 at 7 18 17 pm

Windows may not have glyphs for it and simpler Unicode arrows don't look good.
Use simple "..." text instead (vertically aligned so it's more like an icon
than text).
abose added a commit that referenced this pull request Apr 14, 2015
@abose abose merged commit 09795bf into master Apr 14, 2015
@abose
Copy link
Contributor

abose commented Apr 14, 2015

Thanks @peterflynn for the quick fix.
+1 for 3 dots .
Merging.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants