mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-23 01:32:55 +02:00
V0.51.4 (#847)
* BladeBurner
* nerfed int exp gained.
Documentation
* purchaseServer specifies what happens on failure.
* Fixed typo in recommended bitnode page.
* Removed misleading ram requirements for hacking factions.
Netscript
* growthAnalyze handles Infinity correctly.
Misc.
* Faction Augmentation will list how much reputation is required even after
that goal has been reached.
* Removed dollar sign in travel agency confirmation.
* Fixed typo in alpha-omega.lit
* the game save text no longer obstruct the save game and options button
* the text editors now remember where your cursor was and restores it when loading the same script again.
* v0.51.4
This commit is contained in:
@@ -314,6 +314,14 @@ class AceEditorWrapper extends ScriptEditor {
|
||||
elem.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
getCursor() {
|
||||
return this.editor.getCursorPosition();
|
||||
}
|
||||
|
||||
setCursor(pos) {
|
||||
this.editor.gotoLine(pos.row+1, pos.column);
|
||||
}
|
||||
}
|
||||
|
||||
export const AceEditor = new AceEditorWrapper();
|
||||
|
||||
@@ -570,6 +570,15 @@ class CodeMirrorEditorWrapper extends ScriptEditor {
|
||||
elem.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
getCursor() {
|
||||
const c = this.editor.getCursor(); //I need to get the cursor position
|
||||
return {row: c.line, column: c.ch};
|
||||
}
|
||||
|
||||
setCursor(pos) {
|
||||
this.editor.setCursor({line: pos.row, ch: pos.column});
|
||||
}
|
||||
}
|
||||
|
||||
export const CodeMirrorEditor = new CodeMirrorEditorWrapper();
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
export type Position = {
|
||||
row: number;
|
||||
column: number;
|
||||
};
|
||||
|
||||
export class PositionTracker {
|
||||
positions: Map<string, Position>;
|
||||
|
||||
constructor() {
|
||||
this.positions = new Map<string, Position>();
|
||||
}
|
||||
|
||||
saveCursor(filename: string, pos: Position) {
|
||||
this.positions.set(filename, pos);
|
||||
}
|
||||
|
||||
getCursor(filename: string): Position {
|
||||
const position = this.positions.get(filename);
|
||||
if (!position) {
|
||||
return {
|
||||
row: 0,
|
||||
column: 0,
|
||||
};
|
||||
}
|
||||
return position;
|
||||
}
|
||||
};
|
||||
|
||||
export const CursorPositions: PositionTracker = new PositionTracker();
|
||||
@@ -1,3 +1,5 @@
|
||||
import { CursorPositions } from './CursorPositions';
|
||||
|
||||
// Base Script Editor class for the Ace/CodeMirror/etc. wrappers
|
||||
const beautify = require('js-beautify').js_beautify;
|
||||
|
||||
@@ -33,6 +35,7 @@ export class ScriptEditor {
|
||||
if (filename != "") {
|
||||
this.filenameInput.value = filename;
|
||||
this.editor.setValue(code);
|
||||
this.setCursor(CursorPositions.getCursor(filename));
|
||||
}
|
||||
|
||||
this.editor.focus();
|
||||
|
||||
Reference in New Issue
Block a user