Merge branch 'master' into lenovo-y480

This commit is contained in:
2026-06-01 11:33:18 +08:00
16 changed files with 231 additions and 819 deletions

View File

@@ -15,7 +15,7 @@ URxvt.scrollWithBuffer: True
URxvt.saveLines: 1000000 URxvt.saveLines: 1000000
URxvt.font: \ URxvt.font: \
xft:Sarasa Mono SC:size=14,\ xft:Sarasa Term SC:size=14,\
xft:Operator Mono Book:size=14,\ xft:Operator Mono Book:size=14,\
xft:Source Code Pro:size=14,\ xft:Source Code Pro:size=14,\
xft:Microsoft Yahei:size=14,\ xft:Microsoft Yahei:size=14,\

View File

@@ -14,7 +14,7 @@ XTerm.termName: xterm-256color
XTerm*background: black XTerm*background: black
XTerm*foreground: white XTerm*foreground: white
XTerm*xftAntialias: true XTerm*xftAntialias: true
XTerm*faceName: xft:Sarasa Mono SC:antialias=True:autohint=True:size=14 XTerm*faceName: xft:Sarasa Term SC:antialias=True:autohint=True:size=14
XTerm*forceBoxChars: true XTerm*forceBoxChars: true
! Alt键设置 ! Alt键设置
@@ -36,5 +36,5 @@ XTerm*buffered: true
XTerm*multiScroll: true XTerm*multiScroll: true
XTerm*fastScroll: true XTerm*fastScroll: true
St.font: Sarasa Mono SC:size=14:antialias=true:autohint=true St.font: Sarasa Term SC:size=14:antialias=true:autohint=true
St.alpha: 85 St.alpha: 85

View File

