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
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
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
matthias314
5a62a8ead4
match beginning and end of line correctly in FindNext and ReplaceRegex ( #3575 )
2025-02-09 15:19:43 +01:00
Jöran Karl
e4b0ad7107
Merge pull request #3620 from JoeKar/feature/cursor-overwrite-indicator
...
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
Jöran Karl
5ee7fb6014
Merge pull request #3576 from niten94/optmd-quote-sort
...
`options.md`: Add, sort entries and adjust formatting
2025-01-29 17:13:53 +01:00
niten94
7aa72b6a96
Sort options in settings.go
2025-01-29 16:06:35 +08:00
Neko Box Coder
dc18642985
Add missing resize in TabMove ( #3619 )
2025-01-28 21:04:05 +01:00
yz778
c02036e52f
Prompt to save or discard new files even with autosave enabled ( #3626 )
2025-01-25 20:24:31 +01:00
Neko Box Coder
698511c5b6
Fixing settings not being applied when saving as a new file ( #3625 )
2025-01-24 18:44:27 +01:00
Jöran Karl
c61670e86f
buffer: Store the overwrite mode
2025-01-22 17:12:50 +01:00
matthias314
f5debdf8fe
ignore quoted and escaped characters when splitting keybindings into actions ( #3612 )
2025-01-20 20:28:38 +01:00
Jöran Karl
f49487dc3a
import: Use micro-editor/terminal instead of zyedidia/terminal ( #3600 )
2025-01-14 18:20:37 +01:00
Jöran Karl
2ddf461ad8
import: Use micro-editor/json5 instead of zyedidia/json5
2025-01-04 16:01:20 +01:00
Jöran Karl
6600430e88
import: Use micro-editor/tcell (legacy) instead of zyedidia/tcell ( #3593 )
2025-01-04 15:55:46 +01:00
Jöran Karl
415ceee46b
plugin: Add new onBufferOptionChanged callback
...
This can become handy in the moment a plugin needs to react on e.g. changed
file type.
2024-12-31 13:27:35 +01:00
matthias314
2898f1590d
made FindNext and FindPrevious work with empty matches ( #3572 )
2024-12-17 18:52:44 +01:00
matthias314
aa0fefcaa1
skip empty match right after previous match in ReplaceCmd ( #3566 )
2024-12-17 18:44:48 +01:00
matthias314
8cdf68bbf6
skip save dialog on quit if buffer is shared ( #3559 )
2024-12-09 19:42:19 +01:00
Jöran Karl
fb20818042
Merge pull request #3540 from JoeKar/fix/cursor-down
...
actions: Perform `Cursor(Page)Down` with selection like GUI editors do
2024-12-04 21:23:40 +01:00
Dmytro Maluka
71a26381c0
Fix unwanted view adjustment after page down ( #3555 )
...
Fix regression introduced while implementing nano-like page up/down in
commit b2dbcb3e : if the view is already at the end of the buffer and
the last line is even above the bottom, i.e. there are some empty
lines displayed below the last line (e.g. if we have scrolled past the
last line via the mouse wheel), pressing PageDown not just moves the
cursor to the last line but also unexpectedly adjusts the view so that
the last line is exactly at the bottom.
2024-12-03 21:07:30 +01:00
Jöran Karl
2c4754d484
actions: Prevent additional cursor move down on Cursor(Page)Down
...
This is needed to not move two lines below the last visual selection when it
has end behind the new line character.
2024-12-03 20:38:34 +01:00
matthias314
831e31d483
avoid creating nil callback for JobSpawn ( #3554 )
2024-12-02 21:21:29 +01:00
Jöran Karl
50639015d7
cursor: Remove selection reduction by one character on Deselect()
2024-11-30 15:25:14 +01:00
Jöran Karl
aaf45a871f
bufwindow: Don't highlight lines in ruler with active selection
2024-11-26 20:30:43 +01:00
Jöran Karl
3a16197da7
actions: On Cursor(Page)Down with selection of newline place cursor to start
2024-11-26 20:12:43 +01:00
Oleksandr Redko
b881bf5606
Remove unused internal or unexported functions ( #3481 )
2024-11-16 21:19:37 +01:00
Nimish Jha
b2dbcb3eab
implement nano-like page up/page down functionality
2024-10-29 10:22:35 +11:00
Nimish Jha
eb880d8841
simplify code
2024-10-27 16:22:53 +11:00
Dmytro Maluka
1ead9ce4fd
Fix regression in CopyLine, CutLine, DeleteLine for last line ( #3519 )
...
Fix regression introduced in commit fdacb28962 ("CopyLine, CutLine,
DeleteLine: respect selection"): when CopyLine, CutLine or DeleteLine is
done in the last line of the buffer and this line is not empty, this
line gets selected but does not get copied/cut/deleted (and worse, it
remains selected).
2024-10-24 18:01:45 +02:00
Nimish Jha
b3227d6049
add actions: CursorToViewTop, CursorToViewCenter, CursorToViewBottom ( #3506 )
2024-10-23 07:25:33 +02:00
Dmytro Maluka
8c0e0fa2ed
Make textfilter work with multicursors ( #3511 )
...
As requested in [1] and [2], change the `textfilter` command behavior to
apply the filter to the selections of all cursors, not just the 1st one.
[1] https://github.com/zyedidia/micro/discussions/3505
[2] https://github.com/zyedidia/micro/discussions/3510
2024-10-20 21:27:19 +02:00