Commit Graph

3373 Commits

Author SHA1 Message Date
Juan Francisco Cantero Hurtado
f23c2b6115
Raku syntax: Add .rakutest/.nqp extensions. Rework filename regex. (#3406)
With @niten94, @JoeKar and @Andriamanitra.
2024-08-31 12:44:10 +02:00
Neko Box Coder
e6b20b2ce9
Adding SpawnCursorAtLoc for plugin to use (#3441) 2024-08-31 12:42:55 +02:00
Jöran Karl
968f5ba1ef
tools: Revert tgz to tar.gz in cross-compile.sh (#3446) 2024-08-28 23:50:23 +02:00
Jöran Karl
04c577049c metainfo: Release v2.0.14 2024-08-27 19:58:17 +02:00
Jöran Karl
cc195b6a96
syntax/json: Add comment support to the syntax highlighting (#3434)
* allow comments in json

* syntax/json: Add colon to `TODO` comments

---------

Co-authored-by: Sertonix <83883937+Sertonix@users.noreply.github.com>
2024-08-19 22:16:42 +02:00
stone-w4tch3r
f74eb23827
winget as windows installation in README.md (#3248)
* micro as windows installation in README.md

* suggested change

* Change urls

Co-authored-by: にてん <127052329+niten94@users.noreply.github.com>

---------

Co-authored-by: にてん <127052329+niten94@users.noreply.github.com>
2024-08-19 21:22:45 +02:00
m-kru
fa9bc6b98c
Small fix for VHDL syntax (#3375) 2024-08-19 21:11:24 +02:00
rei
63ffc40a6b
Fix Ocaml syntax highlighting (#3427)
* Fix (kinda) Ocaml syntax highlighting

* Remove functions rule

* Highlight character with escape sequence

* Add suggested changes
2024-08-19 21:03:41 +02:00
Gin
a09c98a6dc
Update micro.json (#3433)
Based on the description, the type here should be boolean rather than a string.
2024-08-19 20:52:04 +02:00
Jöran Karl
7dc78b780a
Merge pull request #3343 from JoeKar/fix/volatile-after-reinit
Rework `filetype` change, `reload` command and `autosave`
2024-08-19 19:59:08 +02:00
Jöran Karl
b80ea93486 config: Correct typo in validatePositiveValue() 2024-08-18 22:28:51 +02:00
Jöran Karl
33b7c9db7c config: Don't truncate float64 to int 2024-08-18 22:28:51 +02:00
Jöran Karl
8b31dc79bf config: Rework autosave to be rearmed upon change 2024-08-18 22:28:49 +02:00
Jöran Karl
4170df89eb config: Use float64 within the autosave processing 2024-08-18 21:10:37 +02:00
Jöran Karl
832c7deaf8 config: Remove unused GetAutoTime() 2024-08-18 21:10:37 +02:00
Jöran Karl
a678d42861 plugins/comment: Don't write to b.Settings directly
...and use `SetOptionNative()` instead.
2024-08-18 21:10:37 +02:00
Jöran Karl
0542765d95 action/command: Simplify ResetCmd
It doesn't need to loop over the DefaultCommonSettings() again,
since they're already included in the default settings and set via
SetGlobalOptionNative().
2024-08-18 21:10:37 +02:00
Jöran Karl
10511c9baf buffer/buffer: Store fileformat in LocalSettings on auto detection 2024-08-18 21:10:37 +02:00
Jöran Karl
a3071b173b action/command: Refactor reload & the filetype change 2024-08-18 21:10:37 +02:00
Jöran Karl
724e29446f action/command: On reload prevent overwriting local settings 2024-08-18 21:10:37 +02:00
Jöran Karl
05529596cf action/command: Prevent overwriting settings set locally or by plugin
- on `reload`
- on `filetype` change
2024-08-18 21:10:37 +02:00
Jöran Karl
f661b64e0a config/settings: Remove duplicating DefaultGlobalSettings()
Additionally pricise the documentation of the remaining
DefaultCommonSettings() and DefaultAllSettings() functions.
2024-08-18 21:10:37 +02:00
Jöran Karl
4663927098 config: Refactor parsed option handling
Validate the parsed options directly after read and inform about errors.
2024-08-18 21:10:37 +02:00
Jöran Karl
395d848980 buffer/settings: Prevent setting of unchanged option 2024-08-18 21:10:37 +02:00
Jöran Karl
c741e36d2d action/command: Prevent setting of unchanged option 2024-08-18 21:10:37 +02:00
Jöran Karl
521b63a28c buffer/settings: On filetype change reload parsed local settings only
Additionally keep volatile settings as they have been set by the user.
2024-08-18 21:10:37 +02:00
Jöran Karl
62c1c667b8 buffer/settings: On filetype change remove the following steps
- reload runtime files
- reset globals
- parse the settings again

since this isn't the task of a filetype change.
2024-08-18 21:10:37 +02:00
Jöran Karl
c67a30e611 action/command: On reload prevent overwriting volatile settings 2024-08-18 21:10:37 +02:00
Jöran Karl
c51f848df2 action/command: On reload prevent overwriting settings.json 2024-08-18 21:10:37 +02:00
Jöran Karl
7f6e5bc860 action/command: On reload check and inform about errors 2024-08-18 21:10:37 +02:00
Jöran Karl
9afcb80c95 action/command: Let reload really reload the settings.json 2024-08-18 21:10:37 +02:00
Dmytro Maluka
fd3a00226c
Add matchbraceleft option (#3432)
Add `matchbraceleft` option to allow disabling the default behavior
matching not just the brace under cursor but also the brace to the left
of it (which is arguably convenient, but also ambiguous and
non-intuitive). With `matchbraceleft` disabled, micro will only match
the brace character that is precisely under the cursor, and also when
jumping to the matching brace, will always move cursor precisely to the
matching brace character, not to the character next to it.

Nota bene: historical journey:

- There was already a `matchbraceleft` option introduced in commit
  ea6a87d41a, when this feature (matching brace to the left) was
  introduced first time. That time it was matching _only_ the brace
  to the left, _instead_ of the brace under the cursor, and was
  disabled by default.

- Later this feature was removed during the big refactoring of micro.

- Then this feature was reintroduced again in commit d1e713ce08, in
  its present form (i.e. combined brace matching both under the cursor
  and to the left, simulating I-beam cursor behavior), and it was
  introduced unconditionally, without an option to disable it.

- Since then, multiple users complained about this feature and asked
  for an option to disable it, so now we are reintroducing it as an
  option again (this time enabled by default though).
2024-08-18 21:08:05 +02:00
Jöran Karl
f88ac6d4fe
Merge pull request #3430 from dmaluka/calchash-fixes
Various bugfixes and improvements around buffer md5 hash calculation and `fastdirty`
2024-08-18 19:56:06 +02:00
Dmytro Maluka
0b15b57e63 buffer: Set fastdirty=true for large file when reopening
Similarly to how we force `fastdirty` to true when opening a large file
(when creating the buffer), force it also when reopening a file, in case
the file on disk became large since we opened it.
2024-08-18 15:51:47 +02:00
Dmytro Maluka
d31095fe8f buffer/settings: Add comment why do we need to zero origHash 2024-08-18 15:51:47 +02:00
Dmytro Maluka
7fe98ccfee calcHash: Remove checking file size
Let calcHash() unconditionally hash whatever buffer it is asked to hash,
and let its callers explicitly check if the buffer is too large before
calling calcHash(). This makes things simpler and less error-prone
(no extra source of truth about whether the file is too large, we don't
need to remember to check if calcHash() fails, we can be sure calcHash()
will actually update the provided hash), and actually faster (since just
calculating the buffer size, i.e. adding line lengths, is faster than
md5 calculation).

In particular, this fixes the following bugs:

1. Since ReOpen() doesn't check calcHash() return value, if the reloaded
   file is too large while the old version of the file is not,
   calcHash() returns ErrFileTooLarge and doesn't update origHash, so
   so Modified() returns true since the reloaded file's md5 sum doesn't
   match the old origHash, so micro wrongly reports the newly reloaded
   file as modified.

2. Since Modified() doesn't check calcHash() return value, Modified()
   may return false positives or false negatives if the buffer has
   *just* become too large so calcHash() returns ErrFileTooLarge and
   doesn't update `buff`.
2024-08-18 15:42:18 +02:00
Dmytro Maluka
93efc9eabe buffer/settings: Don't use Modified() before we updated origHash
When we have already enabled `fastdirty` but have not updated origHash
yet, we shouldn't use Modified() since it depends on origHash which is
still outdated, and thus returns wrong values.

This fixes the following issue: enable `fastdirty`, modify the buffer,
save the buffer and disable `fastdirty` -> micro wrongly reports the
buffer as modified (whereas it has just been saved).

Note that this fix, though, also causes a regression: e.g. if we run
`set fastdirty false` while fastdirty is already disabled, micro may
unexpectedly report a non-modified buffer as modified (in the case if
isModified is true but the buffer it actually not modified, since its
md5 sum matches and fastdirty is disabled), since this fix assumes that
since we are disabling fastdirty, it has been enabled. This shall be
fixed by PR #3343 which makes `set` do nothing if the option value
doesn't change.
2024-08-18 15:39:47 +02:00
Jöran Karl
352fd2be22 buffer/settings: On fastdirty off set to on in case of "large file"
This behavior is then aligned to the actual documentation of `fastdirty`.
Additionally set the origHash to zero in case the buffer was already modified.
2024-08-18 14:01:35 +02:00
Dmytro Maluka
c0f6b65ed6 calcHash: use correct line endings
Make calcHash() respect the buffer's file endings (unix vs dos), to make
its calculation of the file size consistent with how we calculate it in
other cases (i.e. when opening or saving the file) and with the
`fastdirty` option documentation, i.e. make calcHash() return
ErrFileTooLarge if and only if the exact file size exceeds 50KB.
2024-08-18 13:35:37 +02:00
Dmytro Maluka
e0f5361d97 calcHash: remove unneeded h.Write() error checks
According to the Go hash package documentation [1]:

type Hash interface {
	// Write (via the embedded io.Writer interface) adds more data to the running hash.
	// It never returns an error.
	io.Writer

[1] https://pkg.go.dev/hash#Hash
2024-08-18 13:35:27 +02:00
Dmytro Maluka
3737979139
Merge pull request #3416 from dmaluka/undo-cursor-fix
Fix cursor moving to an unexpected location after a redo
2024-08-15 16:07:51 +02:00
Neko Box Coder
be69b2580b
Adding missing deselect when calling RemoveAllMultiCursors (#3428)
This adds missing deselect calls that were present previously for
RemoveAllMultiCursors before PR #3352
2024-08-15 16:06:32 +02:00
Jöran Karl
21bb61c5ff
Merge pull request #3418 from JoeKar/fix/nightly-assets
nightly: Fix asset names with `nightly` as version string
2024-08-08 18:37:29 +02:00
Jöran Karl
d744872f4c nightly: Call tools/cross-compile.sh with nightly as argument 2024-08-08 06:20:01 +02:00
Jöran Karl
a9c359a719 tools/cross-compile.sh: Make VERSION configurable 2024-08-08 06:19:59 +02:00
Jöran Karl
1fae584eea tools/cross-compile.sh: Remove unused variables 2024-08-05 23:16:53 +02:00
Dmytro Maluka
0d51035acd undo/redo: Remove no longer needed teCursor temp var 2024-08-04 13:56:03 +02:00
Dmytro Maluka
658c20ff2a undo/redo: Don't change remembered cursor location
Remember the cursor location in TextEvent just once - when the original
text event happens, so that when we redo after an undo, the cursor is
placed at the location where the actual redone modification happens (as
the user would expect), not at the location where the cursor was before
the undo (which may be a completely unrelated location and may be far
away).

Fixes #3411
2024-08-04 13:43:16 +02:00
Justin Su
2259fd10af
Add Shift-Page Up/Down keybindings (#3407)
* Add Shift-Page Up/Down keybindings in defaults_other.go

* Add Shift-Page Up/Down keybindings in defaults_darwin.go

* Document Shift-Page Up/Down keybindings in keybindings.md

* Fix indentation
2024-07-31 20:35:09 +02:00
Justin Su
b8772b69c2
Use // comments for .json (#3388)
Add comments to `.json` files using `//` instead of the default `#`.

Even though JSON does not support comments, JSON5 and JSONC exist, so `//` is a much more sane default. It also improves the experience of editing micro's own config files.
2024-07-30 22:58:07 +02:00