Skip to content

Commit 171f618

Browse files
authored
Merge pull request #1244 from juhasch/feature/runtools
Fix clicking on gutter handling
2 parents 7ff9bbd + 9ecb9c0 commit 171f618

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

src/jupyter_contrib_nbextensions/nbextensions/runtools/main.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515

1616
#runtools-wrapper {
1717
position: absolute;
18-
width:430px;
18+
width:340px;
1919
top: 100px;
2020
right: 0px;
2121
float: right;
2222
opacity: 1;
2323
z-index: 100;
2424
font-size: 12px;
2525
font-weight: bold;
26+
background-color: lightgrey;
2627
}

src/jupyter_contrib_nbextensions/nbextensions/runtools/main.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,13 @@ define([
365365
* @param gutter not used
366366
*/
367367
function changeEvent(cm, line, gutter) {
368+
if (gutter === "CodeMirror-foldgutter") return; /* Don't collide with codefolding extension */
369+
368370
var cmline = cm.doc.children[0].lines[line];
369371
if (cmline === undefined) {
370372
return;
371373
}
372-
var cell = $(cm.element).closest('.cell').data('cell');
374+
var cell = $(cm.display.gutters).closest('.cell').data('cell');
373375
if (cell.metadata.run_control === undefined)
374376
cell.metadata.run_control = {};
375377
setCell(cell, !cell.metadata.run_control.marked);
@@ -435,32 +437,32 @@ define([
435437
var create_runtools_div = function() {
436438
var btn = '<div class="btn-toolbar">\
437439
<div class="btn-group">\
438-
<button type="button" id="run_c" class="btn btn-primary fa fa-step-forward" title="Run current cell"></button>\
439-
<button type="button" id="run_ca" class="btn btn-primary fa icon-run-to" title="' +
440+
<button type="button" id="run_c" class="btn-primary fa fa-step-forward" title="Run current cell"></button>\
441+
<button type="button" id="run_ca" class="btn-primary fa icon-run-to" title="' +
440442
'Run cells above (' + params["run_cells_above"] + ')"</button>\
441-
<button type="button" id="run_cb" class="btn btn-primary fa icon-run-from" title="' +
443+
<button type="button" id="run_cb" class="btn-primary fa icon-run-from" title="' +
442444
'Run cells below (' + params["run_cells_below"] + ')"</button>\
443-
<button type="button" id="run_a" class="btn btn-primary fa icon-run-all" title="' +
445+
<button type="button" id="run_a" class="btn-primary fa icon-run-all" title="' +
444446
'Run all cells (' + params["run_all_cells"] + ')"</button>\
445-
<button type="button" id="run_af" class="btn btn-primary fa icon-run-all-forced" title="' +
447+
<button type="button" id="run_af" class="btn-primary fa icon-run-all-forced" title="' +
446448
'Run all - ignore errors (' + params["run_all_cells_ignore_errors"] + ')"</button>\
447-
<button type="button" id="run_m" class="btn btn-primary fa icon-run-marked" title="' +
449+
<button type="button" id="run_m" class="btn-primary fa icon-run-marked" title="' +
448450
'Run marked codecells (' + params["run_marked_cells"] + ')"</button>\
449-
<button type="button" id="interrupt_b" class="btn btn-primary fa fa-stop" title="' +
451+
<button type="button" id="interrupt_b" class="btn-primary fa fa-stop" title="' +
450452
'Stop execution (' + params["stop_execution"] + ')"</button>\
451453
</div>\
452454
<div class="btn-group">\
453-
<button type="button" id="mark_toggle" class="btn btn-primary fa icon-mark-toggle" title="Mark single code cell"></button>\
454-
<button type="button" id="mark_all" class="btn btn-primary fa icon-mark-all" title="Mark all code cells"></button>\
455-
<button type="button" id="mark_none" class="btn btn-primary fa icon-mark-none" title="Unmark all code cells"></button>\
455+
<button type="button" id="mark_toggle" class="btn-primary fa icon-mark-toggle" title="Mark single code cell"></button>\
456+
<button type="button" id="mark_all" class="btn-primary fa icon-mark-all" title="Mark all code cells"></button>\
457+
<button type="button" id="mark_none" class="btn-primary fa icon-mark-none" title="Unmark all code cells"></button>\
456458
</div>\
457459
<div class="btn-group">\
458-
<button type="button" id="show_input" class="btn btn-primary fa icon-show-input" title="Show input of code cell"></button>\
459-
<button type="button" id="hide_input" class="btn btn-primary fa icon-hide-input" title="Hide input of code cell"></button>\
460-
<button type="button" id="show_output" class="btn btn-primary fa icon-show-output" title="Show output of code cell"></button>\
461-
<button type="button" id="hide_output" class="btn btn-primary fa icon-hide-output" title="Hide output of code cell"></button>\
462-
<button type="button" id="lock_marked" class="btn btn-primary fa fa-lock" title="Lock marked cells"></button>\
463-
<button type="button" id="unlock_marked" class="btn btn-primary fa fa-unlock" title="Unlock marked cells"></button>\
460+
<button type="button" id="show_input" class="btn-primary fa icon-show-input" title="Show input of code cell"></button>\
461+
<button type="button" id="hide_input" class="btn-primary fa icon-hide-input" title="Hide input of code cell"></button>\
462+
<button type="button" id="show_output" class="btn-primary fa icon-show-output" title="Show output of code cell"></button>\
463+
<button type="button" id="hide_output" class="btn-primary fa icon-hide-output" title="Hide output of code cell"></button>\
464+
<button type="button" id="lock_marked" class="btn-primary fa fa-lock" title="Lock marked cells"></button>\
465+
<button type="button" id="unlock_marked" class="btn-primary fa fa-unlock" title="Unlock marked cells"></button>\
464466
</div>\
465467
</div>';
466468

0 commit comments

Comments
 (0)