Merge branch 'master' into lenovo-y480
This commit is contained in:
@@ -15,7 +15,7 @@ URxvt.scrollWithBuffer: True
|
||||
URxvt.saveLines: 1000000
|
||||
|
||||
URxvt.font: \
|
||||
xft:Sarasa Mono SC:size=14,\
|
||||
xft:Sarasa Term SC:size=14,\
|
||||
xft:Operator Mono Book:size=14,\
|
||||
xft:Source Code Pro:size=14,\
|
||||
xft:Microsoft Yahei:size=14,\
|
||||
|
||||
@@ -14,7 +14,7 @@ XTerm.termName: xterm-256color
|
||||
XTerm*background: black
|
||||
XTerm*foreground: white
|
||||
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
|
||||
|
||||
! Alt键设置
|
||||
@@ -36,5 +36,5 @@ XTerm*buffered: true
|
||||
XTerm*multiScroll: 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
|
||||
|
||||
@@ -30,6 +30,60 @@ generate-bash-completion() {
|
||||
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() {
|
||||
local silence=false
|
||||
local -a dirs=()
|
||||
|
||||
13
dot/.bashrc.d/llama-cpp.bash
Normal file
13
dot/.bashrc.d/llama-cpp.bash
Normal 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
|
||||
@@ -4,7 +4,7 @@ source "${basedir}/function.bash"
|
||||
unset basedir
|
||||
|
||||
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
|
||||
generate-bash-completion pnpm "pnpm completion bash"
|
||||
|
||||
@@ -32,9 +32,7 @@ INPUT_DEVICES="libinput"
|
||||
VIDEO_CARDS="amdgpu dummy fbdev intel nouveau radeon radeonsi vesa"
|
||||
|
||||
GENTOO_MIRRORS="
|
||||
https://mirrors.ustc.edu.cn/gentoo/
|
||||
http://distfiles.gentoo.org/
|
||||
https://mirrors.tuna.tsinghua.edu.cn/gentoo/
|
||||
"
|
||||
MAKEOPTS="-j4 ${MAKEOPTS}"
|
||||
|
||||
|
||||
@@ -43,3 +43,9 @@ app-office/wps-office ~amd64
|
||||
|
||||
# rustup
|
||||
dev-util/rustup ~amd64
|
||||
|
||||
# llama-cpp
|
||||
sci-ml/llama-cpp **
|
||||
|
||||
# nvidia cuda toolkit
|
||||
dev-util/nvidia-cuda-toolkit ~amd64
|
||||
|
||||
@@ -6,8 +6,8 @@ app-office/wps-office WPS-EULA
|
||||
dev-embedded/sdcc MicroChip-SDCC
|
||||
dev-db/mongodb SSPL-1
|
||||
dev-libs/cudnn NVIDIA-cuDNN
|
||||
dev-util/nvidia-cuda-toolkit NVIDIA-CUDA
|
||||
dev-util/android-studio android
|
||||
dev-util/nvidia-cuda-toolkit NVIDIA-CUDA
|
||||
dev-util/pycharm-community JetBrains-business JSON
|
||||
dev-util/pycharm-professional JetBrains-business JSON
|
||||
media-fonts/font-bh-ttf bh-luxi
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
dev-lang/rust
|
||||
net-proxy/shadowsocks-rust::gentoo-zh
|
||||
>=x11-drivers/nvidia-drivers-581
|
||||
|
||||
@@ -4,6 +4,9 @@ net-misc/openssh libedit
|
||||
sys-boot/grub mount
|
||||
sys-libs/zlib minizip
|
||||
|
||||
# gcc
|
||||
sys-devel/gcc lto pgo
|
||||
|
||||
# kernel
|
||||
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
|
||||
|
||||
# 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
|
||||
sys-devel/gcc jit
|
||||
|
||||
# p7zip
|
||||
app-arch/p7zip rar -wxwidgets
|
||||
@@ -118,3 +120,10 @@ media-libs/freetype harfbuzz
|
||||
|
||||
# watchman
|
||||
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
|
||||
|
||||
@@ -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);
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 91ab8ca..6af616e 100644
|
||||
index 2cd740a..019a4e1 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -93,6 +93,9 @@ char *termname = "st-256color";
|
||||
@@ -12,30 +12,8 @@ index 91ab8ca..6af616e 100644
|
||||
/* Terminal colors (16 first used in escape sequence) */
|
||||
static const char *colorname[] = {
|
||||
/* 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
|
||||
index 8a16faa..ddf4178 100644
|
||||
index d73152b..f32fd6c 100644
|
||||
--- a/x.c
|
||||
+++ b/x.c
|
||||
@@ -105,6 +105,7 @@ typedef struct {
|
||||
@@ -46,15 +24,7 @@ index 8a16faa..ddf4178 100644
|
||||
int l, t; /* left and top offset */
|
||||
int gm; /* geometry mask */
|
||||
} XWindow;
|
||||
@@ -243,6 +244,7 @@ static char *usedfont = NULL;
|
||||
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)
|
||||
@@ -752,7 +753,7 @@ xresize(int col, int row)
|
||||
|
||||
XFreePixmap(xw.dpy, xw.buf);
|
||||
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
||||
@@ -63,22 +33,32 @@ index 8a16faa..ddf4178 100644
|
||||
XftDrawChange(xw.draw, xw.buf);
|
||||
xclear(0, 0, win.w, win.h);
|
||||
|
||||
@@ -796,6 +798,13 @@ xloadcols(void)
|
||||
@@ -812,6 +813,10 @@ xloadcols(void)
|
||||
else
|
||||
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].pixel &= 0x00FFFFFF;
|
||||
+ dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24;
|
||||
loaded = 1;
|
||||
}
|
||||
|
||||
@@ -1118,11 +1127,23 @@ xinit(int cols, int rows)
|
||||
Window parent;
|
||||
@@ -842,6 +847,12 @@ xsetcolorname(int x, const char *name)
|
||||
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();
|
||||
XColor xmousefg, xmousebg;
|
||||
+ XWindowAttributes attr;
|
||||
@@ -89,20 +69,22 @@ index 8a16faa..ddf4178 100644
|
||||
xw.scr = XDefaultScreen(xw.dpy);
|
||||
- xw.vis = XDefaultVisual(xw.dpy, xw.scr);
|
||||
+
|
||||
+ if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) {
|
||||
+ parent = XRootWindow(xw.dpy, xw.scr);
|
||||
+ xw.depth = 32;
|
||||
+ root = XRootWindow(xw.dpy, xw.scr);
|
||||
+ if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
|
||||
+ parent = root;
|
||||
+
|
||||
+ if (XMatchVisualInfo(xw.dpy, xw.scr, 32, TrueColor, &vis) != 0) {
|
||||
+ xw.vis = vis.visual;
|
||||
+ xw.depth = vis.depth;
|
||||
+ } else {
|
||||
+ XGetWindowAttributes(xw.dpy, parent, &attr);
|
||||
+ xw.vis = attr.visual;
|
||||
+ xw.depth = attr.depth;
|
||||
+ }
|
||||
+
|
||||
+ XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis);
|
||||
+ xw.vis = vis.visual;
|
||||
|
||||
/* font */
|
||||
if (!FcInit())
|
||||
@@ -1132,7 +1153,7 @@ xinit(int cols, int rows)
|
||||
@@ -1148,7 +1173,7 @@ xinit(int cols, int rows)
|
||||
xloadfonts(usedfont, 0);
|
||||
|
||||
/* colors */
|
||||
@@ -111,35 +93,36 @@ index 8a16faa..ddf4178 100644
|
||||
xloadcols();
|
||||
|
||||
/* 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;
|
||||
xw.attrs.colormap = xw.cmap;
|
||||
|
||||
- root = XRootWindow(xw.dpy, xw.scr);
|
||||
- if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
|
||||
- parent = XRootWindow(xw.dpy, xw.scr);
|
||||
xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t,
|
||||
- parent = root;
|
||||
- xw.win = XCreateWindow(xw.dpy, root, xw.l, xw.t,
|
||||
- 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,
|
||||
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
|
||||
| CWEventMask | CWColormap, &xw.attrs);
|
||||
|
||||
memset(&gcvalues, 0, sizeof(gcvalues));
|
||||
gcvalues.graphics_exposures = False;
|
||||
- dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures,
|
||||
- &gcvalues);
|
||||
- xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
||||
if (parent != root)
|
||||
@@ -1183,7 +1205,7 @@ xinit(int cols, int rows)
|
||||
dc.gc = XCreateGC(xw.dpy, xw.win, GCGraphicsExposures,
|
||||
&gcvalues);
|
||||
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
||||
- DefaultDepth(xw.dpy, xw.scr));
|
||||
+ xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth);
|
||||
+ dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues);
|
||||
+ xw.depth);
|
||||
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
|
||||
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':
|
||||
allowaltscreen = 0;
|
||||
break;
|
||||
+ case 'A':
|
||||
+ opt_alpha = EARGF(usage());
|
||||
+ alpha = strtof(EARGF(usage()), NULL);
|
||||
+ LIMIT(alpha, 0.0, 1.0);
|
||||
+ break;
|
||||
case 'c':
|
||||
opt_class = EARGF(usage());
|
||||
@@ -1,8 +1,8 @@
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 6f05dce..93cbcc0 100644
|
||||
index 2cd740a..40b7d93 100644
|
||||
--- a/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} },
|
||||
{ ShiftMask, XK_Insert, selpaste, {.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
|
||||
index ebdf360..817cc47 100644
|
||||
index b9f66e7..2478942 100644
|
||||
--- a/st.c
|
||||
+++ b/st.c
|
||||
@@ -35,6 +35,7 @@
|
||||
@@ -43,7 +43,7 @@ index ebdf360..817cc47 100644
|
||||
int *dirty; /* dirtyness of lines */
|
||||
TCursor c; /* cursor */
|
||||
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 tputc(Rune);
|
||||
static void treset(void);
|
||||
@@ -54,7 +54,7 @@ index ebdf360..817cc47 100644
|
||||
static void tsetattr(const int *, int);
|
||||
static void tsetchar(Rune, const Glyph *, 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;
|
||||
|
||||
@@ -67,7 +67,7 @@ index ebdf360..817cc47 100644
|
||||
--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
|
||||
* beginning of a line.
|
||||
*/
|
||||
@@ -76,7 +76,7 @@ index ebdf360..817cc47 100644
|
||||
prevdelim = ISDELIM(prevgp->u);
|
||||
for (;;) {
|
||||
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;
|
||||
else
|
||||
yt = newy, xt = newx;
|
||||
@@ -93,7 +93,7 @@ index ebdf360..817cc47 100644
|
||||
delim = ISDELIM(gp->u);
|
||||
if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim
|
||||
|| (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;
|
||||
if (direction < 0) {
|
||||
for (; *y > 0; *y += direction) {
|
||||
@@ -110,7 +110,7 @@ index ebdf360..817cc47 100644
|
||||
& ATTR_WRAP)) {
|
||||
break;
|
||||
}
|
||||
@@ -609,13 +616,13 @@ getsel(void)
|
||||
@@ -602,13 +609,13 @@ getsel(void)
|
||||
}
|
||||
|
||||
if (sel.type == SEL_RECTANGULAR) {
|
||||
@@ -127,7 +127,7 @@ index ebdf360..817cc47 100644
|
||||
while (last >= gp && last->u == ' ')
|
||||
--last;
|
||||
|
||||
@@ -850,6 +857,9 @@ void
|
||||
@@ -844,6 +851,9 @@ void
|
||||
ttywrite(const char *s, size_t n, int may_echo)
|
||||
{
|
||||
const char *next;
|
||||
@@ -137,7 +137,7 @@ index ebdf360..817cc47 100644
|
||||
|
||||
if (may_echo && IS_SET(MODE_ECHO))
|
||||
twrite(s, n, 1);
|
||||
@@ -1061,13 +1071,53 @@ tswapscreen(void)
|
||||
@@ -1055,13 +1065,53 @@ tswapscreen(void)
|
||||
}
|
||||
|
||||
void
|
||||
@@ -192,7 +192,7 @@ index ebdf360..817cc47 100644
|
||||
tsetdirt(orig, term.bot-n);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ index ebdf360..817cc47 100644
|
||||
tclearregion(0, orig, term.col-1, orig+n-1);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ index ebdf360..817cc47 100644
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1126,7 +1188,7 @@ tnewline(int first_col)
|
||||
@@ -1120,7 +1182,7 @@ tnewline(int first_col)
|
||||
int y = term.c.y;
|
||||
|
||||
if (y == term.bot) {
|
||||
@@ -242,7 +242,7 @@ index ebdf360..817cc47 100644
|
||||
} else {
|
||||
y++;
|
||||
}
|
||||
@@ -1291,14 +1353,14 @@ void
|
||||
@@ -1285,14 +1347,14 @@ void
|
||||
tinsertblankline(int n)
|
||||
{
|
||||
if (BETWEEN(term.c.y, term.top, term.bot))
|
||||
@@ -259,9 +259,9 @@ index ebdf360..817cc47 100644
|
||||
}
|
||||
|
||||
int32_t
|
||||
@@ -1735,11 +1797,11 @@ csihandle(void)
|
||||
break;
|
||||
@@ -1730,11 +1792,11 @@ csihandle(void)
|
||||
case 'S': /* SU -- Scroll <n> line up */
|
||||
if (csiescseq.priv) break;
|
||||
DEFAULT(csiescseq.arg[0], 1);
|
||||
- tscrollup(term.top, csiescseq.arg[0]);
|
||||
+ tscrollup(term.top, csiescseq.arg[0], 0);
|
||||
@@ -273,7 +273,7 @@ index ebdf360..817cc47 100644
|
||||
break;
|
||||
case 'L': /* IL -- Insert <n> blank lines */
|
||||
DEFAULT(csiescseq.arg[0], 1);
|
||||
@@ -2251,7 +2313,7 @@ eschandle(uchar ascii)
|
||||
@@ -2306,7 +2368,7 @@ eschandle(uchar ascii)
|
||||
return 0;
|
||||
case 'D': /* IND -- Linefeed */
|
||||
if (term.c.y == term.bot) {
|
||||
@@ -282,7 +282,7 @@ index ebdf360..817cc47 100644
|
||||
} else {
|
||||
tmoveto(term.c.x, term.c.y+1);
|
||||
}
|
||||
@@ -2264,7 +2326,7 @@ eschandle(uchar ascii)
|
||||
@@ -2319,7 +2381,7 @@ eschandle(uchar ascii)
|
||||
break;
|
||||
case 'M': /* RI -- Reverse index */
|
||||
if (term.c.y == term.top) {
|
||||
@@ -291,7 +291,7 @@ index ebdf360..817cc47 100644
|
||||
} else {
|
||||
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
|
||||
tresize(int col, int row)
|
||||
{
|
||||
@@ -300,7 +300,7 @@ index ebdf360..817cc47 100644
|
||||
int minrow = MIN(row, term.row);
|
||||
int mincol = MIN(col, term.col);
|
||||
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.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 */
|
||||
for (i = 0; i < minrow; i++) {
|
||||
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;
|
||||
|
||||
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--;
|
||||
|
||||
drawregion(0, 0, term.col, term.row);
|
||||
@@ -337,7 +337,7 @@ index ebdf360..817cc47 100644
|
||||
term.ocy = term.c.y;
|
||||
xfinishdraw();
|
||||
diff --git a/st.h b/st.h
|
||||
index fa2eddf..adda2db 100644
|
||||
index fd3b0d8..818a6f8 100644
|
||||
--- a/st.h
|
||||
+++ b/st.h
|
||||
@@ -81,6 +81,8 @@ void die(const char *, ...);
|
||||
@@ -1,14 +1,14 @@
|
||||
From b5d3351a21442a842e01e8c0317603b6890b379c Mon Sep 17 00:00:00 2001
|
||||
From: asparagii <michele.lambertucci1@gmail.com>
|
||||
Date: Thu, 27 Jan 2022 15:44:02 +0100
|
||||
Subject: [PATCH] st-scrollback-mouse
|
||||
From 6b7e7e6c5c44dd6347ad49691b80d808c1b0cb77 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Jakob <jernej.jakob@gmail.com>
|
||||
Date: Mon, 1 Jul 2024 14:00:02 +0200
|
||||
Subject: [PATCH] [st][patch] Update st-scrollback-mouse for 0.9.2
|
||||
|
||||
---
|
||||
config.def.h | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index e3b469b..c217315 100644
|
||||
index 8b25d40..d259675 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -176,6 +176,8 @@ static uint forcemousemod = ShiftMask;
|
||||
@@ -21,5 +21,5 @@ index e3b469b..c217315 100644
|
||||
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
|
||||
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
|
||||
--
|
||||
2.34.1
|
||||
2.44.2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 2752a599ee01305a435729bfacf43b1dde7cf0ef Mon Sep 17 00:00:00 2001
|
||||
From: Benji Encalada Mora <benji@encalada.dev>
|
||||
Date: Thu, 4 Jun 2020 00:41:10 -0500
|
||||
Subject: [PATCH] fix: replace xfps and actionfps variables
|
||||
From 6315407196933ec86be2b3c74f89bee746353e32 Mon Sep 17 00:00:00 2001
|
||||
From: harishnkr <hari2menon1234@gmail.com>
|
||||
Date: Mon, 20 Mar 2023 14:27:07 +0530
|
||||
Subject: [PATCH] Fix xresources bgcolour fgcolour and cscolour definitions
|
||||
|
||||
---
|
||||
config.def.h | 36 ++++++++++++++++++++++++
|
||||
@@ -9,10 +9,10 @@ Subject: [PATCH] fix: replace xfps and actionfps variables
|
||||
2 files changed, 110 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 6f05dce..9b99782 100644
|
||||
index 91ab8ca..f11db58 100644
|
||||
--- a/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;
|
||||
|
||||
@@ -37,9 +37,9 @@ index 6f05dce..9b99782 100644
|
||||
+ { "color13", STRING, &colorname[13] },
|
||||
+ { "color14", STRING, &colorname[14] },
|
||||
+ { "color15", STRING, &colorname[15] },
|
||||
+ { "background", STRING, &colorname[256] },
|
||||
+ { "foreground", STRING, &colorname[257] },
|
||||
+ { "cursorColor", STRING, &colorname[258] },
|
||||
+ { "background", STRING, &colorname[259] },
|
||||
+ { "foreground", STRING, &colorname[258] },
|
||||
+ { "cursorColor", STRING, &colorname[256] },
|
||||
+ { "termname", STRING, &termname },
|
||||
+ { "shell", STRING, &shell },
|
||||
+ { "minlatency", INTEGER, &minlatency },
|
||||
@@ -50,13 +50,14 @@ index 6f05dce..9b99782 100644
|
||||
+ { "borderpx", INTEGER, &borderpx },
|
||||
+ { "cwscale", FLOAT, &cwscale },
|
||||
+ { "chscale", FLOAT, &chscale },
|
||||
+ { "alpha", FLOAT, &alpha },
|
||||
+};
|
||||
+
|
||||
/*
|
||||
* Internal mouse shortcuts.
|
||||
* Beware that overloading Button1 will disable the selection.
|
||||
diff --git a/x.c b/x.c
|
||||
index 210f184..76f167f 100644
|
||||
index aa09997..ab10269 100644
|
||||
--- a/x.c
|
||||
+++ b/x.c
|
||||
@@ -14,6 +14,7 @@
|
||||
@@ -87,7 +88,7 @@ index 210f184..76f167f 100644
|
||||
/* X modifiers */
|
||||
#define XK_ANY_MOD UINT_MAX
|
||||
#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
|
||||
xhints(void)
|
||||
{
|
||||
@@ -98,7 +99,7 @@ index 210f184..76f167f 100644
|
||||
XWMHints wm = {.flags = InputHint, .input = 1};
|
||||
XSizeHints *sizeh;
|
||||
|
||||
@@ -1104,8 +1118,6 @@ xinit(int cols, int rows)
|
||||
@@ -1135,8 +1149,6 @@ xinit(int cols, int rows)
|
||||
pid_t thispid = getpid();
|
||||
XColor xmousefg, xmousebg;
|
||||
|
||||
@@ -107,7 +108,7 @@ index 210f184..76f167f 100644
|
||||
xw.scr = XDefaultScreen(xw.dpy);
|
||||
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
|
||||
usage(void)
|
||||
{
|
||||
@@ -2037,6 +2102,11 @@ run:
|
||||
@@ -2087,6 +2152,11 @@ run:
|
||||
|
||||
setlocale(LC_CTYPE, "");
|
||||
XSetLocaleModifiers("");
|
||||
@@ -180,5 +181,5 @@ index 210f184..76f167f 100644
|
||||
rows = MAX(rows, 1);
|
||||
tnew(cols, rows);
|
||||
--
|
||||
2.26.2
|
||||
2.39.2
|
||||
|
||||
50
note/docker.org
Normal file
50
note/docker.org
Normal 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
|
||||
Reference in New Issue
Block a user