'use strict';

var Command = require('./command');

var SelectAll = Command.extend({
  static: {
    name: 'selectAll'
  },

  execute: function() {
    var ctrl = this.getController();
    var surface = ctrl.getSurface();
    if (surface) {
      var editor = ctrl.getSurface().getEditor();
      var newSelection = editor.selectAll(ctrl.getDocument(), surface.getSelection());
      surface.setSelection(newSelection);
      return true;
    } else {
      console.warn('selectAll command can not be applied since there is no focused surface');
      return false;
    }
  }
});

module.exports = SelectAll;
'use strict';

var SurfaceCommand = require('./surface_command');

var SelectAll = SurfaceCommand.extend({
  static: {
    name: 'selectAll'
  },

  execute: function() {
    var surface = this.getSurface();
    if (surface) {
      var newSelection = surface.selectAll(surface.getDocument(), surface.getSelection());
      surface.setSelection(newSelection);
      return true;
    } else {
      console.warn('selectAll command can not be applied since there is no focused surface');
      return false;
    }
  }
});

module.exports = SelectAll;
Fix broken select all command.
Fix broken select all command.
