mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
Revert "[storage] Possibility to store metadata with records (cursor in scripts)"
This commit is contained in:
@@ -65,19 +65,13 @@ void EditorController::viewWillAppear() {
|
||||
ViewController::viewWillAppear();
|
||||
m_editorView.loadSyntaxHighlighter();
|
||||
if(GlobalPreferences::sharedGlobalPreferences()->cursorSaving()) {
|
||||
int offset = m_script.cursorOffset();
|
||||
if (offset != -1) {
|
||||
m_editorView.setCursorLocation(m_editorView.text() + offset);
|
||||
} else {
|
||||
m_editorView.setCursorLocation(m_editorView.text() + strlen(m_editorView.text()));
|
||||
}
|
||||
m_editorView.setCursorLocation(m_editorView.text() + strlen(m_editorView.text()));
|
||||
} else {
|
||||
m_editorView.setCursorLocation(m_editorView.text() + strlen(m_editorView.text()));
|
||||
}
|
||||
}
|
||||
|
||||
void EditorController::viewDidDisappear() {
|
||||
m_script.setCursorOffset(m_editorView.cursorLocation() - m_script.content());
|
||||
m_editorView.resetSelection();
|
||||
m_menuController->scriptContentEditionDidFinish();
|
||||
}
|
||||
|
||||
@@ -65,21 +65,6 @@ bool Script::nameCompliant(const char * name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t Script::cursorOffset() {
|
||||
assert(!isNull());
|
||||
Ion::Storage::MetadataRowHeader * metadataForRecord = Ion::Storage::sharedStorage()->metadataForRecord(*this);
|
||||
if (metadataForRecord != nullptr) {
|
||||
assert(metadataForRecord->metadataSize == 2);
|
||||
return *((uint16_t*) metadataForRecord->data());
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
void Script::setCursorOffset(uint16_t position) {
|
||||
assert(!isNull());
|
||||
Ion::Storage::sharedStorage()->setMetadataForRecord(*this, sizeof(uint16_t), &position);
|
||||
}
|
||||
|
||||
uint8_t * StatusFromData(Script::Data d) {
|
||||
return const_cast<uint8_t *>(static_cast<const uint8_t *>(d.buffer));
|
||||
}
|
||||
|
||||
@@ -50,8 +50,6 @@ public:
|
||||
void toggleAutoimportationStatus();
|
||||
const char * content() const;
|
||||
size_t contentSize() { return value().size - k_statusSize; }
|
||||
void setCursorOffset(uint16_t position); // -1 if no metadata
|
||||
uint16_t cursorOffset();
|
||||
|
||||
/* Fetched status */
|
||||
bool fetchedFromConsole() const;
|
||||
|
||||
Reference in New Issue
Block a user