lexgui 0.1.27 → 0.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -313,7 +313,7 @@ class CodeEditor {
313
313
  }
314
314
 
315
315
  this.base_area = area;
316
- this.area = new LX.Area( { className: "lexcodeeditor", height: "auto", no_append: true } );
316
+ this.area = new LX.Area( { className: "lexcodeeditor", height: "100%", no_append: true } );
317
317
 
318
318
  this.tabs = this.area.addTabs( { onclose: (name) => {
319
319
  delete this.openedTabs[ name ];
@@ -905,19 +905,28 @@ class CodeEditor {
905
905
  const [word, from, to] = this.getWordAtPos( cursor, -1 );
906
906
  // If no length, we change line..
907
907
  if( !word.length && this.lineUp( cursor, true ) ) {
908
+ const cS = e.cancelShift, kS = e.keepSelection;
908
909
  e.cancelShift = true;
909
910
  e.keepSelection = true;
910
911
  this.actions[ 'End' ].callback( cursor.line, cursor, e );
911
- delete e.cancelShift;
912
- delete e.keepSelection;
912
+ e.cancelShift = cS;
913
+ e.keepSelection = kS;
913
914
  }
914
915
  var diff = Math.max( cursor.position - from, 1 );
915
916
  var substr = word.substr( 0, diff );
917
+
916
918
  // Selections...
917
- if( e.shiftKey ) { if( !cursor.selection ) this.startSelection( cursor ); }
918
- else this.endSelection();
919
+ if( e.shiftKey ) {
920
+ if( !cursor.selection )
921
+ this.startSelection( cursor );
922
+ }
923
+ else
924
+ this.endSelection();
925
+
919
926
  this.cursorToString( cursor, substr, true );
920
- if( e.shiftKey ) this._processSelection( cursor, e, false, true );
927
+
928
+ if( e.shiftKey )
929
+ this._processSelection( cursor, e );
921
930
  }
922
931
  else {
923
932
  var letter = this.getCharAtPos( cursor, -1 );
@@ -2212,12 +2221,13 @@ class CodeEditor {
2212
2221
  this.hideAutoCompleteBox();
2213
2222
  return;
2214
2223
  case 'arrowdown': // add cursor below only for the main cursor..
2215
- if( isLastCursor && this.code.lines[ lidx + 1 ] != undefined )
2224
+ // Make sure shift is not pressed..
2225
+ if( !e.shiftKey && isLastCursor && this.code.lines[ lidx + 1 ] != undefined )
2216
2226
  {
2217
2227
  var new_cursor = this._addCursor( cursor.line, cursor.position, true );
2218
2228
  this.lineDown( new_cursor );
2229
+ return;
2219
2230
  }
2220
- return;
2221
2231
  }
2222
2232
  }
2223
2233
 
@@ -3472,12 +3482,17 @@ class CodeEditor {
3472
3482
 
3473
3483
  // Remove indentation
3474
3484
  const lidx = cursor.line;
3475
- const lineStart = firstNonspaceIndex( this.code.lines[ lidx ] );
3485
+ let lineStart = firstNonspaceIndex( this.code.lines[ lidx ] );
3476
3486
 
3477
- // Nothing to remove...
3487
+ // Nothing to remove... we are at the start of the line
3478
3488
  if( lineStart == 0 )
3479
3489
  return;
3480
3490
 
3491
+ // Only tabs/spaces in the line...
3492
+ if( lineStart == -1 ) {
3493
+ lineStart = this.code.lines[ lidx ].length;
3494
+ }
3495
+
3481
3496
  let indentSpaces = lineStart % this.tabSpaces;
3482
3497
  indentSpaces = indentSpaces == 0 ? this.tabSpaces : indentSpaces;
3483
3498
  const newStart = Math.max( lineStart - indentSpaces, 0 );