Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Fix #4397 - Don't allow context menu when a line is empty #4424

Merged
merged 1 commit into from
Oct 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/components/Editor/GutterMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { connect } from "react-redux";
import { lineAtHeight } from "../../utils/editor";
import {
getContextMenu,
getEmptyLines,
getSelectedLocation,
getSelectedSource,
getVisibleBreakpoints,
Expand Down Expand Up @@ -143,6 +144,10 @@ class GutterContextMenuComponent extends PureComponent {
bp => bp.location.line === line
);

if (props.emptyLines.includes(line)) {
return;
}

gutterMenu({ event, sourceId, line, breakpoint, ...props });
}

Expand All @@ -153,12 +158,16 @@ class GutterContextMenuComponent extends PureComponent {

export default connect(
state => {
const selectedSource = getSelectedSource(state);
return {
selectedLocation: getSelectedLocation(state),
selectedSource: getSelectedSource(state),
selectedSource: selectedSource,
breakpoints: getVisibleBreakpoints(state),
pauseData: getPause(state),
contextMenu: getContextMenu(state)
contextMenu: getContextMenu(state),
emptyLines: selectedSource
? getEmptyLines(state, selectedSource.toJS())
: []
};
},
dispatch => bindActionCreators(actions, dispatch)
Expand Down