Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into updated-latest-elec…
Browse files Browse the repository at this point in the history
…tron
  • Loading branch information
mauricioszabo committed Nov 19, 2024
2 parents 109fe8c + ebde801 commit 0bb4dec
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
env:
PYTHON_VERSION: 3.12
GITHUB_TOKEN: ENCRYPTED[!06df1c93af902fc78fbd143724c5d11733607c6e743665859073de9aa2a317a5ac67b302f5ed92b232f6d28fae602e92!]
GITHUB_TOKEN: ENCRYPTED[!587e64c0e1412de985721fd9a82605b5b359a3565854235f9b092824dd50c847e5ed3fcf34acf5ead8b2707cd50ec895!]
# The above token, is a GitHub API Token, that allows us to download RipGrep without concern of API limits

# linux_task:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest, macos-12, windows-latest ]
os: [ ubuntu-latest, macos-13, windows-latest ]
include:
- os: ubuntu-latest
image: "debian:10"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/editor-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
!startsWith(github.event.pull_request.title, '[skip-editor-ci]')
strategy:
matrix:
# os: [ubuntu-20.04, macos-12, windows-2019]
os: [ubuntu-20.04, macos-12]
# os: [ubuntu-20.04, macos-13, windows-2019]
os: [ubuntu-20.04, macos-13]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

## [Unreleased]

- Fixed SQL State Storage not loading when starting Pulsar from a self-contained binary like appImage, tar.gz, etc.

## 1.122.0

- Added a SQL State Storage alternative to IndexedDB (opt-in, off by default).
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "pulsar",
"author": "Pulsar-Edit <admin@pulsar-edit.dev>",
"productName": "Pulsar",
"version": "1.121.0-dev",
"version": "1.122.0-dev",
"description": "A Community-led Hyper-Hackable Text Editor",
"branding": {
Expand Down
47 changes: 14 additions & 33 deletions packages/tree-view/lib/tree-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ class TreeView {
return dialog.attach();
}

async removeSelectedEntries() {
removeSelectedEntries() {
let activePath = this.getActivePath();
let selectedPaths, selectedEntries;
if (this.hasFocus()) {
Expand All @@ -896,25 +896,13 @@ class TreeView {
}
}

atom.confirm({
return atom.confirm({
message: `Are you sure you want to delete the selected ${selectedPaths.length > 1 ? 'items' : 'item'}?`,
detailedMessage: `You are deleting:\n${selectedPaths.join('\n')}`,
buttons: ['Move to Trash', 'Cancel']
}, async (response) => {
}, (response) => {
if (response === 0) { // Move to Trash
let failedDeletions = [];
let deletionPromises = [];

// Since this goes async, all entries that correspond to paths we're
// about to delete will soon detach from the tree. So we should figure
// out ahead of time which element we're going to select when we're
// done.
let newSelectedEntry;
let firstSelectedEntry = selectedEntries[0];
if (firstSelectedEntry) {
newSelectedEntry = firstSelectedEntry.closest('.directory:not(.selected)');
}

for (let selectedPath of selectedPaths) {
// Don't delete entries which no longer exist. This can happen, for
// example, when
Expand All @@ -925,24 +913,17 @@ class TreeView {
// but the parent folder is deleted first.
if (!fs.existsSync(selectedPath)) continue;

let meta = { pathToDelete: selectedPath };

this.emitter.emit('will-delete-entry', meta);
this.emitter.emit('will-delete-entry', { pathToDelete: selectedPath });

let promise = shell.trashItem(selectedPath).then(() => {
this.emitter.emit('entry-deleted', meta);
}).catch(() => {
this.emitter.emit('delete-entry-failed', meta);
// TODO: `shell.trashItem` is the favored way to do this.
if (shell.moveItemToTrash(selectedPath)) {
this.emitter.emit('entry-deleted', { pathToDelete: selectedPath });
} else {
this.emitter.emit('delete-entry-failed', { pathToDelete: selectedPath });
failedDeletions.push(selectedPath);
}).finally(() => {
repoForPath(selectedPath)?.getPathStatus(selectedPath);
});

deletionPromises.push(promise);
}
repoForPath(selectedPath)?.getPathStatus(selectedPath);
}

await Promise.allSettled(deletionPromises);

if (failedDeletions.length > 0) {
atom.notifications.addError(
this.formatTrashFailureMessage(failedDeletions),
Expand All @@ -953,9 +934,9 @@ class TreeView {
}
);
}

if (newSelectedEntry) {
this.selectEntry(newSelectedEntry);
let firstSelectedEntry = selectedEntries[0];
if (firstSelectedEntry) {
this.selectEntry(firstSelectedEntry.closest('.directory:not(.selected)'));
}

if (atom.config.get('tree-view.squashDirectoryNames')) {
Expand Down
4 changes: 1 addition & 3 deletions packages/tree-view/spec/tree-view-package-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3043,9 +3043,7 @@ describe("TreeView", function () {
fileView.dispatchEvent(new MouseEvent('click', {bubbles: true, detail: 1}));
treeView.focus();

spyOn(shell, 'trashItem').andCallFake(() => {
return Promise.reject(false);
})
spyOn(shell, 'moveItemToTrash').andReturn(false);

spyOn(atom, 'confirm').andCallFake((options, callback) => callback(0));

Expand Down
3 changes: 2 additions & 1 deletion script/electron-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ let options = {
// Other Exclusions
"!**/._*",
"!**/node_modules/*.d.ts",
"!**/node_modules/**/*.map",
"!**/node_modules/.bin",
"!**/node_modules/native-mate",
"!node_modules/fuzzy-native/node_modules", // node_modules of the fuzzy-native package are only required for building it
"!node_modules/@pulsar-edit/fuzzy-native/node_modules", // node_modules of the fuzzy-native package are only required for building it
"!**/node_modules/spellchecker/vendor/hunspell/.*",
"!**/git-utils/deps",
"!**/oniguruma/deps",
Expand Down
10 changes: 8 additions & 2 deletions src/state-store/sql.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
'use strict';

const sqlite3 = require('better-sqlite3');
const path = require('path');
const nativeSQLite = require(path.join(
require.resolve('better-sqlite3'),
'..', '..',
'build', 'Release',
'better_sqlite3.node'
));
const sqlite3 = require('better-sqlite3');

module.exports = class SQLStateStore {
constructor(databaseName, version) {
Expand All @@ -12,7 +18,7 @@ module.exports = class SQLStateStore {
const dbPath = path.join(atom.getConfigDirPath(), 'session-store.db');
let db;
try {
db = sqlite3(dbPath);
db = sqlite3(dbPath, {nativeBinding: nativeSQLite});
} catch(error) {
atom.notifications.addFatalError('Error loading database', {
stack: new Error('Error loading SQLite database for state storage').stack,
Expand Down

0 comments on commit 0bb4dec

Please sign in to comment.