Commit Graph

2967 Commits

Author SHA1 Message Date
Zachary Yedidia
68d88b571d Bump tcell 2023-10-22 00:35:11 +02:00
Jöran Karl
041ee002dd
syntax: sh: Add here document as string region (#2953) 2023-10-22 00:19:59 +02:00
Jöran Karl
f7244d09c6
Add reload setting - finalization of #2627 (#2845)
* 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>
2023-10-22 00:18:41 +02:00
Zachary Yedidia
9da6af91c8 Handle SIGABRT properly 2023-10-20 08:51:17 +02:00
Andrew Geng
2a9a5afbb2
Fix python decorator syntax. (#2827)
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.
2023-10-16 11:08:37 +02:00
Jeffrey Smith
c55fb3329f
Fixed newline format detection for files not ending with a newline (#2875)
* 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
2023-10-16 11:03:03 +02:00
John Veness
c27593c163
Fix typos in README (#2919) 2023-10-16 10:48:22 +02:00
maddes8cht
fe89df1d4e
fix: recognize .cmd as batch files (#2922) 2023-10-16 10:47:44 +02:00
Mikko
9b81589fba
help: fix incorrect instructions for disabling key binding (#2943) 2023-10-16 10:46:01 +02:00
Dmitry Maluka
dc6a275e04
Fix non-working lua Lock (#2945)
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
2023-10-16 10:45:37 +02:00
Jöran Karl
db5fcf11a9
save: Restore the screen before overwriteFile() is left (#2967)
...otherwise there is no screen anymore to draw a possible error message.
2023-10-16 10:44:35 +02:00
Dmitry Maluka
db6d4f5461
save: Restore the screen if failed to start sudo (#2971)
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.
2023-10-16 10:44:05 +02:00
Jöran Karl
1231d24279
syntax: Fix include of patch in git-commit (#2917) 2023-09-14 13:26:51 -07:00
Alexander Wilms
d8abfd3999
Improve metainfo file (#2910) 2023-09-09 19:17:37 -07:00
Dmitry Maluka
9fabffc880
Fix issues with handling invalid regex in syntax files (#2913)
* 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.
2023-09-09 19:17:23 -07:00
Zachary Yedidia
630b3229ee Fix term output capturing
Fixes #2912
2023-09-08 23:27:39 -07:00
Zachary Yedidia
fbce241753 Docs for fakecursor option
Fixes #2908
2023-09-07 08:17:12 -04:00
Zachary Yedidia
ffc7118af0 Reset snapcraft to standard config 2023-09-06 17:02:29 -04:00
Zachary Yedidia
1ab390e1a2 Set snap grade/version to allow release 2023-09-06 16:50:04 -04:00
Zachary Yedidia
909c1a2dda Update snapcraft 2023-09-06 16:31:21 -04:00
Zachary Yedidia
c2cebaa3d1 Bump tcell for windows update 2023-09-02 13:32:09 +01:00
taconi
75b9a6cefe
Add onSetActive callback (#2885)
Co-authored-by: taconi <igor.tacoi@protonmail.com>
2023-08-31 17:29:07 +01:00
Nobleman
1cbe1441aa
Update micro.desktop (#2864)
Add `NoDisplay=true` to avoid showing up in applications menu
2023-08-31 17:26:19 +01:00
Zachary Yedidia
d0f0b95e45 Fix for capturing internal terminal pty output
Fixes #2879
2023-08-31 07:11:00 -07:00
Jöran Karl
a78c2c3509
actions: Fix the iteration over a slice under modification in QuitAll() (#2898) 2023-08-31 12:53:33 +01:00
Jöran Karl
ceaa143c62
highlighter: Fix regions and patterns inside regions (#2840)
* 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
2023-07-11 13:49:12 -07:00
rilysh
cb260bf6bf
add new types for zig (#2861) 2023-07-10 23:11:07 -07:00
Mathias Lohne
0c28fbf7a5
Add support for Jenkinsfile syntax (#2750)
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.
2023-07-08 14:08:34 -07:00
Jan Katins
b02afb1116
Update copypaste.md (#2826)
Status page: https://wezfurlong.org/wezterm/escape-sequences.html#operating-system-command-sequences

Status at 20230521:

> Requests to query the clipboard are ignored. Allows setting or clearing the clipboard

Issue to support querying: https://github.com/wez/wezterm/issues/2050
2023-07-08 14:08:15 -07:00
Jöran Karl
e5bbeff8ac
plugins.md: Add (on|pre)Rune documentation (#2837) 2023-07-08 14:07:56 -07:00
William Etheredge
7e64a43af6
Treat Containerfiles as Dockerfiles (#2846)
Containerfiles should be fully compatible with Dockerfiles:
https://github.com/containers/buildah/discussions/3170
2023-07-08 14:07:19 -07:00
Shreyas A S
51022e6162
Fixed a typo in keybindings.md (#2852)
A 'to' was missing. I noticed it while reading through the documentation.
2023-07-08 14:07:06 -07:00
Zachary Yedidia
5cb9d5eaaf Resolve merge conflict with scrollbarchar 2023-07-08 14:06:41 -07:00
Christian Muehlhaeuser
ffa7f987b6
Add 'scrollbarchar' option (#2342)
This lets you specify a character that will get used for rendering the
scrollbar.

Co-authored-by: Zachary Yedidia <zyedidia@gmail.com>
2023-07-08 14:02:01 -07:00
Dmitry Maluka
9593c2a720
Add HistorySearchUp and HistorySearchDown actions (#1829)
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.
2023-07-08 14:00:22 -07:00
guangwu
d7c8daad0d
chore: os.SEEK_CUR os.SEEK_END os.SEEK_SET has been deprecated since Go 1.7 (#2856) 2023-07-04 12:13:41 -07:00
Jöran Karl
0859f4aa36
Fix: Syntax highlighting for various issues (#2810)
* 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
2023-06-05 17:39:12 -07:00
Jöran Karl
c46467b5b9
plugins: Add capability to dis-/enable them per buffer (#2836) 2023-06-05 17:38:33 -07:00
rfjakob
1b4f6ecb12
save: fsync data safely to disk (#2681)
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().
2023-05-25 22:21:19 -07:00
Emily Grace Seville
fa468cac5f
Add config JSON schema (#2697)
* Add config JSON schema:
- moved from SchemaStore here

* feat(schema): move to data/
2023-05-16 22:16:17 -07:00
Runar
ff1107bc5b
Filled µ with white for consistency (#2811) 2023-04-30 12:06:47 -07:00
Ilya Grigoriev
651a30105b
Goto next/previous diff commands + minor cleanups (#2759)
* 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
2023-04-20 15:23:35 -07:00
Therk
9cef21ecd6
fixed tex comment detection at start of line (#2764) 2023-04-20 15:21:59 -07:00
blt__
61c90b27ab
Add type="desktop-application" into appdata component (#2803)
* Add type="desktop-application" into appdata component

* Add tags necessary for the desktop-application component
2023-04-20 15:20:24 -07:00
blt__
27ed176a22
Fix the appdata (#2796)
It had a dot at the end of <caption> which angered 'upstram-util validate'
2023-04-13 14:21:09 -07:00
blt__
04d30ebced
Fix appdata file (#2793)
* 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
2023-04-08 00:10:43 -07:00
blt__
d5f6b626d2
Fix com.github.zyedidia.micro.metainfo.xml (#2792)
It had some invisible characters
2023-04-06 17:05:53 -07:00
Zachary Yedidia
5739daffc8 Exit application if input terminal has closed
Bump tcell to get access to event error information, and to propagate
input EOF errors as event errors.

Fixes #2569
Fixes #2148
2023-03-20 16:17:43 -04:00
Arnaud Vallette d'Osia
9c2ce486a5
Hare (harelang) syntax (#2776) 2023-03-16 13:26:33 -07:00
Zachary Yedidia
7bef54856c Replace zyedidia/pty with upstream creack/pty
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
2023-03-15 13:14:33 -07:00