Skip to content

Commit

Permalink
deps src: Automatic update
Browse files Browse the repository at this point in the history
  • Loading branch information
marvim committed Nov 17, 2023
1 parent 68976ec commit 9fb92dd
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 27 deletions.
34 changes: 17 additions & 17 deletions src/libtermkey-stamp/download-libtermkey.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ function(check_file_hash has_hash hash_is_good)
set("${has_hash}" TRUE PARENT_SCOPE)

message(STATUS "verifying file...
file='/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/v0.22.tar.gz'")
file='/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz'")

file("SHA256" "/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/v0.22.tar.gz" actual_value)
file("SHA256" "/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz" actual_value)

if(NOT "${actual_value}" STREQUAL "81cac2b685c9ada4ead4ea788fb69ff74fc1947ad188ed0264c646fe12b496ba")
if(NOT "${actual_value}" STREQUAL "5eb3e50af54312817bd56fa63b9f8dbd12ec11cedbcf8a7aa0fd79950cc83259")
set("${hash_is_good}" FALSE PARENT_SCOPE)
message(STATUS "SHA256 hash of
/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/v0.22.tar.gz
/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz
does not match expected value
expected: '81cac2b685c9ada4ead4ea788fb69ff74fc1947ad188ed0264c646fe12b496ba'
expected: '5eb3e50af54312817bd56fa63b9f8dbd12ec11cedbcf8a7aa0fd79950cc83259'
actual: '${actual_value}'")
else()
set("${hash_is_good}" TRUE PARENT_SCOPE)
Expand Down Expand Up @@ -71,40 +71,40 @@ function(sleep_before_download attempt)
execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep "${sleep_seconds}")
endfunction()

if("/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/v0.22.tar.gz" STREQUAL "")
if("/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz" STREQUAL "")
message(FATAL_ERROR "LOCAL can't be empty")
endif()

if("https://github.com/neovim/libtermkey/archive/v0.22.tar.gz" STREQUAL "")
if("https://github.com/neovim/libtermkey/archive/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz" STREQUAL "")
message(FATAL_ERROR "REMOTE can't be empty")
endif()

if(EXISTS "/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/v0.22.tar.gz")
if(EXISTS "/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz")
check_file_hash(has_hash hash_is_good)
if(has_hash)
if(hash_is_good)
message(STATUS "File already exists and hash match (skip download):
file='/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/v0.22.tar.gz'
SHA256='81cac2b685c9ada4ead4ea788fb69ff74fc1947ad188ed0264c646fe12b496ba'"
file='/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz'
SHA256='5eb3e50af54312817bd56fa63b9f8dbd12ec11cedbcf8a7aa0fd79950cc83259'"
)
return()
else()
message(STATUS "File already exists but hash mismatch. Removing...")
file(REMOVE "/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/v0.22.tar.gz")
file(REMOVE "/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz")
endif()
else()
message(STATUS "File already exists but no hash specified (use URL_HASH):
file='/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/v0.22.tar.gz'
file='/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz'
Old file will be removed and new file downloaded from URL."
)
file(REMOVE "/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/v0.22.tar.gz")
file(REMOVE "/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz")
endif()
endif()

set(retry_number 5)

message(STATUS "Downloading...
dst='/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/v0.22.tar.gz'
dst='/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz'
timeout='none'
inactivity timeout='none'"
)
Expand All @@ -115,7 +115,7 @@ foreach(i RANGE ${retry_number})
if(status_code IN_LIST download_retry_codes)
sleep_before_download(${i})
endif()
foreach(url https://github.com/neovim/libtermkey/archive/v0.22.tar.gz)
foreach(url https://github.com/neovim/libtermkey/archive/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz)
if(NOT url IN_LIST skip_url_list)
message(STATUS "Using src='${url}'")

Expand All @@ -126,7 +126,7 @@ foreach(i RANGE ${retry_number})

file(
DOWNLOAD
"${url}" "/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/v0.22.tar.gz"
"${url}" "/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz"

# no TIMEOUT
# no INACTIVITY_TIMEOUT
Expand All @@ -143,7 +143,7 @@ foreach(i RANGE ${retry_number})
check_file_hash(has_hash hash_is_good)
if(has_hash AND NOT hash_is_good)
message(STATUS "Hash mismatch, removing...")
file(REMOVE "/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/v0.22.tar.gz")
file(REMOVE "/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz")
else()
message(STATUS "Downloading... done")
return()
Expand Down
2 changes: 1 addition & 1 deletion src/libtermkey-stamp/extract-libtermkey.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.5)

# Make file names absolute:
#
get_filename_component(filename "/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/v0.22.tar.gz" ABSOLUTE)
get_filename_component(filename "/home/runner/work/deps/deps/neovim/deps/build/downloads/libtermkey/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz" ABSOLUTE)
get_filename_component(directory "/home/runner/work/deps/deps/neovim/deps/build/src/libtermkey" ABSOLUTE)

message(STATUS "extracting...
Expand Down
4 changes: 2 additions & 2 deletions src/libtermkey-stamp/libtermkey-urlinfo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ method=url
command=/usr/local/bin/cmake;-P;/home/runner/work/deps/deps/neovim/deps/build/src/libtermkey-stamp/download-libtermkey.cmake;COMMAND;/usr/local/bin/cmake;-P;/home/runner/work/deps/deps/neovim/deps/build/src/libtermkey-stamp/verify-libtermkey.cmake;COMMAND;/usr/local/bin/cmake;-P;/home/runner/work/deps/deps/neovim/deps/build/src/libtermkey-stamp/extract-libtermkey.cmake
source_dir=/home/runner/work/deps/deps/neovim/deps/build/src/libtermkey
work_dir=/home/runner/work/deps/deps/neovim/deps/build/src
url(s)=https://github.com/neovim/libtermkey/archive/v0.22.tar.gz
hash=SHA256=81cac2b685c9ada4ead4ea788fb69ff74fc1947ad188ed0264c646fe12b496ba
url(s)=https://github.com/neovim/libtermkey/archive/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz
hash=SHA256=5eb3e50af54312817bd56fa63b9f8dbd12ec11cedbcf8a7aa0fd79950cc83259
no_extract=

4 changes: 4 additions & 0 deletions src/libtermkey/.github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# libtermkey mirror

This is a github mirror of https://www.leonerd.org.uk/code/libtermkey/. The
code is in the branch `mirror`.
44 changes: 44 additions & 0 deletions src/libtermkey/.github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: sync
on:
schedule:
- cron: '30 1 * * *' # Run every day at 01:30
workflow_dispatch:

permissions:
contents: write

jobs:
mirror:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: mirror
- run: sudo apt-get install brz

- name: Set up git config
run: |
git config --global user.name 'marvim'
git config --global user.email '[email protected]'
- run: git pull bzr::http://bazaar.leonerd.org.uk/c/libtermkey --tags --rebase
- run: |
git push --force-with-lease
git push --tags
nvim:
runs-on: ubuntu-latest
needs: mirror
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up git config
run: |
git config --global user.name 'marvim'
git config --global user.email '[email protected]'
- run: git merge origin/mirror -m "Merge mirror"
- run: git push
4 changes: 2 additions & 2 deletions src/libtermkey/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ TESTSOURCES=$(wildcard t/[0-9]*.c)
TESTFILES=$(TESTSOURCES:.c=.t)

VERSION_MAJOR=0
VERSION_MINOR=22
VERSION_MINOR=23

VERSION=$(VERSION_MAJOR).$(VERSION_MINOR)

VERSION_CURRENT=15
VERSION_REVISION=2
VERSION_REVISION=3
VERSION_AGE=14

PREFIX=/usr/local
Expand Down
6 changes: 5 additions & 1 deletion src/libtermkey/driver-csi.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ TermKeyResult termkey_interpret_mouse(TermKey *tk, const TermKeyKey *key, TermKe

case 64:
case 65:
case 66:
case 67:
*event = drag ? TERMKEY_MOUSE_DRAG : TERMKEY_MOUSE_PRESS;
btn = code + 4 - 64;
break;
Expand Down Expand Up @@ -322,7 +324,7 @@ TermKeyResult termkey_interpret_modereport(TermKey *tk, const TermKeyKey *key, i
*initial = key->code.mouse[0];

if(mode)
*mode = (key->code.mouse[1] << 8) | key->code.mouse[2];
*mode = ((uint8_t)key->code.mouse[1] << 8) | (uint8_t)key->code.mouse[2];

if(value)
*value = key->code.mouse[3];
Expand Down Expand Up @@ -653,6 +655,8 @@ static TermKeyResult peekkey_ctrlstring(TermKey *tk, TermKeyCsi *csi, size_t int
size_t str_end = introlen;

while(str_end < tk->buffcount) {
if(CHARAT(str_end) == 0x07) // BEL
break;
if(CHARAT(str_end) == 0x9c) // ST
break;
if(CHARAT(str_end) == 0x1b &&
Expand Down
25 changes: 22 additions & 3 deletions src/libtermkey/driver-ti.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,28 @@ static int load_terminfo(TermKeyTI *ti)
}

/* Finally mouse mode */
try_load_terminfo_key(ti, "key_mouse", &(struct keyinfo){
.type = TERMKEY_TYPE_MOUSE,
});
{
const char *value = NULL;

#ifdef HAVE_UNIBILIUM
if(ti->unibi)
value = unibi_get_str_by_name(ti->unibi, "key_mouse");
#else
if(ti->term)
value = tigetstr("key_mouse");
#endif

if(ti->tk->ti_getstr_hook)
value = (ti->tk->ti_getstr_hook)("key_mouse", value, ti->tk->ti_getstr_hook_data);

/* Some terminfos (e.g. xterm-1006) claim a different key_mouse that won't
* give X10 encoding. We'll only accept this if it's exactly "\e[M"
*/
if(value && streq(value, "\x1b[M")) {
struct trie_node *node = new_node_key(TERMKEY_TYPE_MOUSE, 0, 0, 0);
insert_seq(ti, value, node);
}
}

/* Take copies of these terminfo strings, in case we build multiple termkey
* instances for multiple different termtypes, and it's different by the
Expand Down
22 changes: 21 additions & 1 deletion src/libtermkey/t/30mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ int main(int argc, char *argv[])
char buffer[32];
size_t len;

plan_tests(60);
plan_tests(66);

tk = termkey_new_abstract("vt100", 0);

Expand Down Expand Up @@ -80,6 +80,26 @@ int main(int argc, char *argv[])
is_int(len, 15, "string length for Ctrl-press");
is_str(buffer, "C-MousePress(1)", "string buffer for Ctrl-press");

termkey_push_bytes(tk, "\x1b[M`!!", 6);

key.type = -1;
ev = -1; button = -1; line = -1; col = -1;
termkey_getkey(tk, &key);
is_int(termkey_interpret_mouse(tk, &key, &ev, &button, &line, &col), TERMKEY_RES_KEY, "interpret_mouse yields RES_KEY");

is_int(ev, TERMKEY_MOUSE_PRESS, "mouse event for wheel down");
is_int(button, 4, "mouse button for wheel down");

termkey_push_bytes(tk, "\x1b[Mb!!", 6);

key.type = -1;
ev = -1; button = -1; line = -1; col = -1;
termkey_getkey(tk, &key);
is_int(termkey_interpret_mouse(tk, &key, &ev, &button, &line, &col), TERMKEY_RES_KEY, "interpret_mouse yields RES_KEY");

is_int(ev, TERMKEY_MOUSE_PRESS, "mouse event for wheel left");
is_int(button, 6, "mouse button for wheel left");

// rxvt protocol
termkey_push_bytes(tk, "\x1b[0;20;20M", 10);

Expand Down

0 comments on commit 9fb92dd

Please sign in to comment.