Skip to content

Commit

Permalink
Merge branch 'aggraef/purr-data-help-browser-fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Wilkes committed Sep 19, 2020
2 parents 44f5db0 + 558ca83 commit edb8082
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pd/nw/dialog_search.html
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@
current_dir = path.join(pdgui.get_lib_dir(), "doc");
toc_bookmark_update(current_dir);
toc_bookmark_status(false);
div = document.createElement("div");
toc.forEach(function(doc, i, a) {
div = document.createElement("div");
if (doc.id) {
try {
fs.accessSync(check_dir(doc.id), fs.F_OK);
Expand Down Expand Up @@ -500,7 +500,7 @@
} else {
window.findAndReplaceDOMText(console_text, {
//preset: "prose",
find: elem.value.toLowerCase(),
find: elem.value,
wrap: wrap_tag
});
// The searchAndReplace API is so bad you can't even know how
Expand Down Expand Up @@ -700,6 +700,15 @@
do_bookmark(dir, toc_is_bookmarked(id));
}

function is_special_key(key)
{
// determine all special keys which should be handled on the spot and
// *not* be forwarded to the search text field
return key === 9 // tab key
|| (key >= 16 && key <= 18) // modifier (shift, ctrl, alt)
|| (key >= 33 && key <= 40); // cursor keys
}

function add_events() {
// closing the Window
nw.Window.get().on("close", function() {
Expand Down Expand Up @@ -755,6 +764,7 @@
} else if ((evt.target === button_elem ||
evt.target === button_elem2) &&
evt.keyCode === 10 || evt.keyCode === 13) {
} else if (is_special_key(evt.keyCode)) {
} else if (evt.target !== input_elem) {
input_elem.focus();
} else if (bookmark_shortcut(evt)) {
Expand Down Expand Up @@ -887,7 +897,7 @@
src="bookmark.svg"
id="bookmark_indicator"
data-i18n="[title]search.bookmark">
</form>
</form>
<div id="results">
</div>
<div id = "console_find" style="display:none;">
Expand Down

0 comments on commit edb8082

Please sign in to comment.