aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/background/actions/operation.js4
-rw-r--r--src/console/actions/console.js8
-rw-r--r--src/console/actions/index.js1
-rw-r--r--src/console/components/console.js6
-rw-r--r--src/console/index.js2
-rw-r--r--src/console/reducers/index.js13
-rw-r--r--src/shared/default-settings.js3
-rw-r--r--src/shared/messages.js1
-rw-r--r--src/shared/operations.js5
9 files changed, 36 insertions, 7 deletions
diff --git a/src/background/actions/operation.js b/src/background/actions/operation.js
index 9876940..1e4990c 100644
--- a/src/background/actions/operation.js
+++ b/src/background/actions/operation.js
@@ -65,6 +65,10 @@ const exec = (operation, tab) => {
return sendConsoleShowCommand(tab, 'winopen ');
case operations.COMMAND_SHOW_BUFFER:
return sendConsoleShowCommand(tab, 'buffer ');
+ case operations.FIND_START:
+ return browser.tabs.sendMessage(tab.id, {
+ type: messages.CONSOLE_SHOW_FIND
+ });
default:
return Promise.resolve();
}
diff --git a/src/console/actions/console.js b/src/console/actions/console.js
index 0d891bb..dd12e24 100644
--- a/src/console/actions/console.js
+++ b/src/console/actions/console.js
@@ -7,6 +7,12 @@ const showCommand = (text) => {
};
};
+const showFind = () => {
+ return {
+ type: actions.CONSOLE_SHOW_FIND,
+ };
+};
+
const showError = (text) => {
return {
type: actions.CONSOLE_SHOW_ERROR,
@@ -47,6 +53,6 @@ const completionPrev = () => {
};
export {
- showCommand, showError, showInfo, hideCommand,
+ showCommand, showFind, showError, showInfo, hideCommand,
setCompletions, completionNext, completionPrev
};
diff --git a/src/console/actions/index.js b/src/console/actions/index.js
index c4f88cd..15903be 100644
--- a/src/console/actions/index.js
+++ b/src/console/actions/index.js
@@ -7,4 +7,5 @@ export default {
CONSOLE_SET_COMPLETIONS: 'console.set.completions',
CONSOLE_COMPLETION_NEXT: 'console.completion.next',
CONSOLE_COMPLETION_PREV: 'console.completion.prev',
+ CONSOLE_SHOW_FIND: 'console.show.find',
};
diff --git a/src/console/components/console.js b/src/console/components/console.js
index 7997f24..d09e252 100644
--- a/src/console/components/console.js
+++ b/src/console/components/console.js
@@ -68,8 +68,10 @@ export default class ConsoleComponent {
update() {
let state = this.store.getState();
if (this.prevState.mode !== 'command' && state.mode === 'command') {
- this.showCommand(state.commandText);
- } else if (state.mode !== 'command') {
+ this.showCommand(state.consoleText);
+ } else if (this.prevState.mode !== 'find' && state.mode === 'find') {
+ this.showFind();
+ } else if (state.mode !== 'command' && state.mode !== 'find') {
this.hideCommand();
}
diff --git a/src/console/index.js b/src/console/index.js
index 36473fe..f886520 100644
--- a/src/console/index.js
+++ b/src/console/index.js
@@ -18,6 +18,8 @@ const onMessage = (message) => {
switch (message.type) {
case messages.CONSOLE_SHOW_COMMAND:
return store.dispatch(consoleActions.showCommand(message.command));
+ case messages.CONSOLE_SHOW_FIND:
+ return store.dispatch(consoleActions.showFind());
case messages.CONSOLE_SHOW_ERROR:
return store.dispatch(consoleActions.showError(message.text));
case messages.CONSOLE_SHOW_INFO:
diff --git a/src/console/reducers/index.js b/src/console/reducers/index.js
index d4affa7..d94662b 100644
--- a/src/console/reducers/index.js
+++ b/src/console/reducers/index.js
@@ -3,7 +3,7 @@ import actions from 'console/actions';
const defaultState = {
mode: '',
messageText: '',
- commandText: '',
+ consoleText: '',
completions: [],
groupSelection: -1,
itemSelection: -1,
@@ -48,8 +48,13 @@ export default function reducer(state = defaultState, action = {}) {
case actions.CONSOLE_SHOW_COMMAND:
return Object.assign({}, state, {
mode: 'command',
- commandText: action.text,
- errorShown: false,
+ consoleText: action.text,
+ completions: []
+ });
+ case actions.CONSOLE_SHOW_FIND:
+ return Object.assign({}, state, {
+ mode: 'find',
+ consoleText: '',
completions: []
});
case actions.CONSOLE_SHOW_ERROR:
@@ -64,7 +69,7 @@ export default function reducer(state = defaultState, action = {}) {
});
case actions.CONSOLE_HIDE_COMMAND:
return Object.assign({}, state, {
- mode: state.mode === 'command' ? '' : state.mode,
+ mode: state.mode === 'command' || state.mode === 'find' ? '' : state.mode,
});
case actions.CONSOLE_SET_COMPLETIONS:
return Object.assign({}, state, {
diff --git a/src/shared/default-settings.js b/src/shared/default-settings.js
index 14f48be..608890b 100644
--- a/src/shared/default-settings.js
+++ b/src/shared/default-settings.js
@@ -46,6 +46,9 @@ export default {
"gu": { "type": "navigate.parent" },
"gU": { "type": "navigate.root" },
"y": { "type": "urls.yank" },
+ "/": { "type": "find.start" },
+ "n": { "type": "find.next" },
+ "N": { "type": "find.prev" },
"<S-Esc>": { "type": "addon.toggle.enabled" }
},
"search": {
diff --git a/src/shared/messages.js b/src/shared/messages.js
index dc497b6..f859e93 100644
--- a/src/shared/messages.js
+++ b/src/shared/messages.js
@@ -31,6 +31,7 @@ export default {
CONSOLE_SHOW_ERROR: 'console.show.error',
CONSOLE_SHOW_INFO: 'console.show.info',
CONSOLE_HIDE_COMMAND: 'console.hide.command',
+ CONSOLE_SHOW_FIND: 'console.show.find',
FOLLOW_START: 'follow.start',
FOLLOW_REQUEST_COUNT_TARGETS: 'follow.request.count.targets',
diff --git a/src/shared/operations.js b/src/shared/operations.js
index f63f7ca..4c221ba 100644
--- a/src/shared/operations.js
+++ b/src/shared/operations.js
@@ -51,4 +51,9 @@ export default {
// Url yank
URLS_YANK: 'urls.yank',
+
+ // Find
+ FIND_START: 'find.start',
+ FIND_NEXT: 'find.next',
+ FIND_PREV: 'find.prev',
};