micro/internal/buffer
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
..
autocomplete.go Fix buffer.RuneAt (#1895) 2020-10-19 20:36:14 -04:00
backup.go Allow aborting while opening a file with backup 2021-08-02 21:05:22 -04:00
buffer.go Fix issues with handling invalid regex in syntax files (#2913) 2023-09-09 19:17:23 -07:00
buffer_generated_test.go Merge branch 'buffer-benchmarks' of https://github.com/p-e-w/micro into p-e-w-buffer-benchmarks 2020-05-20 15:28:36 -04:00
buffer_test.go Use CharacterCount over RuneCount 2020-05-20 16:47:08 -04:00
cursor.go Implement moving cursor up/down within a wrapped line 2021-04-08 23:54:02 +02:00
eventhandler.go plugins: Add capability to dis-/enable them per buffer (#2836) 2023-06-05 17:38:33 -07:00
line_array.go Support for highlighting all search matches (hlsearch) (#1762) 2021-09-28 13:39:03 -07:00
line_array_test.go Improve unicode line array test 2020-05-20 19:53:54 -04:00
loc.go Use CharacterCount over RuneCount 2020-05-20 16:47:08 -04:00
message.go Warn for readonly instead of setting option 2021-05-19 14:58:00 -04:00
save.go save: fsync data safely to disk (#2681) 2023-05-25 22:21:19 -07:00
search.go Improve comments 2021-08-21 17:58:30 -04:00
serialize.go Fix quality issues (#1856) 2020-09-16 00:08:01 -04:00
settings.go plugins: Add capability to dis-/enable them per buffer (#2836) 2023-06-05 17:38:33 -07:00
stack.go Change project layout and use go.mod 2019-12-25 17:05:10 -05:00
stack_test.go Change project layout and use go.mod 2019-12-25 17:05:10 -05:00