@@ -30,6 +30,60 @@ generate-bash-completion() {
fi fi
} }
load-bash-completion() {
local silence=false
local -a files=()
while [[ $# -gt 0 ]]; do
case "$1" in
-s)
silence=true
shift
;;
--)
shift
files+=("$@")
break
;;
*)
files+=("$1")
shift
;;
esac
done
if [[ ${#files[@]} -eq 0 ]]; then
echo "usage: load-bash-completion [-s] <path1> [path2 ...]" >&2
echo "" >&2
echo " -s: if some completion file not exist, just skip it silently" >&2
echo "" >&2
echo "example: load-bash-completion pnpm npm" >&2
return 1
fi
local completion_dir="${HOME}/.local/share/bash-completion/completions"
for file in "${files[@]}"; do
local completion_file="$(realpath -m "${completion_dir}/${file}")"
if [[ ! -e "$completion_file" ]]; then
if [[ "$silence" == false ]]; then
echo "WARNING: cannot found completion file '${file}'" >&2
fi
continue
fi
if [[ ! -r "$completion_file" ]]; then
if [[ "$silence" == false ]]; then
echo "WARNING: cannot read completion file '$file'" >&2
fi
continue
fi
source "$completion_file"
done
}
add-to-path() { add-to-path() {
local silence=false local silence=false
local -a dirs=() local -a dirs=()

View File

@@ -0,0 +1,13 @@
basedir=$(realpath -m $(dirname "${BASH_SOURCE[0]:-$0}"))
source "${basedir}/function.bash"
unset basedir
if [[ -e "$(type -p llama-cli)" ]]; then
completion_file="llama-cpp"
generate-bash-completion "$completion_file" "llama-cli --completion-bash"
load-bash-completion -s "$completion_file"
unset completion_file
fi

View File

@@ -4,7 +4,7 @@ source "${basedir}/function.bash"
unset basedir unset basedir
export PNPM_HOME="${HOME}/.local/share/pnpm" export PNPM_HOME="${HOME}/.local/share/pnpm"
add-to-path -s $PNPM_HOME add-to-path -s "${PNPM_HOME}/bin"
if [[ -x "$(type -p pnpm)" ]]; then if [[ -x "$(type -p pnpm)" ]]; then
generate-bash-completion pnpm "pnpm completion bash" generate-bash-completion pnpm "pnpm completion bash"

View File

@@ -32,9 +32,7 @@ INPUT_DEVICES="libinput"
VIDEO_CARDS="amdgpu dummy fbdev intel nouveau radeon radeonsi vesa" VIDEO_CARDS="amdgpu dummy fbdev intel nouveau radeon radeonsi vesa"
GENTOO_MIRRORS=" GENTOO_MIRRORS="
https://mirrors.ustc.edu.cn/gentoo/
http://distfiles.gentoo.org/ http://distfiles.gentoo.org/
https://mirrors.tuna.tsinghua.edu.cn/gentoo/
" "
MAKEOPTS="-j4 ${MAKEOPTS}" MAKEOPTS="-j4 ${MAKEOPTS}"

View File

@@ -43,3 +43,9 @@ app-office/wps-office ~amd64
# rustup # rustup
dev-util/rustup ~amd64 dev-util/rustup ~amd64
# llama-cpp
sci-ml/llama-cpp **
# nvidia cuda toolkit
dev-util/nvidia-cuda-toolkit ~amd64

View File

@@ -6,8 +6,8 @@ app-office/wps-office WPS-EULA
dev-embedded/sdcc MicroChip-SDCC dev-embedded/sdcc MicroChip-SDCC
dev-db/mongodb SSPL-1 dev-db/mongodb SSPL-1
dev-libs/cudnn NVIDIA-cuDNN dev-libs/cudnn NVIDIA-cuDNN
dev-util/nvidia-cuda-toolkit NVIDIA-CUDA
dev-util/android-studio android dev-util/android-studio android
dev-util/nvidia-cuda-toolkit NVIDIA-CUDA
dev-util/pycharm-community JetBrains-business JSON dev-util/pycharm-community JetBrains-business JSON
dev-util/pycharm-professional JetBrains-business JSON dev-util/pycharm-professional JetBrains-business JSON
media-fonts/font-bh-ttf bh-luxi media-fonts/font-bh-ttf bh-luxi

View File

@@ -1,2 +1,3 @@
dev-lang/rust dev-lang/rust
net-proxy/shadowsocks-rust::gentoo-zh net-proxy/shadowsocks-rust::gentoo-zh
>=x11-drivers/nvidia-drivers-581

View File

@@ -4,6 +4,9 @@ net-misc/openssh libedit
sys-boot/grub mount sys-boot/grub mount
sys-libs/zlib minizip sys-libs/zlib minizip
# gcc
sys-devel/gcc lto pgo
# kernel # kernel
sys-kernel/installkernel dracut grub sys-kernel/installkernel dracut grub
@@ -15,9 +18,8 @@ x11-terms/rxvt-unicode 256-color blink fading-colors pixbuf unicode3
#www-servers/uwsgi cgi python #www-servers/uwsgi cgi python
# emacs # emacs
app-editors/emacs dynamic-loading -gtk gui gzip-el harfbuzz json libxml2 sound source sqlite tree-sitter wide-int app-editors/emacs cairo dynamic-loading gtk gui gzip-el harfbuzz json libxml2 sound source sqlite tree-sitter wide-int
app-emacs/emacs-common gui app-emacs/emacs-common gui
sys-devel/gcc jit
# p7zip # p7zip
app-arch/p7zip rar -wxwidgets app-arch/p7zip rar -wxwidgets
@@ -118,3 +120,10 @@ media-libs/freetype harfbuzz
# watchman # watchman
dev-cpp/glog gflags dev-cpp/glog gflags
# llama-cpp
sci-libs/openblas cpudetection
sci-ml/llama-cpp cuda flexiblas opencl rpc vulkan
# docker-compose dependencies
app-containers/docker-credential-helpers keyring

View File

@@ -1,703 +0,0 @@
diff -uraN st-0.8.5/autocomplete.h st-autocomplete/autocomplete.h
--- st-0.8.5/autocomplete.h 1970-01-01 04:00:00.000000000 +0400
+++ st-autocomplete/autocomplete.h 2022-03-13 02:45:34.586842452 +0400
@@ -0,0 +1,16 @@
+# ifndef __ST_AUTOCOMPLETE_H
+# define __ST_AUTOCOMPLETE_H
+
+enum {
+ ACMPL_DEACTIVATE,
+ ACMPL_WORD,
+ ACMPL_WWORD,
+ ACMPL_FUZZY_WORD,
+ ACMPL_FUZZY_WWORD,
+ ACMPL_FUZZY,
+ ACMPL_SUFFIX,
+ ACMPL_SURROUND,
+ ACMPL_UNDO,
+};
+
+# endif // __ST_AUTOCOMPLETE_H
diff -uraN st-0.8.5/config.def.h st-autocomplete/config.def.h
--- st-0.8.5/config.def.h 2022-03-13 02:45:34.586842452 +0400
+++ st-autocomplete/config.def.h 2022-03-13 02:45:34.586842452 +0400
@@ -170,6 +170,8 @@
*/
static uint forcemousemod = ShiftMask;
+#include "autocomplete.h"
+
/*
* Internal mouse shortcuts.
* Beware that overloading Button1 will disable the selection.
@@ -187,6 +189,8 @@
#define MODKEY Mod1Mask
#define TERMMOD (ControlMask|ShiftMask)
+#define ACMPL_MOD ControlMask|Mod1Mask
+
static Shortcut shortcuts[] = {
/* mask keysym function argument */
{ XK_ANY_MOD, XK_Break, sendbreak, {.i = 0} },
@@ -201,6 +205,14 @@
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
+ { ACMPL_MOD, XK_slash, autocomplete, { .i = ACMPL_WORD } },
+ { ACMPL_MOD, XK_period, autocomplete, { .i = ACMPL_FUZZY_WORD } },
+ { ACMPL_MOD, XK_comma, autocomplete, { .i = ACMPL_FUZZY } },
+ { ACMPL_MOD, XK_apostrophe, autocomplete, { .i = ACMPL_SUFFIX } },
+ { ACMPL_MOD, XK_semicolon, autocomplete, { .i = ACMPL_SURROUND } },
+ { ACMPL_MOD, XK_bracketright,autocomplete, { .i = ACMPL_WWORD } },
+ { ACMPL_MOD, XK_bracketleft, autocomplete, { .i = ACMPL_FUZZY_WWORD } },
+ { ACMPL_MOD, XK_equal, autocomplete, { .i = ACMPL_UNDO } },
};
/*
diff -uraN st-0.8.5/Makefile st-autocomplete/Makefile
--- st-0.8.5/Makefile 2022-03-13 02:45:34.586842452 +0400
+++ st-autocomplete/Makefile 2022-03-13 02:45:34.586842452 +0400
@@ -44,6 +44,8 @@
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f st $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/st
+ cp -f st-autocomplete $(DESTDIR)$(PREFIX)/bin
+ chmod 755 $(DESTDIR)$(PREFIX)/bin/st-autocomplete
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1
@@ -52,6 +54,7 @@
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/st
+ rm -f $(DESTDIR)$(PREFIX)/bin/st-autocomplete
rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
.PHONY: all options clean dist install uninstall
diff -uraN st-0.8.5/st-autocomplete st-autocomplete/st-autocomplete
--- st-0.8.5/st-autocomplete 1970-01-01 04:00:00.000000000 +0400
+++ st-autocomplete/st-autocomplete 2022-03-27 22:57:29.018288223 +0400
@@ -0,0 +1,310 @@
+#!/usr/bin/perl
+#########################################################################
+# Copyright (C) 2012-2017 Wojciech Siewierski #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+#########################################################################
+
+my ($cmd, $cursor_row, $cursor_column) = @ARGV;
+
+my $lines = [];
+my $lines1 = [];
+
+my $last_line = -1;
+my $lines_before_cursor = 0;
+
+while (<stdin>)
+{
+ $last_line++;
+
+ s/[^[:print:]]/?/g;
+
+ if ($last_line < $cursor_row)
+ {
+ unshift @{$lines1}, $_;
+ $lines_before_cursor++;
+ }
+ else
+ {
+ unshift @{$lines}, $_;
+ }
+}
+
+foreach (@{$lines1})
+{
+ unshift @{$lines}, $_;
+}
+
+my $cursor_row_in = $cursor_row;
+
+$cursor_row = $last_line;
+
+
+$self = {};
+
+# A reference to a function that transforms the completed word
+# into a regex matching the completions. Usually generated by
+# generate_matcher().
+#
+# For example
+# $fun = generate_matcher(".*");
+# $fun->("foo");
+# would return "f.*o.*o"
+#
+# In other words, indirectly decides which characters can
+# appear in the completion.
+my $matcher;
+
+# A regular expression matching a character before each match.
+# For example, it you want to match the text after a
+# whitespace, set it to "\s".
+my $char_class_before;
+
+# A regular expression matching every character in the entered
+# text that will be used to find matching completions. Usually
+# "\w" or similar.
+my $char_class_to_complete;
+
+# A regular expression matching every allowed last character
+# of the completion (uses greedy matching).
+my $char_class_at_end;
+
+if ($cmd eq 'word-complete') {
+ # Basic word completion. Completes the current word
+ # without any special matching.
+ $char_class_before = '[^-\w]';
+ $matcher = sub { quotemeta shift }; # identity
+ $char_class_at_end = '[-\w]';
+ $char_class_to_complete = '[-\w]';
+} elsif ($cmd eq 'WORD-complete') {
+ # The same as above but in the Vim meaning of a "WORD" --
+ # whitespace delimited.
+ $char_class_before = '\s';
+ $matcher = sub { quotemeta shift };
+ $char_class_at_end = '\S';
+ $char_class_to_complete = '\S';
+} elsif ($cmd eq 'fuzzy-word-complete' ||
+ $cmd eq 'skeleton-word-complete') {
+ # Fuzzy completion of the current word.
+ $char_class_before = '[^-\w]';
+ $matcher = generate_matcher('[-\w]*');
+ $char_class_at_end = '[-\w]';
+ $char_class_to_complete = '[-\w]';
+} elsif ($cmd eq 'fuzzy-WORD-complete') {
+ # Fuzzy completion of the current WORD.
+ $char_class_before = '\s';
+ $matcher = generate_matcher('\S*');
+ $char_class_at_end = '\S';
+ $char_class_to_complete = '\S';
+} elsif ($cmd eq 'fuzzy-complete' ||
+ $cmd eq 'skeleton-complete') {
+ # Fuzzy completion of an arbitrary text.
+ $char_class_before = '\W';
+ $matcher = generate_matcher('.*?');
+ $char_class_at_end = '\w';
+ $char_class_to_complete = '\S';
+} elsif ($cmd eq 'suffix-complete') {
+ # Fuzzy completion of an completing suffixes, like
+ # completing test=hello from /blah/hello.
+ $char_class_before = '\S';
+ $matcher = generate_matcher('\S*');
+ $char_class_at_end = '\S';
+ $char_class_to_complete = '\S';
+} elsif ($cmd eq 'surround-complete') {
+ # Completing contents of quotes and braces.
+
+ # Here we are using three named groups: s, b, p for quotes, braces
+ # and parenthesis.
+ $char_class_before = '((?<q>["\'`])|(?<b>\[)|(?<p>\())';
+
+ $matcher = generate_matcher('.*?');
+
+ # Here we match text till enclosing pair, using perl conditionals in
+ # regexps (?(condition)yes-expression|no-expression).
+ # \0 is used to hack concatenation with '*' later in the code.
+ $char_class_at_end = '.*?(.(?=(?(<b>)\]|((?(<p>)\)|\g{q})))))\0';
+ $char_class_to_complete = '\S';
+}
+
+
+# use the last used word or read the word behind the cursor
+my $word_to_complete = read_word_at_coord($self, $cursor_row, $cursor_column,
+ $char_class_to_complete);
+
+print stdout "$word_to_complete\n";
+
+if ($word_to_complete) {
+ while (1) {
+ # ignore the completed word itself
+ $self->{already_completed}{$word_to_complete} = 1;
+
+ # continue the last search or start from the current row
+ my $completion = find_match($self,
+ $word_to_complete,
+ $self->{next_row} // $cursor_row,
+ $matcher->($word_to_complete),
+ $char_class_before,
+ $char_class_at_end);
+ if ($completion) {
+ print stdout $completion."\n".join ("\n", @{$self->{highlight}})."\n";
+ }
+ else {
+ last;
+ }
+ }
+}
+
+######################################################################
+
+sub highlight_match {
+ my ($self, $linenum, $completion) = @_;
+
+ # clear_highlight($self);
+
+ my $line = @{$lines}[$linenum];
+ my $re = quotemeta $completion;
+
+ $line =~ /$re/;
+
+ my $beg = $-[0];
+ my $end = $+[0];
+
+ if ($linenum >= $lines_before_cursor)
+ {
+ $lline = $last_line - $lines_before_cursor;
+ $linenum -= $lines_before_cursor;
+ $linenum = $lline - $linenum;
+ $linenum += $lines_before_cursor;
+ }
+
+
+ $self->{highlight} = [$linenum, $beg, $end];
+}
+
+######################################################################
+
+sub read_word_at_coord {
+ my ($self, $row, $col, $char_class) = @_;
+
+ $_ = substr(@{$lines} [$row], 0, $col); # get the current line up to the cursor...
+ s/.*?($char_class*)$/$1/; # ...and read the last word from it
+ return $_;
+}
+
+######################################################################
+
+# Returns a function that takes a string and returns that string with
+# this function's argument inserted between its every two characters.
+# The resulting string is used as a regular expression matching the
+# completion candidates.
+sub generate_matcher {
+ my $regex_between = shift;
+
+ sub {
+ $_ = shift;
+
+ # sorry for this lispy code, I couldn't resist ;)
+ (join "$regex_between",
+ (map quotemeta,
+ (split //)))
+ }
+}
+
+######################################################################
+
+# Checks whether the completion found by find_match() was already
+# found and if it was, calls find_match() again to find the next
+# completion.
+#
+# Takes all the arguments that find_match() would take, to make a
+# mutually recursive call.
+sub skip_duplicates {
+ my ($self, $word_to_match, $current_row, $regexp, $char_class_before, $char_class_at_end) = @_;
+ my $completion;
+
+ if ($current_row <= $lines_before_cursor)
+ {
+ $completion = shift @{$self->{matches_in_row}}; # get the leftmost one
+ }
+ else
+ {
+ $completion = pop @{$self->{matches_in_row}}; # get the leftmost one
+ }
+
+ # check for duplicates
+ if (exists $self->{already_completed}{$completion}) {
+ # skip this completion
+ return find_match(@_);
+ } else {
+ $self->{already_completed}{$completion} = 1;
+
+ highlight_match($self,
+ $self->{next_row}+1,
+ $completion);
+
+ return $completion;
+ }
+}
+
+######################################################################
+
+# Finds the next matching completion in the row current row or above
+# while skipping duplicates using skip_duplicates().
+sub find_match {
+ my ($self, $word_to_match, $current_row, $regexp, $char_class_before, $char_class_at_end) = @_;
+ $self->{matches_in_row} //= [];
+
+ # cycle through all the matches in the current row if not starting a new search
+ if (@{$self->{matches_in_row}}) {
+ return skip_duplicates($self, $word_to_match, $current_row, $regexp, $char_class_before, $char_class_at_end);
+ }
+
+
+ my $i;
+ # search through all the rows starting with current one or one above the last checked
+ for ($i = $current_row; $i >= 0; --$i) {
+ my $line = @{$lines}[$i]; # get the line of text from the row
+
+ # if ($i == $cursor_row) {
+ # $line = substr $line, 0, $cursor_column;
+ # }
+
+ $_ = $line;
+
+ # find all the matches in the current line
+ my $match;
+ push @{$self->{matches_in_row}}, $+{match} while ($_, $match) = /
+ (.*${char_class_before})
+ (?<match>
+ ${regexp}
+ ${char_class_at_end}*
+ )
+ /ix;
+ # corner case: match at the very beginning of line
+ push @{$self->{matches_in_row}}, $+{match} if $line =~ /^(${char_class_before}){0}(?<match>$regexp$char_class_at_end*)/i;
+
+ if (@{$self->{matches_in_row}}) {
+ # remember which row should be searched next
+ $self->{next_row} = --$i;
+
+ # arguments needed for find_match() mutual recursion
+ return skip_duplicates($self, $word_to_match, $i, $regexp, $char_class_before, $char_class_at_end);
+ }
+ }
+
+ # # no more possible completions, revert to the original word
+ # undo_completion($self) if $i < 0;
+
+ return undef;
+}
diff -uraN st-0.8.5/st.c st-autocomplete/st.c
--- st-0.8.5/st.c 2022-03-13 02:45:34.586842452 +0400
+++ st-autocomplete/st.c 2022-03-27 22:28:39.041693478 +0400
@@ -17,6 +17,7 @@
#include <unistd.h>
#include <wchar.h>
+#include "autocomplete.h"
#include "st.h"
#include "win.h"
@@ -2569,6 +2570,8 @@
return;
}
+ autocomplete ((const Arg []) { ACMPL_DEACTIVATE });
+
/*
* slide screen to keep cursor where we expect it -
* tscrollup would work here, but we can optimize to
@@ -2688,3 +2691,256 @@
tfulldirt();
draw();
}
+
+void autocomplete (const Arg * arg)
+{
+ static _Bool active = 0;
+
+ int acmpl_cmdindex = arg -> i;
+
+ static int acmpl_cmdindex_prev;
+
+ if (active == 0)
+ acmpl_cmdindex_prev = acmpl_cmdindex;
+
+ static const char * const (acmpl_cmd []) = {
+ [ACMPL_DEACTIVATE] = "__DEACTIVATE__",
+ [ACMPL_WORD] = "word-complete",
+ [ACMPL_WWORD] = "WORD-complete",
+ [ACMPL_FUZZY_WORD] = "fuzzy-word-complete",
+ [ACMPL_FUZZY_WWORD] = "fuzzy-WORD-complete",
+ [ACMPL_FUZZY] = "fuzzy-complete",
+ [ACMPL_SUFFIX] = "suffix-complete",
+ [ACMPL_SURROUND] = "surround-complete",
+ [ACMPL_UNDO] = "__UNDO__",
+ };
+
+ static char acmpl [1000]; // ACMPL_ISSUE: why 1000?
+
+ static FILE * acmpl_exec = NULL;
+ static int acmpl_status;
+
+ static const char * stbuffile;
+ static char target [1000]; // ACMPL_ISSUE: why 1000? dynamically allocate char array of size term.col
+ static size_t targetlen;
+
+ static char completion [1000] = {0}; // ACMPL_ISSUE: why 1000? dynamically allocate char array of size term.col
+ static size_t complen_prev = 0; // NOTE: always clear this variable after clearing completion
+
+ static int cx, cy;
+
+ // ACMPL_ISSUE: crashes when term.row is too small
+
+// Check for deactivation
+
+ if (acmpl_cmdindex == ACMPL_DEACTIVATE)
+ {
+
+// Deactivate autocomplete mode keeping current completion
+
+ if (active)
+ {
+ active = 0;
+ pclose (acmpl_exec);
+ remove (stbuffile);
+
+ if (complen_prev)
+ {
+ selclear ();
+ complen_prev = 0;
+ }
+ }
+
+ return;
+ }
+
+// Check for undo
+
+ if (acmpl_cmdindex == ACMPL_UNDO)
+ {
+
+// Deactivate autocomplete mode recovering target
+
+ if (active)
+ {
+ active = 0;
+ pclose (acmpl_exec);
+ remove (stbuffile);
+
+ if (complen_prev)
+ {
+ selclear ();
+ for (size_t i = 0; i < complen_prev; i++)
+ ttywrite ((char []) { '\b' }, 1, 1); // ACMPL_ISSUE: I'm not sure that this is the right way
+ complen_prev = 0;
+ ttywrite (target, targetlen, 0); // ACMPL_ISSUE: I'm not sure that this is a right solution
+ }
+ }
+
+ return;
+ }
+
+// Check for command change
+
+ if (acmpl_cmdindex != acmpl_cmdindex_prev)
+ {
+
+// If command is changed, goto acmpl_begin avoiding rewriting st buffer
+
+ if (active)
+ {
+ acmpl_cmdindex_prev = acmpl_cmdindex;
+
+ goto acmpl_begin;
+ }
+ }
+
+// If not active
+
+ if (active == 0)
+ {
+ acmpl_cmdindex_prev = acmpl_cmdindex;
+ cx = term.c.x;
+ cy = term.c.y;
+
+// Write st buffer to a temp file
+
+ stbuffile = tmpnam (NULL); // ACMPL_ISSUE: check for return value ...
+ // ACMPL_ISSUE: use coprocesses instead of temp files
+
+ FILE * stbuf = fopen (stbuffile, "w"); // ACMPL_ISSUE: check for opening error ...
+ char * stbufline = malloc (term.col + 2); // ACMPL_ISSUE: check for allocating error ...
+
+ int cxp = 0;
+
+ for (size_t y = 0; y < term.row; y++)
+ {
+ if (y == term.c.y) cx += cxp * term.col;
+
+ size_t x = 0;
+ for (; x < term.col; x++)
+ utf8encode (term.line [y] [x].u, stbufline + x);
+ if (term.line [y] [x - 1].mode & ATTR_WRAP)
+ {
+ x--;
+ if (y <= term.c.y) cy--;
+ cxp++;
+ }
+ else
+ {
+ stbufline [x] = '\n';
+ cxp = 0;
+ }
+ stbufline [x + 1] = 0;
+ fputs (stbufline, stbuf);
+ }
+
+ free (stbufline);
+ fclose (stbuf);
+
+acmpl_begin:
+
+// Run st-autocomplete
+
+ sprintf (
+ acmpl,
+ "cat %100s | st-autocomplete %500s %d %d", // ACMPL_ISSUE: why 100 and 500?
+ stbuffile,
+ acmpl_cmd [acmpl_cmdindex],
+ cy,
+ cx
+ );
+
+ acmpl_exec = popen (acmpl, "r"); // ACMPL_ISSUE: popen isn't defined by The Standard. Does it work in BSDs for example?
+ // ACMPL_ISSUE: check for popen error ...
+
+// Read the target, targetlen
+
+ fscanf (acmpl_exec, "%500s\n", target); // ACMPL_ISSUE: check for scanning error ...
+ targetlen = strlen (target);
+ }
+
+// Read a completion if exists (acmpl_status)
+
+ unsigned line, beg, end;
+
+ acmpl_status = fscanf (acmpl_exec, "%500[^\n]\n%u\n%u\n%u\n", completion, & line, & beg, & end);
+ // ACMPL_ISSUE: why 500? use term.col instead
+
+// Exit if no completions found
+
+ if (active == 0 && acmpl_status == EOF)
+ {
+
+// Close st-autocomplete and exit without activating the autocomplete mode
+
+ pclose (acmpl_exec);
+ remove (stbuffile);
+ return;
+ }
+
+// If completions found, enable autocomplete mode and autocomplete the target
+
+ active = 1;
+
+// Clear target before first completion
+
+ if (complen_prev == 0)
+ {
+ for (size_t i = 0; i < targetlen; i++)
+ ttywrite ((char []) { '\b' }, 1, 1); // ACMPL_ISSUE: I'm not sure that this is a right solution
+ }
+
+// Clear previuos completion if this is not the first
+
+ else
+ {
+ selclear ();
+ for (size_t i = 0; i < complen_prev; i++)
+ ttywrite ((char []) { '\b' }, 1, 1); // ACMPL_ISSUE: I'm not sure that this is a right solution
+ complen_prev = 0;
+ }
+
+// If no more completions found, reset and restart
+
+ if (acmpl_status == EOF)
+ {
+ active = 0;
+ pclose (acmpl_exec);
+ ttywrite (target, targetlen, 0);
+ goto acmpl_begin;
+ }
+
+// Count wrapped lines before the current line
+
+ int wl = 0;
+
+ int tl = line;
+
+ for (int l = 0; l < tl; l++)
+ if (term.line [l] [term.col - 1].mode & ATTR_WRAP)
+ {
+ wl++;
+ tl++;
+ }
+
+// Autcomplete
+
+ complen_prev = strlen (completion);
+ ttywrite (completion, complen_prev, 0);
+
+ if (line == cy && beg > cx)
+ {
+ beg += complen_prev - targetlen;
+ end += complen_prev - targetlen;
+
+ // ACMPL_ISSUE: highlignthing doesn't work when "line == cy && beg > cx",
+ // but coordinates are correct...
+ }
+
+ end--;
+
+ selstart (beg % term.col, line + wl + beg / term.col, 0);
+ selextend (end % term.col, line + wl + end / term.col, 1, 0);
+ xsetsel (getsel ());
+}
diff -uraN st-0.8.5/st.h st-autocomplete/st.h
--- st-0.8.5/st.h 2022-03-13 02:45:34.586842452 +0400
+++ st-autocomplete/st.h 2022-03-13 02:45:34.586842452 +0400
@@ -77,6 +77,8 @@
const char *s;
} Arg;
+void autocomplete (const Arg *);
+
void die(const char *, ...);
void redraw(void);
void draw(void);
diff -uraN st-0.8.5/x.c st-autocomplete/x.c
--- st-0.8.5/x.c 2022-03-13 02:45:34.586842452 +0400
+++ st-autocomplete/x.c 2022-03-13 02:45:34.590175835 +0400
@@ -1834,11 +1834,20 @@
/* 1. shortcuts */
for (bp = shortcuts; bp < shortcuts + LEN(shortcuts); bp++) {
if (ksym == bp->keysym && match(bp->mod, e->state)) {
+ if (bp -> func != autocomplete)
+ autocomplete ((const Arg []) { ACMPL_DEACTIVATE });
bp->func(&(bp->arg));
return;
}
}
+ if (!(
+ len == 0 &&
+ e -> state & ~ignoremod // ACMPL_ISSUE: I'm not sure that this is the right way
+ | ACMPL_MOD == ACMPL_MOD
+ ))
+ autocomplete ((const Arg []) { ACMPL_DEACTIVATE });
+
/* 2. custom keys from config.h */
if ((customkey = kmap(ksym, e->state))) {
ttywrite(customkey, strlen(customkey), 1);

View File

@@ -1,5 +1,5 @@
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 91ab8ca..6af616e 100644 index 2cd740a..019a4e1 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -93,6 +93,9 @@ char *termname = "st-256color"; @@ -93,6 +93,9 @@ char *termname = "st-256color";
@@ -12,30 +12,8 @@ index 91ab8ca..6af616e 100644
/* Terminal colors (16 first used in escape sequence) */ /* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = { static const char *colorname[] = {
/* 8 normal colors */ /* 8 normal colors */
diff --git a/config.mk b/config.mk
index 4c4c5d5..0114bad 100644
--- a/config.mk
+++ b/config.mk
@@ -16,7 +16,7 @@ PKG_CONFIG = pkg-config
INCS = -I$(X11INC) \
`$(PKG_CONFIG) --cflags fontconfig` \
`$(PKG_CONFIG) --cflags freetype2`
-LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \
+LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender\
`$(PKG_CONFIG) --libs fontconfig` \
`$(PKG_CONFIG) --libs freetype2`
diff --git a/st.h b/st.h
index 519b9bd..8bb533d 100644
--- a/st.h
+++ b/st.h
@@ -126,3 +126,4 @@ extern unsigned int tabspaces;
extern unsigned int defaultfg;
extern unsigned int defaultbg;
extern unsigned int defaultcs;
+extern float alpha;
diff --git a/x.c b/x.c diff --git a/x.c b/x.c
index 8a16faa..ddf4178 100644 index d73152b..f32fd6c 100644
--- a/x.c --- a/x.c
+++ b/x.c +++ b/x.c
@@ -105,6 +105,7 @@ typedef struct { @@ -105,6 +105,7 @@ typedef struct {
@@ -46,15 +24,7 @@ index 8a16faa..ddf4178 100644
int l, t; /* left and top offset */ int l, t; /* left and top offset */
int gm; /* geometry mask */ int gm; /* geometry mask */
} XWindow; } XWindow;
@@ -243,6 +244,7 @@ static char *usedfont = NULL; @@ -752,7 +753,7 @@ xresize(int col, int row)
static double usedfontsize = 0;
static double defaultfontsize = 0;
+static char *opt_alpha = NULL;
static char *opt_class = NULL;
static char **opt_cmd = NULL;
static char *opt_embed = NULL;
@@ -736,7 +738,7 @@ xresize(int col, int row)
XFreePixmap(xw.dpy, xw.buf); XFreePixmap(xw.dpy, xw.buf);
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
@@ -63,22 +33,32 @@ index 8a16faa..ddf4178 100644
XftDrawChange(xw.draw, xw.buf); XftDrawChange(xw.draw, xw.buf);
xclear(0, 0, win.w, win.h); xclear(0, 0, win.w, win.h);
@@ -796,6 +798,13 @@ xloadcols(void) @@ -812,6 +813,10 @@ xloadcols(void)
else else
die("could not allocate color %d\n", i); die("could not allocate color %d\n", i);
} }
+ +
+ /* set alpha value of bg color */
+ if (opt_alpha)
+ alpha = strtof(opt_alpha, NULL);
+ dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha); + dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha);
+ dc.col[defaultbg].pixel &= 0x00FFFFFF; + dc.col[defaultbg].pixel &= 0x00FFFFFF;
+ dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24; + dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24;
loaded = 1; loaded = 1;
} }
@@ -1118,11 +1127,23 @@ xinit(int cols, int rows) @@ -842,6 +847,12 @@ xsetcolorname(int x, const char *name)
Window parent; XftColorFree(xw.dpy, xw.vis, xw.cmap, &dc.col[x]);
dc.col[x] = ncolor;
+ if (x == defaultbg) {
+ dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha);
+ dc.col[defaultbg].pixel &= 0x00FFFFFF;
+ dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24;
+ }
+
return 0;
}
@@ -1134,11 +1145,25 @@ xinit(int cols, int rows)
Window parent, root;
pid_t thispid = getpid(); pid_t thispid = getpid();
XColor xmousefg, xmousebg; XColor xmousefg, xmousebg;
+ XWindowAttributes attr; + XWindowAttributes attr;
@@ -89,20 +69,22 @@ index 8a16faa..ddf4178 100644
xw.scr = XDefaultScreen(xw.dpy); xw.scr = XDefaultScreen(xw.dpy);
- xw.vis = XDefaultVisual(xw.dpy, xw.scr); - xw.vis = XDefaultVisual(xw.dpy, xw.scr);
+ +
+ if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) { + root = XRootWindow(xw.dpy, xw.scr);
+ parent = XRootWindow(xw.dpy, xw.scr); + if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
+ xw.depth = 32; + parent = root;
+
+ if (XMatchVisualInfo(xw.dpy, xw.scr, 32, TrueColor, &vis) != 0) {
+ xw.vis = vis.visual;
+ xw.depth = vis.depth;
+ } else { + } else {
+ XGetWindowAttributes(xw.dpy, parent, &attr); + XGetWindowAttributes(xw.dpy, parent, &attr);
+ xw.vis = attr.visual;
+ xw.depth = attr.depth; + xw.depth = attr.depth;
+ } + }
+
+ XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis);
+ xw.vis = vis.visual;
/* font */ /* font */
if (!FcInit()) if (!FcInit())
@@ -1132,7 +1153,7 @@ xinit(int cols, int rows) @@ -1148,7 +1173,7 @@ xinit(int cols, int rows)
xloadfonts(usedfont, 0); xloadfonts(usedfont, 0);
/* colors */ /* colors */
@@ -111,35 +93,36 @@ index 8a16faa..ddf4178 100644
xloadcols(); xloadcols();
/* adjust fixed window geometry */ /* adjust fixed window geometry */
@@ -1152,19 +1173,15 @@ xinit(int cols, int rows) @@ -1168,11 +1193,8 @@ xinit(int cols, int rows)
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask; | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
xw.attrs.colormap = xw.cmap; xw.attrs.colormap = xw.cmap;
- root = XRootWindow(xw.dpy, xw.scr);
- if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) - if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
- parent = XRootWindow(xw.dpy, xw.scr); - parent = root;
xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t, - xw.win = XCreateWindow(xw.dpy, root, xw.l, xw.t,
- win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput, - win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
+ xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t,
+ win.w, win.h, 0, xw.depth, InputOutput, + win.w, win.h, 0, xw.depth, InputOutput,
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
| CWEventMask | CWColormap, &xw.attrs); | CWEventMask | CWColormap, &xw.attrs);
if (parent != root)
memset(&gcvalues, 0, sizeof(gcvalues)); @@ -1183,7 +1205,7 @@ xinit(int cols, int rows)
gcvalues.graphics_exposures = False; dc.gc = XCreateGC(xw.dpy, xw.win, GCGraphicsExposures,
- dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, &gcvalues);
- &gcvalues); xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
- xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
- DefaultDepth(xw.dpy, xw.scr)); - DefaultDepth(xw.dpy, xw.scr));
+ xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth); + xw.depth);
+ dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues);
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h); XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
@@ -2019,6 +2036,9 @@ main(int argc, char *argv[]) @@ -2047,6 +2069,10 @@ main(int argc, char *argv[])
case 'a': case 'a':
allowaltscreen = 0; allowaltscreen = 0;
break; break;
+ case 'A': + case 'A':
+ opt_alpha = EARGF(usage()); + alpha = strtof(EARGF(usage()), NULL);
+ LIMIT(alpha, 0.0, 1.0);
+ break; + break;
case 'c': case 'c':
opt_class = EARGF(usage()); opt_class = EARGF(usage());

