Commit Graph

3373 Commits

Author SHA1 Message Date
Jöran Karl
79ce93fb7d backup: Clear the requested backup upon completion notification
Now the main go routine takes care of the backup synchronization.
2025-02-28 18:57:53 +01:00
Jöran Karl
771aab251c save+backup: Process the save & backup with a sequential channel
As advantage we don't need to synchonize them any longer and
don't need further insufficient lock mechanisms.
2025-02-28 18:57:53 +01:00
Jöran Karl
35d295dd04 buffer: Remove superfluous backupTime 2025-02-28 18:57:53 +01:00
Jöran Karl
8c883c6210 backup: Rearrange and extend BackupMsg 2025-02-28 18:57:53 +01:00
Jöran Karl
c4dcef3e66 micro: Provide recovery of settings.json & bindings.json 2025-02-28 18:57:53 +01:00
Jöran Karl
e15bb88270 micro: Generalize exit behavior 2025-02-28 18:57:53 +01:00
Jöran Karl
9592bb1549 save: Further rework of overwriteFile()
- extract the open logic into `openFile()` and return a `wrappedFile`
- extract the closing logic into `Close()` and make a method of `wrappedFile`
- rename `writeFile()` into `Write()` and make a method of `wrappedFile`

This allows to use the split parts alone while keeping overwriteFile() as simple
interface to use all in a row.
2025-02-28 18:57:53 +01:00
Jöran Karl
f8d98558f0 save: Merge overwrite() into overwriteFile() and extract writeFile() 2025-02-28 18:57:53 +01:00
Jöran Karl
c926649496 settings: Perform write process safe 2025-02-28 18:57:53 +01:00
Jöran Karl
63d68ec441 bindings: Perform write process safe 2025-02-28 18:57:53 +01:00
Jöran Karl
c972360386 serialize: Perform write process safe 2025-02-28 18:57:53 +01:00
Jöran Karl
022ec0228a util: Provide SafeWrite() to generalize the internal file write process
SafeWrite() will create a temporary intermediate file.
2025-02-28 18:57:53 +01:00
Jöran Karl
4ac8c786f5 backup: Perform write process safe 2025-02-28 18:57:53 +01:00
Jöran Karl
21b7080935 util: Provide AppendBackupSuffix() for further transformations 2025-02-28 18:57:53 +01:00
Jöran Karl
1663a1a6e4 actions: Don't overwrite the buffers Path
This is fully handled within the buffers `save` domain.
2025-02-28 18:57:53 +01:00
Jöran Karl
9b53257e50 save: Perform write process safe 2025-02-28 18:57:53 +01:00
Jöran Karl
6e8daa117a ioutil: Remove deprecated functions where possible 2025-02-28 18:57:53 +01:00
Jöran Karl
18a81f043c util: Generalize the file mode of 0666 with util.FileMode 2025-02-28 18:57:53 +01:00
Jöran Karl
69064cf808 util: Improve and rename EscapePath() to DetermineEscapePath()
If the new URL encoded path is found then it has precedence over the '%' escaped
path. In case none of both is found the new URL approach is used.
2025-02-28 18:57:53 +01:00
Jöran Karl
e828027cc0 clean: Remove some unneeded filepath.Join() calls 2025-02-28 18:57:53 +01:00
Jöran Karl
c2bc4688dd clean: Inform about all failed write steps 2025-02-28 18:57:53 +01:00
Jöran Karl
5aac42dbe7 bindings: Convert os.IsNotExist() into errors.Is() 2025-02-28 18:57:53 +01:00
Jöran Karl
42ae05b082 backup: Lock the buffer lines in Backup() 2025-02-28 18:57:53 +01:00
Jöran Karl
0b871e174f backup: Store the file with the endings of the buffer 2025-02-28 18:57:53 +01:00
Jöran Karl
7c659d1820 backup: Convert os.IsNotExist() into errors.Is() 2025-02-28 18:57:53 +01:00
Jöran Karl
6066c1a10e buffer: Convert os.Is() into errors.Is() 2025-02-28 18:57:53 +01:00
Jöran Karl
6bcec2100c open & write: Process regular files only 2025-02-28 18:57:53 +01:00
Jöran Karl
edc5ff75e3 save: Convert os.IsNotExist() into errors.Is() 2025-02-28 18:57:53 +01:00
Jöran Karl
3fcaf16074 actions: SaveCmd: Print the error of SaveAs to the InfoBar 2025-02-28 18:57:53 +01:00
Jöran Karl
5c21241fc4 actions: SaveAs: Print the error of os.Stat() to the InfoBar 2025-02-28 18:57:53 +01:00
Jöran Karl
272a308275
Merge pull request #3663 from niten94/sh-separate-paramexp
Some checks failed
Build and Test / test (1.19.x, macos-latest) (push) Has been cancelled
Build and Test / test (1.19.x, ubuntu-latest) (push) Has been cancelled
Build and Test / test (1.19.x, windows-latest) (push) Has been cancelled
Build and Test / test (1.23.x, macos-latest) (push) Has been cancelled
Build and Test / test (1.23.x, ubuntu-latest) (push) Has been cancelled
Build and Test / test (1.23.x, windows-latest) (push) Has been cancelled
`sh.yaml`: Match valid parameter expansions without braces
2025-02-27 19:03:30 +01:00
Jöran Karl
c93747926d
Merge pull request #3662 from JoeKar/fix/reload-settings
Some checks failed
Build and Test / test (1.19.x, macos-latest) (push) Has been cancelled
Build and Test / test (1.19.x, ubuntu-latest) (push) Has been cancelled
Build and Test / test (1.19.x, windows-latest) (push) Has been cancelled
Build and Test / test (1.23.x, macos-latest) (push) Has been cancelled
Build and Test / test (1.23.x, ubuntu-latest) (push) Has been cancelled
Build and Test / test (1.23.x, windows-latest) (push) Has been cancelled
buffer: Fix `ReloadSettings(true)` for volatile `filetype`
2025-02-24 18:01:02 +01:00
niten94
0985d2cadd sh.yaml: Match parameter expansions with braces using \w 2025-02-23 11:39:11 +08:00
Jöran Karl
ddc6051b33 actions: Use SetOptionNative() instead of setting options directly
Setting options directly in (h.)Buf.Settings without calling SetOption() or
SetOptionNative() is generally not the best idea, since it may not
trigger the needed side effects.
In particular, after https://github.com/zyedidia/micro/pull/3343,
directly setting `diffgutter` and `ruler` causes them not being tracked as
locally overridden per buffer, so if we run the `reload` command,
it unexpectedly replaces them with the default ones.
2025-02-20 20:24:07 +01:00
Jöran Karl
2e94235905 buffer: Perform filetype callbacks on ReloadSettings()
In `ReloadSettings()` the `filetype` can change upon globbed path given by
the `settings.json` or by identifying a different `filetype` based on the
file name given or pattern present inside the file.
To prevent further recursion caused by checking the `filetype` again, its
processing stops here and isn't considered in `DoSetOptionNative()`
once again where the callbacks are usually triggered.
2025-02-20 20:24:05 +01:00
Jöran Karl
4a9058c3bd buffer: Move UpdatePathGlobLocals() before updating the filetype
Like in NewBuffer(), we need to update glob-based local settings
before updating the filetype, since the filetype itself may be among those
glob-based local settings.
2025-02-20 20:20:38 +01:00
Jöran Karl
982a4fe065 config: Prevent the update of filetype by UpdateFileTypeLocals()
This shall prevent unpredictable results caused by such a user configuration:

