##// END OF EJS Templates
refactor to improve cell switching in edit mode...
Paul Ivanov -
Show More
@@ -230,6 +230,34 var IPython = (function (IPython) {
230 };
230 };
231
231
232 /**
232 /**
233 * @method at_top
234 * @return {Boolean}
235 */
236 Cell.prototype.at_top = function () {
237 var cm = this.code_mirror
238 var cursor = cm.getCursor();
239 if (cursor.line === 0 && cm.findPosV(cursor, -1, 'line').hitSide) {
240 console.log('at top');
241 return true;
242 } else {
243 return false;
244 }
245 };
246
247 /**
248 * @method at_bottom
249 * @return {Boolean}
250 * */
251 Cell.prototype.at_bottom = function () {
252 var cm = this.code_mirror
253 var cursor = cm.getCursor();
254 if (cursor.line === (cm.lineCount()-1) && cm.findPosV(cursor, 1, 'line').hitSide) {
255 return true;
256 } else {
257 return false;
258 }
259 };
260 /**
233 * enter the command mode for the cell
261 * enter the command mode for the cell
234 * @method command_mode
262 * @method command_mode
235 * @return is the action being taken
263 * @return is the action being taken
@@ -501,26 +501,6 var IPython = (function (IPython) {
501 };
501 };
502
502
503
503
504 CodeCell.prototype.at_top = function () {
505 var cursor = this.code_mirror.getCursor();
506 if (cursor.line === 0 && cursor.ch === 0) {
507 return true;
508 } else {
509 return false;
510 }
511 };
512
513
514 CodeCell.prototype.at_bottom = function () {
515 var cursor = this.code_mirror.getCursor();
516 if (cursor.line === (this.code_mirror.lineCount()-1) && cursor.ch === this.code_mirror.getLine(cursor.line).length) {
517 return true;
518 } else {
519 return false;
520 }
521 };
522
523
524 CodeCell.prototype.clear_output = function (wait) {
504 CodeCell.prototype.clear_output = function (wait) {
525 this.output_area.clear_output(wait);
505 this.output_area.clear_output(wait);
526 this.set_input_prompt();
506 this.set_input_prompt();
@@ -242,40 +242,6 var IPython = (function (IPython) {
242 this.element.find('div.text_cell_render').html(text);
242 this.element.find('div.text_cell_render').html(text);
243 };
243 };
244
244
245 /**
246 * @method at_top
247 * @return {Boolean}
248 */
249 TextCell.prototype.at_top = function () {
250 if (this.rendered) {
251 return true;
252 } else {
253 var cursor = this.code_mirror.getCursor();
254 if (cursor.line === 0 && cm.findPosV(cm.getCursor(), -1, 'line', cm.charCoords(cm.getCursor(),'div').left).hitSide) {
255 console.log('at top');
256 return true;
257 } else {
258 return false;
259 }
260 }
261 };
262
263 /**
264 * @method at_bottom
265 * @return {Boolean}
266 * */
267 TextCell.prototype.at_bottom = function () {
268 if (this.rendered) {
269 return true;
270 } else {
271 var cursor = this.code_mirror.getCursor();
272 if (cursor.line === (this.code_mirror.lineCount()-1) && cursor.ch === this.code_mirror.getLine(cursor.line).length) {
273 return true;
274 } else {
275 return false;
276 }
277 }
278 };
279
245
280 /**
246 /**
281 * Create Text cell from JSON
247 * Create Text cell from JSON
General Comments 0
You need to be logged in to leave comments. Login now