View File

@@ -1,8 +1,8 @@
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 6f05dce..93cbcc0 100644 index 2cd740a..40b7d93 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -199,6 +199,8 @@ static Shortcut shortcuts[] = { @@ -201,6 +201,8 @@ static Shortcut shortcuts[] = {
{ TERMMOD, XK_Y, selpaste, {.i = 0} }, { TERMMOD, XK_Y, selpaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} }, { ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, { TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
@@ -12,7 +12,7 @@ index 6f05dce..93cbcc0 100644
/* /*
diff --git a/st.c b/st.c diff --git a/st.c b/st.c
index ebdf360..817cc47 100644 index b9f66e7..2478942 100644
--- a/st.c --- a/st.c
+++ b/st.c +++ b/st.c
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
@@ -43,7 +43,7 @@ index ebdf360..817cc47 100644
int *dirty; /* dirtyness of lines */ int *dirty; /* dirtyness of lines */
TCursor c; /* cursor */ TCursor c; /* cursor */
int ocx; /* old cursor col */ int ocx; /* old cursor col */
@@ -184,8 +191,8 @@ static void tnewline(int); @@ -185,8 +192,8 @@ static void tnewline(int);
static void tputtab(int); static void tputtab(int);
static void tputc(Rune); static void tputc(Rune);
static void treset(void); static void treset(void);
@@ -54,7 +54,7 @@ index ebdf360..817cc47 100644
static void tsetattr(const int *, int); static void tsetattr(const int *, int);
static void tsetchar(Rune, const Glyph *, int, int); static void tsetchar(Rune, const Glyph *, int, int);
static void tsetdirt(int, int); static void tsetdirt(int, int);
@@ -416,10 +423,10 @@ tlinelen(int y) @@ -409,10 +416,10 @@ tlinelen(int y)
{ {
int i = term.col; int i = term.col;
@@ -67,7 +67,7 @@ index ebdf360..817cc47 100644
--i; --i;
return i; return i;
@@ -528,7 +535,7 @@ selsnap(int *x, int *y, int direction) @@ -521,7 +528,7 @@ selsnap(int *x, int *y, int direction)
* Snap around if the word wraps around at the end or * Snap around if the word wraps around at the end or
* beginning of a line. * beginning of a line.
*/ */
@@ -76,7 +76,7 @@ index ebdf360..817cc47 100644
prevdelim = ISDELIM(prevgp->u); prevdelim = ISDELIM(prevgp->u);
for (;;) { for (;;) {
newx = *x + direction; newx = *x + direction;
@@ -543,14 +550,14 @@ selsnap(int *x, int *y, int direction) @@ -536,14 +543,14 @@ selsnap(int *x, int *y, int direction)
yt = *y, xt = *x; yt = *y, xt = *x;
else else
yt = newy, xt = newx; yt = newy, xt = newx;
@@ -93,7 +93,7 @@ index ebdf360..817cc47 100644
delim = ISDELIM(gp->u); delim = ISDELIM(gp->u);
if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim
|| (delim && gp->u != prevgp->u))) || (delim && gp->u != prevgp->u)))
@@ -571,14 +578,14 @@ selsnap(int *x, int *y, int direction) @@ -564,14 +571,14 @@ selsnap(int *x, int *y, int direction)
*x = (direction < 0) ? 0 : term.col - 1; *x = (direction < 0) ? 0 : term.col - 1;
if (direction < 0) { if (direction < 0) {
for (; *y > 0; *y += direction) { for (; *y > 0; *y += direction) {
@@ -110,7 +110,7 @@ index ebdf360..817cc47 100644
& ATTR_WRAP)) { & ATTR_WRAP)) {
break; break;
} }
@@ -609,13 +616,13 @@ getsel(void) @@ -602,13 +609,13 @@ getsel(void)
} }
if (sel.type == SEL_RECTANGULAR) { if (sel.type == SEL_RECTANGULAR) {
@@ -127,7 +127,7 @@ index ebdf360..817cc47 100644
while (last >= gp && last->u == ' ') while (last >= gp && last->u == ' ')
--last; --last;
@@ -850,6 +857,9 @@ void @@ -844,6 +851,9 @@ void
ttywrite(const char *s, size_t n, int may_echo) ttywrite(const char *s, size_t n, int may_echo)
{ {
const char *next; const char *next;
@@ -137,7 +137,7 @@ index ebdf360..817cc47 100644
if (may_echo && IS_SET(MODE_ECHO)) if (may_echo && IS_SET(MODE_ECHO))
twrite(s, n, 1); twrite(s, n, 1);
@@ -1061,13 +1071,53 @@ tswapscreen(void) @@ -1055,13 +1065,53 @@ tswapscreen(void)
} }
void void
@@ -192,7 +192,7 @@ index ebdf360..817cc47 100644
tsetdirt(orig, term.bot-n); tsetdirt(orig, term.bot-n);
tclearregion(0, term.bot-n+1, term.col-1, term.bot); tclearregion(0, term.bot-n+1, term.col-1, term.bot);
@@ -1077,17 +1127,28 @@ tscrolldown(int orig, int n) @@ -1071,17 +1121,28 @@ tscrolldown(int orig, int n)
term.line[i-n] = temp; term.line[i-n] = temp;
} }
@@ -223,7 +223,7 @@ index ebdf360..817cc47 100644
tclearregion(0, orig, term.col-1, orig+n-1); tclearregion(0, orig, term.col-1, orig+n-1);
tsetdirt(orig+n, term.bot); tsetdirt(orig+n, term.bot);
@@ -1097,7 +1158,8 @@ tscrollup(int orig, int n) @@ -1091,7 +1152,8 @@ tscrollup(int orig, int n)
term.line[i+n] = temp; term.line[i+n] = temp;
} }
@@ -233,7 +233,7 @@ index ebdf360..817cc47 100644
} }
void void
@@ -1126,7 +1188,7 @@ tnewline(int first_col) @@ -1120,7 +1182,7 @@ tnewline(int first_col)
int y = term.c.y; int y = term.c.y;
if (y == term.bot) { if (y == term.bot) {
@@ -242,7 +242,7 @@ index ebdf360..817cc47 100644
} else { } else {
y++; y++;
} }
@@ -1291,14 +1353,14 @@ void @@ -1285,14 +1347,14 @@ void
tinsertblankline(int n) tinsertblankline(int n)
{ {
if (BETWEEN(term.c.y, term.top, term.bot)) if (BETWEEN(term.c.y, term.top, term.bot))
@@ -259,9 +259,9 @@ index ebdf360..817cc47 100644
} }
int32_t int32_t
@@ -1735,11 +1797,11 @@ csihandle(void) @@ -1730,11 +1792,11 @@ csihandle(void)
break;
case 'S': /* SU -- Scroll <n> line up */ case 'S': /* SU -- Scroll <n> line up */
if (csiescseq.priv) break;
DEFAULT(csiescseq.arg[0], 1); DEFAULT(csiescseq.arg[0], 1);
- tscrollup(term.top, csiescseq.arg[0]); - tscrollup(term.top, csiescseq.arg[0]);
+ tscrollup(term.top, csiescseq.arg[0], 0); + tscrollup(term.top, csiescseq.arg[0], 0);
@@ -273,7 +273,7 @@ index ebdf360..817cc47 100644
break; break;
case 'L': /* IL -- Insert <n> blank lines */ case 'L': /* IL -- Insert <n> blank lines */
DEFAULT(csiescseq.arg[0], 1); DEFAULT(csiescseq.arg[0], 1);
@@ -2251,7 +2313,7 @@ eschandle(uchar ascii) @@ -2306,7 +2368,7 @@ eschandle(uchar ascii)
return 0; return 0;
case 'D': /* IND -- Linefeed */ case 'D': /* IND -- Linefeed */
if (term.c.y == term.bot) { if (term.c.y == term.bot) {
@@ -282,7 +282,7 @@ index ebdf360..817cc47 100644
} else { } else {
tmoveto(term.c.x, term.c.y+1); tmoveto(term.c.x, term.c.y+1);
} }
@@ -2264,7 +2326,7 @@ eschandle(uchar ascii) @@ -2319,7 +2381,7 @@ eschandle(uchar ascii)
break; break;
case 'M': /* RI -- Reverse index */ case 'M': /* RI -- Reverse index */
if (term.c.y == term.top) { if (term.c.y == term.top) {
@@ -291,7 +291,7 @@ index ebdf360..817cc47 100644
} else { } else {
tmoveto(term.c.x, term.c.y-1); tmoveto(term.c.x, term.c.y-1);
} }
@@ -2474,7 +2536,7 @@ twrite(const char *buf, int buflen, int show_ctrl) @@ -2542,7 +2604,7 @@ twrite(const char *buf, int buflen, int show_ctrl)
void void
tresize(int col, int row) tresize(int col, int row)
{ {
@@ -300,7 +300,7 @@ index ebdf360..817cc47 100644
int minrow = MIN(row, term.row); int minrow = MIN(row, term.row);
int mincol = MIN(col, term.col); int mincol = MIN(col, term.col);
int *bp; int *bp;
@@ -2511,6 +2573,14 @@ tresize(int col, int row) @@ -2579,6 +2641,14 @@ tresize(int col, int row)
term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty)); term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty));
term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs)); term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs));
@@ -315,7 +315,7 @@ index ebdf360..817cc47 100644
/* resize each row to new width, zero-pad if needed */ /* resize each row to new width, zero-pad if needed */
for (i = 0; i < minrow; i++) { for (i = 0; i < minrow; i++) {
term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph)); term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph));
@@ -2569,7 +2639,7 @@ drawregion(int x1, int y1, int x2, int y2) @@ -2637,7 +2707,7 @@ drawregion(int x1, int y1, int x2, int y2)
continue; continue;
term.dirty[y] = 0; term.dirty[y] = 0;
@@ -324,7 +324,7 @@ index ebdf360..817cc47 100644
} }
} }
@@ -2590,8 +2660,9 @@ draw(void) @@ -2658,8 +2728,9 @@ draw(void)
cx--; cx--;
drawregion(0, 0, term.col, term.row); drawregion(0, 0, term.col, term.row);
@@ -337,7 +337,7 @@ index ebdf360..817cc47 100644
term.ocy = term.c.y; term.ocy = term.c.y;
xfinishdraw(); xfinishdraw();
diff --git a/st.h b/st.h diff --git a/st.h b/st.h
index fa2eddf..adda2db 100644 index fd3b0d8..818a6f8 100644
--- a/st.h --- a/st.h
+++ b/st.h +++ b/st.h
@@ -81,6 +81,8 @@ void die(const char *, ...); @@ -81,6 +81,8 @@ void die(const char *, ...);

