mirror of https://github.com/atom/atom.git
fix multi cursor correct setting
This commit is contained in:
parent
e4b9c1e081
commit
21580aa170
|
@ -4221,7 +4221,7 @@ describe('TextEditorComponent', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('adds or removes cursors when holding cmd or ctrl when single-clicking', () => {
|
it('adds or removes cursors when holding cmd or ctrl when single-clicking', () => {
|
||||||
atom.config.set('core.editor.multiCursorOnClick', true);
|
atom.config.set('editor.multiCursorOnClick', true);
|
||||||
const { component, editor } = buildComponent({ platform: 'darwin' });
|
const { component, editor } = buildComponent({ platform: 'darwin' });
|
||||||
expect(editor.getCursorScreenPositions()).toEqual([[0, 0]]);
|
expect(editor.getCursorScreenPositions()).toEqual([[0, 0]]);
|
||||||
|
|
||||||
|
@ -4302,7 +4302,7 @@ describe('TextEditorComponent', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('adds word selections when holding cmd or ctrl when double-clicking', () => {
|
it('adds word selections when holding cmd or ctrl when double-clicking', () => {
|
||||||
atom.config.set('core.editor.multiCursorOnClick', true);
|
atom.config.set('editor.multiCursorOnClick', true);
|
||||||
const { component, editor } = buildComponent();
|
const { component, editor } = buildComponent();
|
||||||
editor.addCursorAtScreenPosition([1, 16], { autoscroll: false });
|
editor.addCursorAtScreenPosition([1, 16], { autoscroll: false });
|
||||||
expect(editor.getCursorScreenPositions()).toEqual([[0, 0], [1, 16]]);
|
expect(editor.getCursorScreenPositions()).toEqual([[0, 0], [1, 16]]);
|
||||||
|
@ -4329,7 +4329,7 @@ describe('TextEditorComponent', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('adds line selections when holding cmd or ctrl when triple-clicking', () => {
|
it('adds line selections when holding cmd or ctrl when triple-clicking', () => {
|
||||||
atom.config.set('core.editor.multiCursorOnClick', true);
|
atom.config.set('editor.multiCursorOnClick', true);
|
||||||
const { component, editor } = buildComponent();
|
const { component, editor } = buildComponent();
|
||||||
editor.addCursorAtScreenPosition([1, 16], { autoscroll: false });
|
editor.addCursorAtScreenPosition([1, 16], { autoscroll: false });
|
||||||
expect(editor.getCursorScreenPositions()).toEqual([[0, 0], [1, 16]]);
|
expect(editor.getCursorScreenPositions()).toEqual([[0, 0], [1, 16]]);
|
||||||
|
@ -4369,7 +4369,7 @@ describe('TextEditorComponent', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not add cursors when holding cmd or ctrl when single-clicking', () => {
|
it('does not add cursors when holding cmd or ctrl when single-clicking', () => {
|
||||||
atom.config.set('core.editor.multiCursorOnClick', false);
|
atom.config.set('editor.multiCursorOnClick', false);
|
||||||
const { component, editor } = buildComponent({ platform: 'darwin' });
|
const { component, editor } = buildComponent({ platform: 'darwin' });
|
||||||
expect(editor.getCursorScreenPositions()).toEqual([[0, 0]]);
|
expect(editor.getCursorScreenPositions()).toEqual([[0, 0]]);
|
||||||
|
|
||||||
|
@ -4411,7 +4411,7 @@ describe('TextEditorComponent', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not add word selections when holding cmd or ctrl when double-clicking', () => {
|
it('does not add word selections when holding cmd or ctrl when double-clicking', () => {
|
||||||
atom.config.set('core.editor.multiCursorOnClick', false);
|
atom.config.set('editor.multiCursorOnClick', false);
|
||||||
const { component, editor } = buildComponent();
|
const { component, editor } = buildComponent();
|
||||||
|
|
||||||
component.didMouseDownOnContent(
|
component.didMouseDownOnContent(
|
||||||
|
@ -4435,7 +4435,7 @@ describe('TextEditorComponent', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not add line selections when holding cmd or ctrl when triple-clicking', () => {
|
it('does not add line selections when holding cmd or ctrl when triple-clicking', () => {
|
||||||
atom.config.set('core.editor.multiCursorOnClick', false);
|
atom.config.set('editor.multiCursorOnClick', false);
|
||||||
const { component, editor } = buildComponent();
|
const { component, editor } = buildComponent();
|
||||||
|
|
||||||
const { clientX, clientY } = clientPositionForCharacter(
|
const { clientX, clientY } = clientPositionForCharacter(
|
||||||
|
@ -4557,7 +4557,7 @@ describe('TextEditorComponent', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('expands the last selection on drag', () => {
|
it('expands the last selection on drag', () => {
|
||||||
atom.config.set('core.editor.multiCursorOnClick', true);
|
atom.config.set('editor.multiCursorOnClick', true);
|
||||||
const { component, editor } = buildComponent();
|
const { component, editor } = buildComponent();
|
||||||
spyOn(component, 'handleMouseDragUntilMouseUp');
|
spyOn(component, 'handleMouseDragUntilMouseUp');
|
||||||
|
|
||||||
|
|
|
@ -1994,7 +1994,7 @@ module.exports = class TextEditorComponent {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const allowMultiCursor = atom.config.get('core.editor.multiCursorOnClick');
|
const allowMultiCursor = atom.config.get('editor.multiCursorOnClick');
|
||||||
const addOrRemoveSelection =
|
const addOrRemoveSelection =
|
||||||
allowMultiCursor && (metaKey || (ctrlKey && platform !== 'darwin'));
|
allowMultiCursor && (metaKey || (ctrlKey && platform !== 'darwin'));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue