Commit Graph
1179 Commits
Author SHA1 Message Date
dependabot[bot] 7bd5756330 Bump golang.org/x/sys from 0.14.0 to 0.15.0 (#1510)
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.14.0 to 0.15.0.
- [Commits](https://github.com/golang/sys/compare/v0.14.0...v0.15.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-28 17:33:03 +11:00
Gökçehan Kara 9698ecddf1 use markdown for the documentation (#1474)
* add doc.md

* use h2 for doc sections

* use h3 for doc commands/options/vars

* use backticks instead of quotes in the doc

* merge multiple commands/options in the doc

* change header levels in the doc

* add man page sections to the doc

* remove extra spaces in headers in the doc

* add man and plain conversions of the doc

* update doc

* add missing flags to the doc

* replace the old documentation with the new one

* remove old doc files

* remove the doc instructions from CONTRIBUTING.md

* change the links to the doc

* shorten long links in the readme
2023-11-12 15:43:06 +01:00
Alexander LunegovandJoe Lim ade9e986e5 Use -print-last-dir option for lfcd.ps1 (#1491)
* Use `-print-last-dir` option for `lfcd.ps1`

* chore(etc/lfcd.ps1): use `Set-Location` instead of `cd`

Co-authored-by: Joe Lim <50560759+joelim-work@users.noreply.github.com>

---------

Co-authored-by: Joe Lim <50560759+joelim-work@users.noreply.github.com>
2023-11-08 23:16:01 +11:00
dependabot[bot] ae678f7102 Bump golang.org/x/term from 0.13.0 to 0.14.0 (#1492)
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.13.0 to 0.14.0.
- [Commits](https://github.com/golang/term/compare/v0.13.0...v0.14.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-08 18:00:04 +11:00
dependabot[bot] f6e7d0fd0e Bump golang.org/x/sys from 0.13.0 to 0.14.0 (#1486)
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.13.0 to 0.14.0.
- [Commits](https://github.com/golang/sys/compare/v0.13.0...v0.14.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-06 14:12:15 +11:00
Joe Lim dcd2ea8164 Preserve attributes when moving across devices (#1482) 2023-11-06 13:57:11 +11:00
Joe Lim f52fffbff6 Force sync when writing to cut/copy buffer file (#1480) 2023-10-30 09:40:39 +11:00
Joe Lim b3cb2dc2b4 Add on-redraw hook command (#1479)
* Add `on-redraw` hook command

* Add documentation
2023-10-30 09:40:24 +11:00
Joe Lim 7c23c27c59 Refactor sixel peek in previewer code (#1477) 2023-10-30 09:40:02 +11:00
dependabot[bot] 838fee6f13 Bump github.com/djherbis/times from 1.5.0 to 1.6.0 (#1478)
Bumps [github.com/djherbis/times](https://github.com/djherbis/times) from 1.5.0 to 1.6.0.
- [Release notes](https://github.com/djherbis/times/releases)
- [Commits](https://github.com/djherbis/times/compare/v1.5.0...v1.6.0)

---
updated-dependencies:
- dependency-name: github.com/djherbis/times
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-29 19:55:30 +01:00
Joe Lim b420dee145 Fix detection of character vs block devices (#1469) 2023-10-22 21:42:12 +02:00
Joe Lim 9ab2c2ec6f Print sixel data to stderr instead of stdout (#1451) 2023-10-22 21:06:19 +02:00
Abderrahmane TAHRI JOUTI 1a3bcb28a1 Use -print-last-dir option for lfcd.cmd (#1444)
* exit lf not the cmd

* exit successfully

* use -print-last-dir
2023-10-22 20:43:03 +02:00
Joe Lim 154d7182c0 Fix preview for files containing long lines (#1447)
* Fix preview for files containing long lines

* Limit lines read to preview window height

* Refactor

* Make comment more clear
2023-10-22 20:37:40 +02:00
Ching Pei Yang b4af8f47c8 doc: Add comments about sixel filler (#1443) 2023-10-22 20:33:19 +02:00
dependabot[bot] beedda2d67 Bump golang.org/x/term from 0.12.0 to 0.13.0 (#1461)
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.12.0 to 0.13.0.
- [Commits](https://github.com/golang/term/compare/v0.12.0...v0.13.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-06 15:12:47 +11:00
Joe Lim dddf437c42 Add spaces to rulerfmt to separate from statinfo (#1437) 2023-09-23 11:32:19 +10:00
Gokcehan c8163439f5 move contributing guide to the repo r31 2023-09-17 14:40:38 +03:00
veltza 6c54b8870c Fix sixel filler character (#1422)
The sixel implementation uses the Braille pattern blank character
(U+2800) as a filler character, which is problematic because U+2800
is not a proper Unicode whitespace character. This fix changes the
filler character to a proper Unicode whitespace character U+2000.

Quote from https://en.wikipedia.org/wiki/Whitespace_character:
"The Braille Patterns Unicode block contains U+2800 BRAILLE PATTERN
BLANK, a Braille pattern with no dots raised. Some fonts display the
character as a fixed-width blank, however the Unicode standard
explicitly states that it does not act as a space."
2023-09-16 16:15:13 +03:00
raslop ffc756c5ff Export user-options on change (#1418)
* Export user-options when they are evaluated

If one has an external previewer that uses an lf user-option (e.g.
"preview-mode") and some key-kindings that change this user-option (e.g.
to "hex", "simple", "fancy") and send a "reload" command to lf, then the
expectation after pressing the keys is, that the prewiever is called
with an updated value of the user-option. Though this did not happen
since #1354, as this caused random crashes.

This change exports user-defined options immediately when they are
evaluated.

* Fix: Add explaining comment
2023-09-11 16:17:42 +03:00
Joe Lim 9068801831 Add query server command to expose internal state (#1384)
* 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
2023-09-08 18:52:19 +10:00
dependabot[bot] c56e319211 Bump actions/checkout from 3 to 4 (#1413)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-05 13:19:00 +10:00
dependabot[bot] a67e43ab66 Bump golang.org/x/term from 0.11.0 to 0.12.0 (#1412)
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.11.0 to 0.12.0.
- [Commits](https://github.com/golang/term/compare/v0.11.0...v0.12.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 15:22:41 +10:00
dependabot[bot] 072818982c Bump golang.org/x/sys from 0.11.0 to 0.12.0 (#1411)
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.11.0 to 0.12.0.
- [Commits](https://github.com/golang/sys/compare/v0.11.0...v0.12.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-04 15:11:18 +10:00
Gokcehan 1dd269ec42 cleanup 2023-09-03 20:05:46 +03:00
Gokcehan 764fbe65ef cleanup
cc #1409
2023-09-03 20:04:02 +03:00
Gokcehan 1a1537946c add yanking to 'cmd-delete-word[-back]' commands
cc #1409
2023-09-03 19:59:32 +03:00
Jan-Peter Dhallé 791dfff8dc Add cmd-delete-word-back command (#1409)
* 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
2023-09-03 19:52:07 +03:00
Joe Lim 439fb038e5 Add rulerfmt option for improved ruler customization (#1386)
* Implement basic rulerfmt mechanism

* Add deprecation warning for ruler option

* Implement basic placeholders

* Add placeholder for number of hidden files

* Implement placeholders for options

* Add documentation
2023-09-03 13:31:50 +10:00
Gökçehan Kara 8d013c9375 add 'setlocal' for directory specific options (#1381)
* 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
2023-09-02 22:22:56 +03:00
Joe Lim 990cea7e04 Display statfmt file size with fixed width (#1405) 2023-09-02 11:55:30 +10:00
Joe Lim 6aa3d2aa18 Add -print-last-dir and -print-selection flags (#1402)
* Add `-print-last-dir` and `-print-selection` flags

* Add shell completions

* Update `lfcd.sh` example to use new flag
2023-08-31 10:10:31 +10:00
Joe Lim 63d21b5a3e Allow lastdir/selection to be written to stdout (#1399)
* Allow lastdir/selection to be written to `stdout`

* Quick fix for runPagerOn
2023-08-28 11:30:16 +10:00
Jan Tatje e0abb29a00 List files even when lstat fails (#1382)
Implements a `fakeStat` struct with dummy values and stores the
error in `file.err`, then shows the error instead of FileInfo, if
the file is inaccesible.

Fixes #1359
2023-08-26 15:58:48 +03:00
Gokcehan a280b6c7d3 remove WIP notice from readme 2023-08-24 22:47:04 +03:00
sitiom 219ebe5c31 Change Winget Releaser job to ubuntu-latest (#1391) 2023-08-19 16:33:02 +03:00
Ching Pei Yang 59dd325439 fix: empty file previews as binary (#1387) 2023-08-14 11:20:48 +10:00
Ching Pei YangandJoe Lim dd8294952f sixel preview (#1211)
* 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>
2023-08-12 18:52:01 +03:00
dependabot[bot] b2f8673cb9 Bump golang.org/x/term from 0.10.0 to 0.11.0 (#1373)
Bumps [golang.org/x/term](https://github.com/golang/term) from 0.10.0 to 0.11.0.
- [Commits](https://github.com/golang/term/compare/v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: golang.org/x/term
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-07 18:08:33 +10:00
dependabot[bot] 687ac4b23c Bump golang.org/x/sys from 0.10.0 to 0.11.0 (#1372)
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.10.0 to 0.11.0.
- [Commits](https://github.com/golang/sys/compare/v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-07 18:02:30 +10:00
Joe Lim 1c52e3ad68 Wrap filenames in quotes only for Windows CMD (#1371) 2023-08-07 17:56:14 +10:00
Joe Lim b3ac207c34 Fix cursor location when printing statline (#1348)
* Fix cursor location when printing statline

* Reset style after shell output

* cleanup
2023-08-07 17:43:54 +10:00
Joe Lim 2620f492c2 Remove environment exports from preview thread (#1354) 2023-07-27 10:09:51 +10:00
dependabot[bot] 95b3613a68 Bump github.com/mattn/go-runewidth from 0.0.14 to 0.0.15 (#1351)
Bumps [github.com/mattn/go-runewidth](https://github.com/mattn/go-runewidth) from 0.0.14 to 0.0.15.
- [Commits](https://github.com/mattn/go-runewidth/compare/v0.0.14...v0.0.15)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-runewidth
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-24 22:00:17 +10:00
Jonáš Dujava 42c16f1882 Clean image preview on set preview! (#1350)
Properly clean (`ueberzug`) image preview when disabling it using
for example `set preview!`.

Also change "clearing" to "cleaning" in docs.
2023-07-22 14:24:35 +03:00
Joe Lim 23418adc00 Support optional fields for statfmt option (#1337)
* Support optional fields for `statfmt` option

* Add documentation

* Use special bytes for safety
2023-07-17 11:03:09 +10:00
Joe Lim 443838e06f Call load after shell-async commands (#1345) 2023-07-17 10:19:04 +10:00
mauerlaeufer 3c681c2fac Added autocompletion and a simple lfcd script for nushell. (#1341)
* 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
2023-07-16 18:30:35 +03:00
Joe Lim a3127a2dc3 Merge pull request #1335 from joelim-work/load-non-volatile
Prevent image preview flicker for `load` command
2023-07-12 08:54:36 +10:00
Joe Lim a7541390f3 Merge pull request #1336 from joelim-work/ci-badge
Add CI build badge
2023-07-12 08:54:19 +10:00