View File

@@ -1,14 +1,14 @@
From b5d3351a21442a842e01e8c0317603b6890b379c Mon Sep 17 00:00:00 2001 From 6b7e7e6c5c44dd6347ad49691b80d808c1b0cb77 Mon Sep 17 00:00:00 2001
From: asparagii <michele.lambertucci1@gmail.com> From: Jernej Jakob <jernej.jakob@gmail.com>
Date: Thu, 27 Jan 2022 15:44:02 +0100 Date: Mon, 1 Jul 2024 14:00:02 +0200
Subject: [PATCH] st-scrollback-mouse Subject: [PATCH] [st][patch] Update st-scrollback-mouse for 0.9.2
--- ---
config.def.h | 2 ++ config.def.h | 2 ++
1 file changed, 2 insertions(+) 1 file changed, 2 insertions(+)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index e3b469b..c217315 100644 index 8b25d40..d259675 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -176,6 +176,8 @@ static uint forcemousemod = ShiftMask; @@ -176,6 +176,8 @@ static uint forcemousemod = ShiftMask;
@@ -21,5 +21,5 @@ index e3b469b..c217315 100644
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} }, { ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
-- --
2.34.1 2.44.2

View File

@@ -1,7 +1,7 @@
From 2752a599ee01305a435729bfacf43b1dde7cf0ef Mon Sep 17 00:00:00 2001 From 6315407196933ec86be2b3c74f89bee746353e32 Mon Sep 17 00:00:00 2001
From: Benji Encalada Mora <benji@encalada.dev> From: harishnkr <hari2menon1234@gmail.com>
Date: Thu, 4 Jun 2020 00:41:10 -0500 Date: Mon, 20 Mar 2023 14:27:07 +0530
Subject: [PATCH] fix: replace xfps and actionfps variables Subject: [PATCH] Fix xresources bgcolour fgcolour and cscolour definitions
--- ---
config.def.h | 36 ++++++++++++++++++++++++ config.def.h | 36 ++++++++++++++++++++++++
@@ -9,10 +9,10 @@ Subject: [PATCH] fix: replace xfps and actionfps variables
2 files changed, 110 insertions(+), 4 deletions(-) 2 files changed, 110 insertions(+), 4 deletions(-)
diff --git a/config.def.h b/config.def.h diff --git a/config.def.h b/config.def.h
index 6f05dce..9b99782 100644 index 91ab8ca..f11db58 100644
--- a/config.def.h --- a/config.def.h
+++ b/config.def.h +++ b/config.def.h
@@ -168,6 +168,42 @@ static unsigned int defaultattr = 11; @@ -170,6 +170,43 @@ static unsigned int defaultattr = 11;
*/ */
static uint forcemousemod = ShiftMask; static uint forcemousemod = ShiftMask;
@@ -37,9 +37,9 @@ index 6f05dce..9b99782 100644
+ { "color13", STRING, &colorname[13] }, + { "color13", STRING, &colorname[13] },
+ { "color14", STRING, &colorname[14] }, + { "color14", STRING, &colorname[14] },
+ { "color15", STRING, &colorname[15] }, + { "color15", STRING, &colorname[15] },
+ { "background", STRING, &colorname[256] }, + { "background", STRING, &colorname[259] },
+ { "foreground", STRING, &colorname[257] }, + { "foreground", STRING, &colorname[258] },
+ { "cursorColor", STRING, &colorname[258] }, + { "cursorColor", STRING, &colorname[256] },
+ { "termname", STRING, &termname }, + { "termname", STRING, &termname },
+ { "shell", STRING, &shell }, + { "shell", STRING, &shell },
+ { "minlatency", INTEGER, &minlatency }, + { "minlatency", INTEGER, &minlatency },
@@ -50,13 +50,14 @@ index 6f05dce..9b99782 100644
+ { "borderpx", INTEGER, &borderpx }, + { "borderpx", INTEGER, &borderpx },
+ { "cwscale", FLOAT, &cwscale }, + { "cwscale", FLOAT, &cwscale },
+ { "chscale", FLOAT, &chscale }, + { "chscale", FLOAT, &chscale },
+ { "alpha", FLOAT, &alpha },
+}; +};
+ +
/* /*
* Internal mouse shortcuts. * Internal mouse shortcuts.
* Beware that overloading Button1 will disable the selection. * Beware that overloading Button1 will disable the selection.
diff --git a/x.c b/x.c diff --git a/x.c b/x.c
index 210f184..76f167f 100644 index aa09997..ab10269 100644
--- a/x.c --- a/x.c
+++ b/x.c +++ b/x.c
@@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
@@ -87,7 +88,7 @@ index 210f184..76f167f 100644
/* X modifiers */ /* X modifiers */
#define XK_ANY_MOD UINT_MAX #define XK_ANY_MOD UINT_MAX
#define XK_NO_MOD 0 #define XK_NO_MOD 0
@@ -828,8 +842,8 @@ xclear(int x1, int y1, int x2, int y2) @@ -859,8 +873,8 @@ xclear(int x1, int y1, int x2, int y2)
void void
xhints(void) xhints(void)
{ {
@@ -98,7 +99,7 @@ index 210f184..76f167f 100644
XWMHints wm = {.flags = InputHint, .input = 1}; XWMHints wm = {.flags = InputHint, .input = 1};
XSizeHints *sizeh; XSizeHints *sizeh;
@@ -1104,8 +1118,6 @@ xinit(int cols, int rows) @@ -1135,8 +1149,6 @@ xinit(int cols, int rows)
pid_t thispid = getpid(); pid_t thispid = getpid();
XColor xmousefg, xmousebg; XColor xmousefg, xmousebg;
@@ -107,7 +108,7 @@ index 210f184..76f167f 100644
xw.scr = XDefaultScreen(xw.dpy); xw.scr = XDefaultScreen(xw.dpy);
xw.vis = XDefaultVisual(xw.dpy, xw.scr); xw.vis = XDefaultVisual(xw.dpy, xw.scr);
@@ -1964,6 +1976,59 @@ run(void) @@ -2014,6 +2026,59 @@ run(void)
} }
} }
@@ -167,7 +168,7 @@ index 210f184..76f167f 100644
void void
usage(void) usage(void)
{ {
@@ -2037,6 +2102,11 @@ run: @@ -2087,6 +2152,11 @@ run:
setlocale(LC_CTYPE, ""); setlocale(LC_CTYPE, "");
XSetLocaleModifiers(""); XSetLocaleModifiers("");
@@ -180,5 +181,5 @@ index 210f184..76f167f 100644
rows = MAX(rows, 1); rows = MAX(rows, 1);
tnew(cols, rows); tnew(cols, rows);
-- --
2.26.2 2.39.2

50
note/docker.org Normal file
View File

@@ -0,0 +1,50 @@
#+title: docker 镜像配置
* OWSS
github: [[https://github.com/ronggang/OWSS]]
docker 拉取命令
#+begin_src bash
docker pull ronggang/owss
#+end_src
部署命令
#+begin_src bash
# Linux
docker run -d \
--restart=always \
--privileged \
--network=host \
--name owss \
-v /OWSS/storage:/app/storage \
-v /OWSS/config:/app/config \
-p 8088:8088 \
ronggang/owss
#+end_src
* v2raya
github: https://github.com/v2rayA/v2rayA
安装文档: https://v2raya.org/docs/prologue/installation/docker/
docker 拉取命令
#+begin_src bash
docker pull mzz2017/v2raya
#+end_src
部署命令
#+begin_src bash
docker run -d \
--restart=always \
--privileged \
--network=host \
--name v2raya \
-e V2RAYA_LOG_FILE=/tmp/v2raya.log \
-e V2RAYA_V2RAY_BIN=/usr/local/bin/v2ray \
-e V2RAYA_NFTABLES_SUPPORT=off \
-e IPTABLES_MODE=legacy \
-v /lib/modules:/lib/modules:ro \
-v /etc/resolv.conf:/etc/resolv.conf \
-v /etc/v2raya:/etc/v2raya \
mzz2017/v2raya
#+end_src