Skip to content

Commit

Permalink
ubiq_show_preview no longer takes index but command structure
Browse files Browse the repository at this point in the history
  • Loading branch information
rostok committed Jun 10, 2022
1 parent 783465a commit 2c4c526
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,10 @@ function ubiq_clear() {

var savePreviewCmdTimeoutID = 0;

// shows preview for command, cmd is command index
function ubiq_show_preview(cmd, args) {
if (cmd == null) return;
var cmd_struct = CmdUtils.CommandList[cmd];
if (!cmd_struct) return;
// shows preview for command, cmd is command struct
function ubiq_show_preview(cmd_struct) {
if (typeof cmd_struct == 'undefined' || !cmd_struct) return;
var preview_func = cmd_struct.preview;
ubiq_last_preview_command_index = cmd;
ubiq_last_preview_cmd = cmd_struct;
switch(typeof preview_func)
{
Expand Down Expand Up @@ -152,8 +149,8 @@ function ubiq_execute() {
return false;
}

function ubiq_dispatch_command(line, args) {
var words = ubiq_command().split(' ');
function ubiq_dispatch_command(line) {
var words = line.split(' ');
var command = words.shift();

var text = words.join(' ').trim();
Expand Down Expand Up @@ -195,8 +192,6 @@ function ubiq_dispatch_command(line, args) {
CmdUtils.backgroundWindow.error(e.stack);
}
}

return;
}

function ubiq_help() {
Expand Down Expand Up @@ -421,7 +416,8 @@ function ubiq_show_matching_commands(text) {
var selcmdidx = matches[ubiq_selected_command][0];
if (selcmdidx!=ubiq_last_preview_command_index) ubiq_clear();
ubiq_selected_option = -1;
ubiq_show_preview(selcmdidx);
ubiq_last_preview_command_index = selcmdidx;
ubiq_show_preview(CmdUtils.CommandList[selcmdidx]);

for (var c in matches) {
var is_selected = (c == ubiq_selected_command);
Expand Down

0 comments on commit 2c4c526

Please sign in to comment.