lexgui 0.1.27 → 0.1.29

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.
@@ -174,7 +174,10 @@ class ScrollBar {
174
174
 
175
175
  this.root = document.createElement( 'div' );
176
176
  this.root.className = "lexcodescrollbar";
177
- if( type & ScrollBar.SCROLLBAR_HORIZONTAL )
177
+
178
+ if( type & ScrollBar.SCROLLBAR_VERTICAL )
179
+ this.root.classList.add( 'vertical' );
180
+ else if( type & ScrollBar.SCROLLBAR_HORIZONTAL )
178
181
  this.root.classList.add( 'horizontal' );
179
182
 
180
183
  this.thumb = document.createElement( 'div' );
@@ -313,7 +316,7 @@ class CodeEditor {
313
316
  }
314
317
 
315
318
  this.base_area = area;
316
- this.area = new LX.Area( { className: "lexcodeeditor", height: "auto", no_append: true } );
319
+ this.area = new LX.Area( { className: "lexcodeeditor", height: "100%", no_append: true } );
317
320
 
318
321
  this.tabs = this.area.addTabs( { onclose: (name) => {
319
322
  delete this.openedTabs[ name ];
@@ -905,19 +908,28 @@ class CodeEditor {
905
908
  const [word, from, to] = this.getWordAtPos( cursor, -1 );
906
909
  // If no length, we change line..
907
910
  if( !word.length && this.lineUp( cursor, true ) ) {
911
+ const cS = e.cancelShift, kS = e.keepSelection;
908
912
  e.cancelShift = true;
909
913
  e.keepSelection = true;
910
914
  this.actions[ 'End' ].callback( cursor.line, cursor, e );
911
- delete e.cancelShift;
912
- delete e.keepSelection;
915
+ e.cancelShift = cS;
916
+ e.keepSelection = kS;
913
917
  }
914
918
  var diff = Math.max( cursor.position - from, 1 );
915
919
  var substr = word.substr( 0, diff );
920
+
916
921
  // Selections...
917
- if( e.shiftKey ) { if( !cursor.selection ) this.startSelection( cursor ); }
918
- else this.endSelection();
922
+ if( e.shiftKey ) {
923
+ if( !cursor.selection )
924
+ this.startSelection( cursor );
925
+ }
926
+ else
927
+ this.endSelection();
928
+
919
929
  this.cursorToString( cursor, substr, true );
920
- if( e.shiftKey ) this._processSelection( cursor, e, false, true );
930
+
931
+ if( e.shiftKey )
932
+ this._processSelection( cursor, e );
921
933
  }
922
934
  else {
923
935
  var letter = this.getCharAtPos( cursor, -1 );
@@ -1503,9 +1515,11 @@ class CodeEditor {
1503
1515
  doAsync( () => {
1504
1516
 
1505
1517
  // Change css a little bit...
1506
- this.gutter.style.height = "calc(100% - 38px)";
1518
+ this.gutter.style.height = "calc(100% - 28px)";
1507
1519
  this.root.querySelectorAll( '.code' ).forEach( e => e.style.height = "calc(100% - 6px)" );
1508
1520
  this.root.querySelector( '.lexareatabscontent' ).style.height = "calc(100% - 23px)";
1521
+ this.base_area.root.querySelector( '.lexcodescrollbar.vertical' ).style.height = "calc(100% - 27px)";
1522
+ this.tabs.area.root.classList.add( 'no-code-info' );
1509
1523
 
1510
1524
  }, 100);
1511
1525
  }
@@ -2212,12 +2226,13 @@ class CodeEditor {
2212
2226
  this.hideAutoCompleteBox();
2213
2227
  return;
2214
2228
  case 'arrowdown': // add cursor below only for the main cursor..
2215
- if( isLastCursor && this.code.lines[ lidx + 1 ] != undefined )
2229
+ // Make sure shift is not pressed..
2230
+ if( !e.shiftKey && isLastCursor && this.code.lines[ lidx + 1 ] != undefined )
2216
2231
  {
2217
2232
  var new_cursor = this._addCursor( cursor.line, cursor.position, true );
2218
2233
  this.lineDown( new_cursor );
2234
+ return;
2219
2235
  }
2220
- return;
2221
2236
  }
2222
2237
  }
2223
2238
 
@@ -3472,12 +3487,17 @@ class CodeEditor {
3472
3487
 
3473
3488
  // Remove indentation
3474
3489
  const lidx = cursor.line;
3475
- const lineStart = firstNonspaceIndex( this.code.lines[ lidx ] );
3490
+ let lineStart = firstNonspaceIndex( this.code.lines[ lidx ] );
3476
3491
 
3477
- // Nothing to remove...
3492
+ // Nothing to remove... we are at the start of the line
3478
3493
  if( lineStart == 0 )
3479
3494
  return;
3480
3495
 
3496
+ // Only tabs/spaces in the line...
3497
+ if( lineStart == -1 ) {
3498
+ lineStart = this.code.lines[ lidx ].length;
3499
+ }
3500
+
3481
3501
  let indentSpaces = lineStart % this.tabSpaces;
3482
3502
  indentSpaces = indentSpaces == 0 ? this.tabSpaces : indentSpaces;
3483
3503
  const newStart = Math.max( lineStart - indentSpaces, 0 );