- Refactor of the completion module, primarily to have the `match...` functions return the result for each possible match, so that they can be displayed when the user cycles through the completions using `cmd-menu-complete`/`cmd-menu-complete-back`
- Add support for completing list options (e.g. `set info user:group:size:time`)
- Provide different implementations for escaping/unescaping for `lfrc` command syntax, Unix and Windows. It is a bit hacky, but for now I want to keep `lf` as shell-agnostic as possible which means minimizing the logic based on `gOpts.shell`
- Fix alignment bug in the completion menu when displaying filenames with fullwidth characters
* Add `filtermethod` and `searchmethod` options
* Rename `re` to `regex`
* Remove `globfilter` and `globsearch` options
* Add completions for `filtermethod` and `searchmethod`
* Update documentation
* Remove unnecessary if statement
* Fix unrelated typo
* Put options in alphabetical order
* Fix typo in documentation
* Rename variable for consistency
---------
Co-authored-by: Joe Lim <50560759+joelim-work@users.noreply.github.com>
- Add functionality for visually selecting files
- Add keymap for Visual mode, and supporting `nmap` and `vmap` commands
- Add mode column for `maps` command, also add `nmaps` and `vmaps` commands
- Add `visualfmt` option for configuring appearance for the visual selection
- Add `%m/%M` placeholders for displaying the mode
- Add marker indicating the number of visually selected files in the ruler
- Add `visual` as an identifier when exporting `lf_mode`
- Remove experimental `invert-below` command
* Implement recv mechanism
* Implement recv commands
* Add mutex for state data structure
* Use string to store data instead of byte buffer
* Remove runPagerOn function
* Add history command
* Add documentation
* Add default `maps` command
* Add default `cmds` command
* Reduce locking time
* Remove empty line
* Fix documentation for `recv`
* Add comment about `recv` thread
* Change `recv` to `query`
* Fix comment
* test
* Add comment about connection lifetime
* Map `cmaps` by default
* add `cmd-delete-word-back`
Implementation of zsh-like backwards word deletion.
* add unixwords option and evaluate, short description in doc
* remove unixwords configuration option
* remove yank, bind delete word back to alt-backspace, update docs
* minor changes to docs
* small fixes
* add 'setlocal' for option 'sortby'
* save each local option separately
* add 'setlocal' for option 'reverse'
* add 'setlocal' for option 'dirfirst'
* add 'setlocal' for option 'hidden'
* add 'setlocal' for option 'dironly'
* add 'setlocal' for option 'info'
* add boolean toggling for 'setlocal' options
* check if the path is absolute for 'setlocal'
* add 'setlocal' options to completion
* add tests for 'setlocal'
* add 'setlocal' to the documentation
* use trailing '/' in 'setlocal' for subdir matching
* cleanup
* add 'setlocal' subdirs to the documentation
* Sixel patch (#1)
* new struct type sixel
* add sixel detection logic in printReg
* new ShowSixels that prints sixels to the screen
* placeholder function UnshowSixels
* run `ui.ShowSixels` after `ui.screen.Sync`
* fix sixel placed on wrong coordinates
* change sixel termination sequence to prevent other escape sequence being run inside it
* process multi-line sixel sequence
* fixed bug where string before sixel image is not printed
* add sixelDimPx and pxToCells
* add getTermPixels for unix
* remove unused method UnshowSixels
* fix: remove unneeded ShowSixels
* add new fields sixel.wPx,hPx and reg.sixels
* modify sixel processing logic
detecting sixels in preview script now fills corresponding area with braille blank `\u2800` and saves sixel to reg.sixels
* modify sixel processing logic
printReg doesn't process sixels directly anymore
* reset sixels buffer at the start of `draw`
* rename `ui.ShowSixels` to `showSixels`
* add constants `gSixelBegin` and `gSixelTerminate`
* add check to prevent arbitrary escape code being passed to stdin
* fix cursor out of place in command line mode
* fix bug where sixel in drawn at old location after horizontal resize
* add ui.wPx and ui.hPx
* buffer sixel sequences before printing
* add check for valid terminal size(px) before previewing sixel
* clean up
* placeholder function getTermPixels for windows
* function sixelDimPx now considers image size given in the optional raster attributes field
* change sixel image alignment to emulate behavior of a terminal
- images used to always draw on a new line
- images is now placed where it starts:
```
printf 'abc <sixel sequence> xyz'
```
would result in:
```
abc +------+
| img |
| here |
+------+
xyz
```
old behavior:
```
abc
+------+
| img |
| here |
+------+
xyz
```
* fix bug where raster attributes are wrongly parsed in sixelDimPx
* prevent drawing sixels while menu is active
* introduce sixelScreen struct and refactor screen width,height in px to use new struct
* fix prevent nested sixel sequences
* fix bug where rejected sixels cause indexing error
* add "alternating filler" to trick tcell into redrawing when switching between different images
* fix filler string wrongly indented
* add comment
* replace pxToCells() with sixelScreen.pxToCells()
* add trim sixel height during preview
* add tests for trimSixelHeight
* prevent sixel redrawing during input prompts
* change sixel filler to braille space
* clean up
* use strings.Index instead of regex for simple search
* fix comment
* refactor: remove nested if-block
* refactor: move sixel related stuff into sixel.go
* remove unused function
* allow long lines from previewer
* rework preview to accept only single-line sixels
- multi-line support removed for simplicity in the code base
* add new option `sixel`
* add eval logic and completion of `sixel` option
* doc: new option 'sixel'
* refactor: use newSixelScreen() for init
* fix bug where image is not always cleared
* refactor: separate sixel tests
* improved error handling
* rename & comments for clarity
* refactor: renderPreviewLine should not use gOpts
* rename for clarity
* fix: filler style changed more than needed
The filler style now only changes when the file in preview is changed
* rename
* fix: forgot to rename this
* increase max line size
* remove unneeded reassignment
* fix position of multiple sixel on same line
* refactor: extract code into function
* update docs
* reorder variable
* remove unneeded var
* avoid unneeded ioctl calls
* fixup! fix typo
* rework/simplify previewing sixels
Remove support for multiple sixels on the same line, and the line must start with 'ESC P' to be considered a sixel.
* separate sixel detection logic from text scanning
* rework: stricter sixel validation and remove trimming
* revert unneeded changes
* strip validation logic
* refactor: use singular sixel instead of slice
multiple sixel preview is no longer supported
* fix: bug where first 2 char of non-sixel is missing
* docs: fix wrong option type
* set sixelScreen.wpx, hpx to 0 on error
* remove terminal px size
* fix: bug where quitting might leave terminal in bold
cleanup
* update docs
* remove unneeded sixel type
* cleanup unused func argument
* cleanup unneeded function
* refactor: more readable
Co-authored-by: Joe Lim <50560759+joelim-work@users.noreply.github.com>
* cleanup unneeded var
* cleanup unneeded constructor
* cleanup unused func arg
---------
Co-authored-by: Joe Lim <50560759+joelim-work@users.noreply.github.com>
* allow flexible truncation of filenames
As of now, lf truncates always at the end. So for long filenames one can
not see the end (especially not the file ending, like .jpeg or .pdf).
[MidnightCommander](https://github.com/MidnightCommander/mc/) truncates
too long filenames in the middle, so it's possible to see the beginning
and the end of the too long filename.
This commit allows to specify a flexible point for the truncation in
percent of the available space.
* The default value of 100 for the new `truncatepct` option means no
change in lf behaviour.
* More adhering to naming convention.
* Improve error message for invalid `truncatepct` values.
* Remove redundant test cases.
* FIXUP Add dummy empty line to make `go fmt` happy.
* Avoid explicit "cast" to rune array.
* fix(doc.go): remove line with single dot
This was there to avoid that `go fmt` touches the next item with `waitmsg`.
However, removing the spaces before the example list items has the same
effect.
* Add `fileinfofmt` option
* echof is now unused
* Use different default for Windows
* Add new line to docs
* Indent placeholders description in documentation
* Change option name to `statfmt`
* Use plain text format for documentation
This is a natural complement to the recently introduces `maps` and `cmaps`.
I considered using a different output format, since `cmd` definitions can be
long, but I decided against it for now. `lf` already abbreviates commands that
take up several lines, and we can change the output format later if needed.
* make it possible to preserve mtime and atime when copying files
Preserving other attributes like ownership, ctime or btime of a file is
desired but currently not possible to implement in a portable way with go.
Fixes#869
Relates to #779
* FIXUP use cp-compatible default for not-preserving mode
* Make `:maps` work on Windows
This makes the `:maps` command from #1146 work on Windows.
This (as well as `:maps` itself) is based on @jackielli's work in #1146 and
#1152.
I intend to refactor the code in this or a separate PR, but I thought I'd
submit the critical and simple bit first.
* Add `:cmaps` command
After the naming scheme from #1146, it would seem weird to not have a :cmaps
command. This could help with issues like #876.
* Replace functions from `ioutil` with same functions from `io`
This is demanded by staticcheck if we upgrade the go version in go.mod.
* Replace ioutil.ReadDir with os.ReadDir
* Update Go version to 1.18 in go.mod
This requires abandoning use of the `ioutil` module (see parent commits)
to pass `staticcheck`.
This command inverts the selection for the current file and all the files below
it. Using this command twice substitutes for having a "visual" mode. This is
described in more detail in the docs and in
https://github.com/gokcehan/lf/issues/477#issuecomment-1414563834.
Fixes#477. While that's not exactly what was asked for, I hope it's a suitable
replacement and seems more in the spirit of `lf`, at least until a better
replacement is implemented.
* Add `cursorparentfmt` option for cursors in parent dirs
The option defaults to the same value as `cursorfmt`, so the default look of `lf` is unchanged. However, I find it useful to make it different, since I seem to have so much trouble figuring out which of my cursors is the active one. :)
For example, here's what it looks like if one has `set cursorparentfmt "\033[7;90m"` in their `lfrc`:
https://user-images.githubusercontent.com/4123047/218299130-09ac411f-307a-489e-a4f0-4691710f8549.png
* Remove `cursorfmt` option to `cursoractivefmt`
This seems appropriate after introducing `cursorparentfmt`
* Allow separate styles for cursor in normal and preview panes
This defines new `cursorfmt` and `crusorpreviewfmt` options to style cursor in normal/preview panes. This allows using a different style for the normal and preview cursor. The documentation includes several possible values these options can be set to.
The default behavior is an underline, same as in
https://github.com/gokcehan/lf/pull/1072, since it should not cause severe
problems and be visible on all terminals. It can now be easily changed, as explained in the docs. I also added an example to `etc/lfrc.example`.
See linked issues and PRs for the more context.
Fixes https://github.com/gokcehan/lf/issues/1038
Follows up on:
https://github.com/gokcehan/lf/pull/1072https://github.com/gokcehan/lf/pull/924https://github.com/gokcehan/lf/commit/b47cf6d5a5
* Simplify configuration of several formatting options
This simplifies the configuration of `cursorfmt`, `cursorpreviewfmt`, `tagfmt`,
and `errorfmt` options.
In almost all usecases, the value of these options had to end with `%s\033[0m`
to print the contents of filename/tag/error and reset the terminal style. Now,
if `%s` is not part of the option's value, `%s\033[0m` is appended
automatically. This simplifies configuration.
I retained the same behavior as before when `%s` is part of the string for
backwards compatibility. I think it should be considered deprecated, but it
also causes no harm.
* Revert escaping changes from cb7aa13
The changes introduced a bug where escapes were removed when there are
no completion matches.
* Add option to ignore case in filename completion
* Remove compignorecase option and hardcode it
* Directory previews, initial implementation.
* Continue previous; add goroutine for directory previews.
* Enable dirpreviews as an option, run gofmt and fix referencing nil.
* Only use dirpreviews if previewer script exists.
* Remove redundant function call to `dirPreview`.
* Remove unnecessary dev-comments.
* Send to `dirPreviewChan` also on modifying folder contents.