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

Commit b37ccb2

Browse files
committed
Go to first/last page
1 parent 12e40ae commit b37ccb2

4 files changed

Lines changed: 72 additions & 12 deletions

File tree

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{{{summary}}}
22
{{#hasPages}}
3-
<span class="left-triangle {{^hasPrev}}disabled{{/hasPrev}}"></span>
3+
<span class="first-page {{^hasPrev}}disabled{{/hasPrev}}"></span>
4+
<span class="prev-page {{^hasPrev}}disabled{{/hasPrev}}"></span>
45
{{{results}}}
5-
<span class="right-triangle {{^hasNext}}disabled{{/hasNext}}"></span>
6+
<span class="next-page {{^hasNext}}disabled{{/hasNext}}"></span>
7+
<span class="last-page {{^hasNext}}disabled{{/hasNext}}"></span>
68
{{/hasPages}}

src/search/FindInFiles.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,15 +423,25 @@ define(function (require, exports, module) {
423423
.one("click.searchList", ".close", function () {
424424
_hideSearchResults();
425425
})
426+
// The link to go the first page
427+
.one("click.searchList", ".first-page:not(.disabled)", function () {
428+
currentStart = 0;
429+
_showSearchResults();
430+
})
426431
// The link to go the previous page
427-
.one("click.searchList", ".left-triangle:not(.disabled)", function () {
432+
.one("click.searchList", ".prev-page:not(.disabled)", function () {
428433
currentStart -= RESULTS_PER_PAGE;
429434
_showSearchResults();
430435
})
431436
// The link to go to the next page
432-
.one("click.searchList", ".right-triangle:not(.disabled)", function () {
437+
.one("click.searchList", ".next-page:not(.disabled)", function () {
433438
currentStart += RESULTS_PER_PAGE;
434439
_showSearchResults();
440+
})
441+
// The link to go to the last page
442+
.one("click.searchList", ".last-page:not(.disabled)", function () {
443+
currentStart = Math.floor(numMatches / RESULTS_PER_PAGE) * RESULTS_PER_PAGE;
444+
_showSearchResults();
435445
});
436446

437447
// Insert the search results

src/styles/brackets.less

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -724,14 +724,24 @@ a, img {
724724
/* Find in Files results panel - temporary UI, to be replaced with a richer search feature later */
725725

726726
#search-result-summary {
727-
.left-triangle, .right-triangle {
727+
.first-page,
728+
.prev-page,
729+
.next-page,
730+
.last-page {
728731
.jstree-sprite;
729-
width: 10px;
732+
width: 6px;
730733
display: inline-block;
731734
background-position: 0px 4px;
732735
}
733-
.left-triangle {
734-
-webkit-transform: translateZ(0) translateY(-3px) rotate(180deg);
736+
.first-page {
737+
background-position: 0px -80px;
738+
margin-left: 10px;
739+
}
740+
.prev-page {
741+
background-position: 0px -24px;
742+
}
743+
.last-page {
744+
background-position: 0px -52px;
735745
}
736746
.disabled {
737747
opacity: 0.3;
Lines changed: 42 additions & 4 deletions
Loading

0 commit comments

Comments
 (0)