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

Fix #9363: Code hints popup dismisses prematurely #9548

Merged
merged 3 commits into from
Oct 20, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/htmlContent/search-results.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<tr class="file-section" data-file-index="{{fileIndex}}">
{{#replace}}<td class="checkbox-column"><input type="checkbox" class="check-one-file" {{#isChecked}}checked="true"{{/isChecked}} /></td>{{/replace}}
<td colspan="2">
<span class="disclosure-triangle expanded" title="{{Strings.FIND_IN_FILES_EXPAND_COLLAPSE}}"></span>
<span class="disclosure-triangle {{#isCollapsed}}collapsed{{/isCollapsed}}{{^isCollapsed}}expanded{{/isCollapsed}}" title="{{Strings.FIND_IN_FILES_EXPAND_COLLAPSE}}"></span>
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't seem necessary to have mutually exclusive expanded and collapsed classes since you can check for the presence versus absence of a single class.

I can only find a single place the collapsed class is used in brackets.less:

.search-results .disclosure-triangle,
#problems-panel .disclosure-triangle {
    .jstree-sprite;
    display: inline-block;
    &.expanded {
        // Unfortunately, the way jsTree sprites are aligned within their 18px boxes doesn't look good in
        // other contexts, so we need some tweaks here instead of straight multiples of @jstree-sprite-size
        background-position: 7px 5px;
        -webkit-transform: translateZ(0) rotate(90deg);
    }
    &.collapsed {
        background-position: 7px 5px;
    }
}

background-position is the same for both cases, so this should be simplified to removes the reference to the collapsed class:

.search-results .disclosure-triangle,
#problems-panel .disclosure-triangle {
    .jstree-sprite;
    display: inline-block;
    background-position: 7px 5px;
    &.expanded {
        // Unfortunately, the way jsTree sprites are aligned within their 18px boxes doesn't look good in
        // other contexts, so we need some tweaks here instead of straight multiples of @jstree-sprite-size
        -webkit-transform: translateZ(0) rotate(90deg);
    }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could and we can remove the toggle classes for the expanded class.

{{{filename}}}
</td>
</tr>
{{#items}}
<tr data-file-index="{{fileIndex}}" data-item-index="{{itemIndex}}" data-match-index="{{matchIndex}}">
<tr data-file-index="{{fileIndex}}" data-item-index="{{itemIndex}}" data-match-index="{{matchIndex}}" {{#isCollapsed}}style="display:none;"{{/isCollapsed}}>
{{#replace}}<td class="checkbox-column"><input type="checkbox" class="check-one" {{#isChecked}}checked="true"{{/isChecked}} /></td>{{/replace}}
<td class="line-number">{{line}}</td>
<td class="line-text">{{pre}}<span class="highlight">{{highlight}}</span>{{post}}</td>
Expand Down
45 changes: 19 additions & 26 deletions src/search/SearchResultsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ define(function (require, exports, module) {
self = this;

this._showSummary();
this._searchList = [];
this._searchList = [];

// Iterates throuh the files to display the results sorted by filenamess. The loop ends as soon as
// we filled the results for one page
Expand Down Expand Up @@ -427,16 +427,17 @@ define(function (require, exports, module) {
multiLine = match.start.line !== match.end.line;

searchItems.push({
fileIndex: self._searchList.length,
itemIndex: searchItems.length,
matchIndex: i,
line: match.start.line + 1,
pre: match.line.substr(0, match.start.ch),
highlight: match.line.substring(match.start.ch, multiLine ? undefined : match.end.ch),
post: multiLine ? "\u2026" : match.line.substr(match.end.ch),
start: match.start,
end: match.end,
isChecked: match.isChecked
fileIndex: self._searchList.length,
itemIndex: searchItems.length,
matchIndex: i,
line: match.start.line + 1,
pre: match.line.substr(0, match.start.ch),
highlight: match.line.substring(match.start.ch, multiLine ? undefined : match.end.ch),
post: multiLine ? "\u2026" : match.line.substr(match.end.ch),
start: match.start,
end: match.end,
isChecked: match.isChecked,
isCollapsed: item.collapsed
});
if (!match.isChecked) {
allInFileChecked = false;
Expand All @@ -456,11 +457,12 @@ define(function (require, exports, module) {
);

self._searchList.push({
fileIndex: self._searchList.length,
filename: displayFileName,
fullPath: fullPath,
isChecked: allInFileChecked,
items: searchItems
fileIndex: self._searchList.length,
filename: displayFileName,
fullPath: fullPath,
isChecked: allInFileChecked,
items: searchItems,
isCollapsed: item.collapsed
});
}
});
Expand All @@ -473,16 +475,7 @@ define(function (require, exports, module) {
replace: this._model.isReplace,
searchList: this._searchList,
Strings: Strings
}))
// Restore the collapsed files
.find(".file-section").each(function () {
var fullPath = self._searchList[$(this).data("file-index")].fullPath;

if (self._model.results[fullPath].collapsed) {
self._model.results[fullPath].collapsed = false;
$(this).trigger("click");
}
});
}));

if (this._$selectedRow) {
this._$selectedRow.removeClass("selected");
Expand Down