```
"ft:go" {
	"filetype": "c"
}
```
2025-02-20 20:18:36 +01:00
Jöran Karl
930fbea74d config: Split up InitLocalSettings() into two dedicated functions
* `UpdatePathGlobLocals()`
	* to apply the settings provided within e.g. "/etc/*": {}
* `UpdateFileTypeLocals()`
	* to apply the settings provided within e.g. "ft:shell": {}

We don't need to call `InitLocalSettings()` twice any longer.
2025-02-20 20:18:30 +01:00
Jöran Karl
00e568640c buffer: Fix ReloadSettings(true) for volatile filetype
We shall not overwrite a volatile set `filetype` provided as argument for micro:
`micro -filetype shell foo`
2025-02-17 20:30:20 +01:00
niten94
d992c606c5 status.lua: Move import lines to beginning of file 2025-02-15 23:17:33 +08:00
niten94
4abd966a99 sh.yaml: Match valid parameter expansions without braces
Match parameter expansions with valid name only in shell syntax file
when there are no braces.
2025-02-15 07:54:22 +08:00
matthias314
5a62a8ead4
match beginning and end of line correctly in FindNext and ReplaceRegex (#3575)
Some checks failed
Build and Test / test (1.19.x, macos-latest) (push) Has been cancelled
Build and Test / test (1.19.x, ubuntu-latest) (push) Has been cancelled
Build and Test / test (1.19.x, windows-latest) (push) Has been cancelled
Build and Test / test (1.23.x, macos-latest) (push) Has been cancelled
Build and Test / test (1.23.x, ubuntu-latest) (push) Has been cancelled
Build and Test / test (1.23.x, windows-latest) (push) Has been cancelled
2025-02-09 15:19:43 +01:00
Jöran Karl
bf4156c490
Merge pull request #3657 from Andriamanitra/PR3656-continuation
Some checks are pending
Build and Test / test (1.19.x, macos-latest) (push) Waiting to run
Build and Test / test (1.19.x, ubuntu-latest) (push) Waiting to run
Build and Test / test (1.19.x, windows-latest) (push) Waiting to run
Build and Test / test (1.23.x, macos-latest) (push) Waiting to run
Build and Test / test (1.23.x, ubuntu-latest) (push) Waiting to run
Build and Test / test (1.23.x, windows-latest) (push) Waiting to run
plugin: linter: add ruff to default configuration
2025-02-08 16:19:59 +01:00
Andriamanitra
b9f1fc8da2 add missing linters to help linter 2025-02-07 23:56:25 +02:00
magneticminou
728526682e
plugin: linter: add ruff to documentation 2025-02-07 14:12:29 -03:00
magneticminou
c105c940fe
plugin: linter: change in ruff configuration
Use `--output-format concise` as suggested to get exact column of error

Co-authored-by: Mikko <Andriamanitra@users.noreply.github.com>
2025-02-06 19:28:47 -03:00
magneticminou
cdc9ab17f2
plugin: linter: add ruff to default configuration. 2025-02-06 17:05:04 -03:00
usfbih8u
b432bb7cfa
docs: remove duplicated line (#3647)
Some checks failed
Build and Test / test (1.19.x, macos-latest) (push) Has been cancelled
Build and Test / test (1.19.x, ubuntu-latest) (push) Has been cancelled
Build and Test / test (1.19.x, windows-latest) (push) Has been cancelled
Build and Test / test (1.23.x, macos-latest) (push) Has been cancelled
Build and Test / test (1.23.x, ubuntu-latest) (push) Has been cancelled
Build and Test / test (1.23.x, windows-latest) (push) Has been cancelled
2025-02-01 09:41:25 +01:00
Jöran Karl
e4b0ad7107
Merge pull request #3620 from JoeKar/feature/cursor-overwrite-indicator
Some checks are pending
Build and Test / test (1.19.x, macos-latest) (push) Waiting to run
Build and Test / test (1.19.x, ubuntu-latest) (push) Waiting to run
Build and Test / test (1.19.x, windows-latest) (push) Waiting to run
Build and Test / test (1.23.x, macos-latest) (push) Waiting to run
Build and Test / test (1.23.x, ubuntu-latest) (push) Waiting to run
Build and Test / test (1.23.x, windows-latest) (push) Waiting to run
statusline: Provide `overwrite` mode indicator
2025-01-31 17:59:36 +01:00
Jöran Karl
57a6e81ddb statusline: Provide overwrite mode indicator 2025-01-30 20:19:37 +01:00