Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/t9md-toggle-bubbles' into t9md-t…
Browse files Browse the repository at this point in the history
…oggle-bubbles
  • Loading branch information
t9md committed Jun 20, 2017
2 parents 9f254e2 + 3d13cef commit 9ac0a2e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,31 @@ const Hydrogen = {
}
},

toggleBubble() {
const { editor } = store;
if (!editor) return;
const [startRow, endRow] = editor.getLastSelection().getBufferRowRange();

for (let row = startRow; row <= endRow; row++) {
let destroyed = false;

_.forEach(this.markerBubbleMap, (bubble: ResultView) => {
const { marker } = bubble;
if (marker.getStartBufferPosition().row === row) {
bubble.destroy();
delete this.markerBubbleMap[marker.id];
if (!destroyed) {
destroyed = true;
}
}
});

if (!destroyed) {
this.insertResultBubble(editor, row, true);
}
}
},

clearBubblesOnRow(row: number) {
log("clearBubblesOnRow:", row);
_.forEach(this.markerBubbleMap, (bubble: ResultView) => {
Expand Down

0 comments on commit 9ac0a2e

Please sign in to comment.