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

Commit 7be85a1

Browse files
committed
Merge pull request #1914 from adobe/pflynn/red-no-results
When Find has no results, turn search field bg color red
2 parents 68e27b2 + 1acded2 commit 7be85a1

3 files changed

Lines changed: 40 additions & 27 deletions

File tree

src/search/FindReplace.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ define(function (require, exports, module) {
9595
}
9696

9797
function findNext(cm, rev) {
98+
var found = true;
9899
cm.operation(function () {
99100
var state = getSearchState(cm);
100101
var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);
@@ -105,13 +106,15 @@ define(function (require, exports, module) {
105106
// No result found, period: clear selection & bail
106107
if (!cursor.find(rev)) {
107108
cm.setCursor(cm.getCursor()); // collapses selection, keeping cursor in place to avoid scrolling
109+
found = false;
108110
return;
109111
}
110112
}
111113
cm.setSelection(cursor.from(), cursor.to());
112114
state.posFrom = cursor.from();
113115
state.posTo = cursor.to();
114116
});
117+
return found;
115118
}
116119

117120
function clearSearch(cm) {
@@ -170,7 +173,9 @@ define(function (require, exports, module) {
170173
}
171174

172175
state.posFrom = state.posTo = searchStartPos;
173-
findNext(cm, rev);
176+
var foundAny = findNext(cm, rev);
177+
178+
getDialogTextField().toggleClass("no-results", !foundAny);
174179
});
175180
}
176181

src/styles/brackets.less

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -711,40 +711,47 @@ ins.jstree-icon {
711711
.code-font();
712712
}
713713

714-
/* Styles for the search dialog--this is temporary, only for debugging */
714+
715+
/* Find & Replace search bars - temporary UI, to be replaced with a richer search feature later */
715716

716717
.CodeMirror-dialog {
717-
position: relative;
718-
z-index: @z-index-cm-dialog-override;
718+
position: relative;
719+
z-index: @z-index-cm-dialog-override;
719720
}
720721

721722
.CodeMirror-dialog > div {
722-
font-family: @fontstack-sans-serif;
723-
position: absolute;
724-
top: 0; left: 0; right: 0;
725-
background: @background-color-2;
726-
color: @content-color;
727-
border-bottom: 1px solid @bc-gray;
728-
.box-shadow(0 1px 3px 0 fadeout(@bc-black, 70%));
729-
z-index: 1;
730-
padding: .5em .8em;
731-
overflow: hidden;
723+
font-family: @fontstack-sans-serif;
724+
position: absolute;
725+
top: 0; left: 0; right: 0;
726+
background: @background-color-2;
727+
color: @content-color;
728+
border-bottom: 1px solid @bc-gray;
729+
.box-shadow(0 1px 3px 0 fadeout(@bc-black, 70%));
730+
z-index: 1;
731+
padding: .5em .8em;
732+
overflow: hidden;
732733
}
733734

734735
.CodeMirror-dialog input {
735-
font-family: @fontstack-sans-serif;
736-
border: 1px solid @content-color-weaker;
737-
outline: none;
738-
background: @background-color-3;
739-
width: 20em;
740-
margin: .3em .3em;
741-
color: inherit;
736+
font-family: @fontstack-sans-serif;
737+
border: 1px solid @content-color-weaker;
738+
outline: none;
739+
background: @background-color-3;
740+
width: 20em;
741+
margin: .3em .3em;
742+
color: inherit;
743+
&.no-results {
744+
background-color: mix(@background-color-3, #FF0000, 70%);
745+
}
742746
}
743747

744748
.CodeMirror-searching {
745-
background-color: inherit;
749+
background-color: inherit;
746750
}
747751

752+
753+
/* Quick Open search bar & dropdown */
754+
748755
.smart_autocomplete_container {
749756

750757
border: 1px solid #999;
@@ -772,8 +779,4 @@ ins.jstree-icon {
772779

773780
li.smart_autocomplete_highlight {
774781
background-color: #e0f0fa;
775-
}
776-
777-
.clickable-link {
778-
cursor: pointer;
779-
}
782+
}

src/styles/brackets_patterns_override.less

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,11 @@
363363
font-weight: @font-weight-semibold;
364364
}
365365

366+
/* Any Dialog text in this style is automatically turned into a link that opens in the browser. Use data-href for the link's target. */
367+
.clickable-link {
368+
cursor: pointer;
369+
}
370+
366371
.btn {
367372
font-size: 16px;
368373
font-weight: @font-weight-semibold;

0 commit comments

Comments
 (0)