Compare commits

...

7 Commits

Author SHA1 Message Date
Oktay Imanzade 2d7c826d03
Merge branch 'jarun:master' into master 2024-04-12 16:06:21 +04:00
Arun ad04944bdf
Merge pull request #1865 from flipflop133/patch-1
preview-tui: add svg support
2024-04-08 18:04:00 +05:30
François Bechet 133c0d329b preview-tui: add full svg support 2024-04-08 13:55:21 +02:00
Arun 5853ac8e48
Merge pull request #1864 from horrad/master
Fix file creation on OpenBSD
2024-04-05 23:31:08 +05:30
Martin Ziemer 28d993a8e8 Fix file creation on OpenBSD
On OpenBSD at least one of O_RDONLY, O_WRONLY or O_RDWR is needed to open a file.

In creating a new file none of those is set, which leads to an EINVAL error ("invalid argument").

Since the new file is only created and never read, I chose to use O_WRONLY.
2024-04-04 15:57:36 +02:00
Arun 22aa1455a6
Merge pull request #1861 from KlzXS/makefile_icons
Prevent multiple icons options being selected at the same time
2024-03-30 01:33:20 +05:30
KlzXS 7806d5d371
Prevent multiple icons options being selected at the same time 2024-03-28 18:20:21 +01:00
3 changed files with 22 additions and 3 deletions

View File

@ -36,6 +36,8 @@ O_GITSTATUS := 0 # add git status to detail view
O_NAMEFIRST := 0 # print file name first, add uid and guid to detail view
O_RESTOREPREVIEW := 0 # add preview pipe to close and restore preview pane
T_ICONS := 0 # test if multiple icons options are set and fail
# convert targets to flags for backwards compatibility
ifneq ($(filter debug,$(MAKECMDGOALS)),)
O_DEBUG := 1
@ -97,16 +99,28 @@ endif
ifeq ($(strip $(O_ICONS)),1)
ICONS_INCLUDE = icons-generated-icons-in-term.h
CPPFLAGS += -DICONS_IN_TERM -DICONS_INCLUDE=\"$(ICONS_INCLUDE)\"
ifeq ($(strip $(T_ICONS)),1)
$(error Choose only one system for icons (O_ICONS, O_NERD or O_EMOJI))
endif
T_ICONS := 1
endif
ifeq ($(strip $(O_NERD)),1)
ICONS_INCLUDE = icons-generated-nerd.h
CPPFLAGS += -DNERD -DICONS_INCLUDE=\"$(ICONS_INCLUDE)\"
ifeq ($(strip $(T_ICONS)),1)
$(error Choose only one system for icons (O_ICONS, O_NERD or O_EMOJI))
endif
T_ICONS := 1
endif
ifeq ($(strip $(O_EMOJI)),1)
ICONS_INCLUDE = icons-generated-emoji.h
CPPFLAGS += -DEMOJI -DICONS_INCLUDE=\"$(ICONS_INCLUDE)\"
ifeq ($(strip $(T_ICONS)),1)
$(error Choose only one system for icons (O_ICONS, O_NERD or O_EMOJI))
endif
T_ICONS := 1
endif
ifeq ($(strip $(O_QSORT)),1)

View File

@ -44,6 +44,7 @@
# - optional: pistol file viewer (https://github.com/doronbehar/pistol).
# 1. install pistol
# 2. set/export $NNN_PISTOL as 1
# - optional: librsvg for rsvg-convert
#
# Usage:
# You need to set a NNN_FIFO path and a key for the plugin with NNN_PLUG,
@ -94,7 +95,7 @@
# 'no_focus [title="preview-tui"]' to your i3 config file.
#
# Shell: Bash (for environment manipulation through arrays)
# Authors: Todd Yamakawa, Léo Villeveygoux, @Recidiviste, Mario Ortiz Manero, Luuk van Baal, @WanderLanz
# Authors: Todd Yamakawa, Léo Villeveygoux, @Recidiviste, Mario Ortiz Manero, Luuk van Baal, @WanderLanz, @flipflop133
# Configurable environment variables:
NNN_SPLIT=${NNN_SPLIT:-} # permanent split direction
@ -416,7 +417,9 @@ generate_preview() {
else
image_preview "$1" "$2" "$3" && return
fi ;;
image) if exists convert; then
image) if exists rsvg-convert && [[ "${3##*.}" == "svg" ]]; then
rsvg-convert -a -w "$NNN_PREVIEWWIDTH" -h "$NNN_PREVIEWHEIGHT" -f png -o "$NNN_PREVIEWDIR/$3.png" "$3"
elif exists convert; then
convert "$3" -flatten -resize "$NNN_PREVIEWWIDTH"x"$NNN_PREVIEWHEIGHT"\> "$NNN_PREVIEWDIR/$3.jpg"
else
image_preview "$1" "$2" "$3" && return
@ -431,6 +434,8 @@ generate_preview() {
fi
if [ -f "$NNN_PREVIEWDIR/$3.jpg" ]; then
image_preview "$1" "$2" "$NNN_PREVIEWDIR/$3.jpg"
elif [[ "${3##*.}" == "svg" ]] && [ -f "$NNN_PREVIEWDIR/$3.png" ]; then
image_preview "$1" "$2" "$NNN_PREVIEWDIR/$3.png"
else
fifo_pager print_bin_info "$3"
fi

View File

@ -4732,7 +4732,7 @@ next:
return FALSE;
}
} else {
int fd = open(path, O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR); /* Forced create mode for files */
int fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR); /* Forced create mode for files */
if (fd == -1 && errno != EEXIST) {
DPRINTF_S("open!");