* 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>
* Added autocompletion and a simple lfcd script for nushell.
* nu-lfcd script & small style improvements. Moved the autocompletion to a seperate file.
* Update lfcd.nu to print to stderr instead of stdout
* Fixed the comments inside lf.nu
* Improve windows shell handling
* Add shell in command line
* Fix shellopts bug
* Add quote string
* Refactor `exportFiles` function
* Add defaults for Windows
* Revert "Add defaults for Windows"
Accidental commit
This reverts commit 5ff32650fe.
* Separate handling for CMD vs PowerShell
* Add case insensitive check
* Create CI job to run `gen/xbuild.sh`, adjust `xbuild.sh` to make it possible
This reworks the gen/xbuild.sh script to exit with a failure if any of the targets don't compile. It also adds a CI job to try cross-compiling for every platform on every pull request.
The new check is a little slow and compute-expensive, but I am hoping it's well within the quota.
See #1299 for a demo of how the CI would have failed after #1288 and before #1295.
Screenshot: https://github.com/gokcehan/lf/assets/4123047/3d7a6b7c-8642-4d4c-a98a-c8b886c0b184
Thanks to @joelim-work for numerous improvements and an alternate
implementation I heavily borrowed from
(https://github.com/joelim-work/lf/blob/ci/gen/xbuild.sh)
* Refactor xbuild.sh some more to decrease repetition
I can remove this commit if people prefer.
* Generate darwin-arm64 binaries as we have users using it
Arm Macs are becoming popular. We have at least one
user: https://github.com/gokcehan/lf/issues/1294. It
seems lf works fine there.
* 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.
* Add support for displaying lf options in the ruler
* Print escape character as plain text
* Document user defined options
* Change escape rules
* Use reflect instead of environment table
* Factor out common option map logic
* Improve error message slightly
* Display blank option values
* 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