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

Gave search result panel a min-height #5391

Merged
merged 5 commits into from
Oct 9, 2013
Merged

Conversation

tjoskar
Copy link
Contributor

@tjoskar tjoskar commented Oct 1, 2013

Gave "search-results" panel a min-height, just like the "replace-all-results" and "problems-panel" already has.

Issue: #5175

@ghost ghost assigned redmunds Oct 1, 2013
@@ -848,7 +848,7 @@ define(function (require, exports, module) {
// Initialize items dependent on HTML DOM
AppInit.htmlReady(function () {
var panelHtml = Mustache.render(searchPanelTemplate, Strings);
searchResultsPanel = PanelManager.createBottomPanel("find-in-files.results", $(panelHtml));
searchResultsPanel = PanelManager.createBottomPanel("find-in-files.results", $(panelHtml), 100);
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this fixes the problem. But, Resizer module used to set 100 as the default minimum size -- not sure when or why that changed.

It seems like a more complete solution would be to change Resizer.js line 166 from:

    minSize = minSize || 0;

to

    minSize = minSize || 100;

@peterflynn Since you commented on the bug, I'll ask you: can you think of any case that this would not be desirable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@redmunds I agree,

minSize = minSize || 100;

seems to be safer but I believe that

minSize = minSize || 0;

is a more general design. Furthermore, if the default value is 100 it is not posible to hide elements by dragging (e.g. the side panel) because:

0 || 100 => 100

So I think the default value should be 0.

(I'm new here and want to learn so I am open to any solution)

Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch! I think the default should be 100, but any panel should be able to override this with 0 (although dragging size to 0 is not a good way to hide panel as is shown in the bug), so this should be:

if (minSize === undefined) {
    minSize = 100;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, but isn't it better to use DEFAULT_MIN_SIZE instead of a hard coded integer? (see comment below: src/utils/Resizer.js:167)

Copy link
Contributor

Choose a reason for hiding this comment

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

Now that default panel height is 100, it's no longer necessary to pass 100 here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, but if we don't pass 100 as an argument here we shouldn't do that on the error panel (https://github.com/adobe/brackets/blob/master/src/language/CodeInspection.js#L387) nor the find-replace-panel (https://github.com/adobe/brackets/blob/master/src/search/FindReplace.js#L627) to keep consistency?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's ok to leave it in, it's just not "necessary". I don't think it's worth updating that other code.

minSize = minSize || 0;

if (minSize === undefined) {
minSize = DEFAULT_MIN_SIZE;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct me if i'm wrong but from what I understand, DEFAULT_MIN_SIZE is defined for this purpose i.e. to set a min-size on a panel.

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct. Good catch!

@redmunds
Copy link
Contributor

redmunds commented Oct 2, 2013

Looks good. Just a couple minor comments.

@@ -187,7 +187,7 @@ define(function (require, exports, module) {
*
* @param {!string} id Unique id for this panel. Use package-style naming, e.g. "myextension.feature.panelname"
* @param {!jQueryObject} $panel DOM content to use as the panel. Need not be in the document yet.
* @param {number=} minSize Minimum height of panel in px; default is 0
* @param {number=} minSize Minimum height of panel in px; default is DEFAULT_MIN_SIZE
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this really a good comment? I refer to a variable that exist in another class/file. But like you said: DEFAULT_MIN_SIZE is not part of the public API and should not be referred through "Resizer.DEFAULT_MIN_SIZE". However "Resizer.DEFAULT_MIN_SIZE" is accessible in this file so maybe it should be better to refer to "Resizer.DEFAULT_MIN_SIZE" is this case?

Sorry if I creating extra work for you but this (simple) bug will soon be dead :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that this file should not refer to DEFAULT_MIN_SIZE. The sentence "default is [whatever]" should either be removed or maybe changed to "default is set in Resizer.makeResizable()".

@tjoskar
Copy link
Contributor Author

tjoskar commented Oct 9, 2013

I understand if you haven't had time to look at this issue, but just to be clear, is the code good now? (just to clarify that you don't wait for me).

@redmunds
Copy link
Contributor

redmunds commented Oct 9, 2013

Sorry about the delay -- code looks good. We stopped merging code while we closed down Sprint 32, so I'll be merging this soon.

@redmunds
Copy link
Contributor

redmunds commented Oct 9, 2013

Looks good. Merging.

redmunds added a commit that referenced this pull request Oct 9, 2013
Gave search result panel a min-height
@redmunds redmunds merged commit fc26245 into adobe:master Oct 9, 2013
@tjoskar tjoskar deleted the issue-5175 branch October 9, 2013 19:09
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.

2 participants