* Add reload setting
Can be set to:
* auto - Automatically reload files that changed
* disabled - Do not reload files
* prompt - Prompt the user about reloading the file.
* option: Add default value for reload option and documentation
---------
Co-authored-by: Wilberto Morales <wilbertomorales777@gmail.com>
1. Python decorators begin a compound statement, so they only appear
at the start of a line. So match at the line start to avoid giving
decorator colors to matrix multiplication (@) expressions. Source:
https://docs.python.org/3/reference/compound_stmts.html#function-definitions
2. Python decorators go to the end of the line and might not include
parentheses (for example @functools.cache). So instead of matching
everything until an `(`, just match as many non-`(` characters
as possible---which both catches the @functools.cache example and
allows decorator parameters to fall back to the default color.
3. Instead of hardcoding `brightgreen` (which railscast.micro also
complains about), color decorators as `preproc` (otherwise unused
by the python syntax files, and arguably the right colorscheme
group to be using for syntactic sugars anyway). Note this will
change decorator colors---for example from bright green to kinda
brown on monokai, and from yellow to more of a light orange on
railscast.
* Fixed newline format detection for files not ending with a newline
Files with Windows-style line endings were being converted to
Unix-style if the file did not end with a newline
* Updated file format detection fix for consistency
The lock provided to lua as micro.Lock does not really work: an attempt
to use it via micro.Lock:Lock() results in an error:
Plugin initlua: init:260: attempt to call a non-function object
stack traceback:
init:260: in main chunk
[G]: ?
The reason is that the value that is provided to lua is a copy of the
mutex, not the mutex itself.
Ref #1539
Similarly to the crash fixed by #2967, which happens if sudo failed,
a crash also happens when sudo even fails to start. The reason for
the crash is also similar: nil dereference of screen.Screen caused by
the fact that we do not restore temporarily disabled screen.
To reproduce this crash, set the `sucmd` option to some non-existing
command, e.g. `aaa`, and try to save a file with root privileges.
* Fix panic due to invalid regex in a syntax file
When a user's custom syntax file has a malformed filename regex or
header regex, MakeHeaderYaml() returns error but we do not properly
handle it, which results in a panic due to a dereference of the `header`
pointer which is nil:
Micro encountered an error: runtime.errorString runtime error: invalid memory address or nil pointer dereference
runtime/panic.go:221 (0x44c367)
runtime/panic.go:220 (0x44c337)
github.com/zyedidia/micro/v2/internal/buffer/buffer.go:709 (0x82bc0f)
github.com/zyedidia/micro/v2/internal/buffer/buffer.go:392 (0x828292)
github.com/zyedidia/micro/v2/internal/buffer/buffer.go:261 (0x8278c8)
github.com/zyedidia/micro/v2/cmd/micro/micro.go:203 (0x8b9e7b)
github.com/zyedidia/micro/v2/cmd/micro/micro.go:331 (0x8ba9e5)
runtime/proc.go:255 (0x4386a7)
runtime/asm_amd64.s:1581 (0x467941)
* Do not ignore invalid filename regex error in a syntax file
When the filename regex in a syntax file is malformed but the subsequent
header regex is correct, the filename regex error gets silently ignored,
since the `err` value is overwritten by the subsequent successful header
regex result.
* highlighter: Fix regions and patterns inside regions
* highlighting: Remove 2nd recursive highlightRegion() call
...and add limitGroup checks to pattern search.
* yaml: Add TODO type highlighting
* highlighting: Don't stop in highlightRegion() at empty lines
...because possible region line end pattern must be detected.
* syntax/sh: Correct string handling due to additional pattern handling
* syntax/sh: Remove slash in variables
* highlighter: Accept nested region only in case it's within the current reagion
* highlighter: Accept nested patterns only in case it's within the current reagion
* highlighter: Don't search for nesting in case the region end was found at start
Build pipelines for the Jenkins build system are configured in Groovy,
however since their filename is always `Jenkinsfile`, micro doesn't
recognize them as Groovy, and doesn't add syntax highlighting.
This small commit simply adds `Jenkinsfile` and `jenkinsfile` as file
names recognized as Groovy.
Add HistorySearchUp and HistorySearchDown actions which are similar to
HistoryUp and HistoryDown but search for the prev/next history item
whose beginning matches the currently entered text in the infobuffer
(more precisely, the text before cursor).
Also fixed the following issue: if we scrolled to an older history item
and then edit the infobuffer, this older item gets modified.
We should not edit old history entries. So in this case set HistoryNum
to the last (newly added) item and modify the last item.
* highlighter: Fix region & pattern detection
* syntax/sh: Highlight upper case options too
* syntax/c(pp): Try to synchronize the rules to lower the maintenance effort
* syntax/ruby: Fix explicit filename detection in directories
* highlighter: Respect skip rules in regions
* syntax/sh: Fix parameter expansion, cond. flags and generalize filename via ""
* syntax/php|vi: Correct strings in comments to comments only
Additionally improve vimscript comment handling.
* highlighter: Remove problematic start|end check in find(all)Index()
...and additionally remove recursive region end detection
On modern Linux systems, it can take 30 seconds for
the data to actually hit the disk (check
/proc/sys/vm/dirty_expire_centisecs).
If the computer crashes in those 30 seconds, the user
may end up with an empty file as seen here:
https://github.com/neovim/neovim/issues/9888
This is why editors like vim and nano call
the fsync syscall after they wrote the file.
This syscall is available as file.Sync() in Go.
Running strace against micro shows that fsync is
called as expected:
$ strace -f -p $(pgrep micro) -e fsync
strace: Process 3284344 attached with 9 threads
[pid 3284351] fsync(8) = 0
Also, we now catch errors returned from w.Flush().
* Comment fix & gofmt fix
* Goto next/previous diff commands
These commands will work in `git` repositories or whenever `set diff on` is
working. They are bound to `Alt-[` and `Alt-]` by default. I would prefer
`Alt-Up` and `Alt-Down`, but that's already taken.
There are no tests at the moment; I'm looking into writing some since that will
be needed for the rest of the plan to make
https://github.com/zyedidia/micro/discussions/2753 a reality. I'm not sure how
difficult that will be.
* Realign JSON in keybindings.md
* Add <content_rating> to appdata file
* Add <project_license> to appdata file
* Change application_id to use github.io instead of github.com
Github actually gives username.github.io domains and not username.github.com,
therefore it is more correct to use .io top level domain.
We can use <provides><id>...</id></provides> for everyone who expected
the old application_id
Bump zyedidia/terminal, which is the actual dependency. We can get the
information we need from the Term's pty file rather than using a buffer
connected to stdout.
Fixes#2775