Update github actions config (#265)

* add tests to editor style; simplify character grid code

* destructure size

* test all editor helpers

* simpler

* setup deps for coverage; setup tarpaulin coverage

* add rustup install

* update github actions config

forgot windows

use scoop

choco install neovim

* add coverage generation

* remove coverage

* set more path vars

try uninstall brew llvm

add neovim test dep

add coverage build

remove patching

new lock file

update cargo file

* font fallback guifont extension

* formatting

* freetype conflict

* update github actions config

forgot windows

use scoop

choco install neovim

add coverage generation

remove coverage

* Better symbol font for linux (#262)

* patch freetype

* move font-kit to deps

* patch font-kit in skribo

* new lock file

* revert cargo file

* checkout cargo and build file

* temporary fix to bypass skia build

* remove sdl patch

* add sdl sys build back

Co-authored-by: keith <keith@the-simmons.net>
Co-authored-by: James Robert Rooke <thepoltergeist23@gmail.com>
macos-click-through
j4qfrost 5 years ago committed by GitHub
parent 253f983194
commit 738dce79e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,13 +10,23 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: "Check formatting"
- name: Check formatting
run: |
cargo fmt --all -- --check
- name: Build
- name: Install Neovim
run: |
choco install -y neovim
- name: Test
env:
NEOVIM_BIN: "C:/tools/neovim/Neovim/bin/nvim.exe"
RUST_BACKTRACE: full
run: |
cargo test
- name: Build Release
run: |
cargo build --release
- uses: actions/upload-artifact@v1
@ -33,13 +43,25 @@ jobs:
- name: Install Vulkan SDK
run: brew cask install apenngrace/vulkan/vulkan-sdk
- name: "Check formatting"
- name: Check formatting
run: |
rustup component add rustfmt --toolchain stable-x86_64-apple-darwin
cargo fmt --all -- --check
- name: Build
- name: Uninstall Conflicting LLVM
run: |
brew uninstall llvm
- name: Install Neovim
run: |
brew install neovim
- name: Test
run: |
RUST_BACKTRACE=full cargo test
- name: Build Release
run: |
cargo test
cargo build --release
cargo install cargo-bundle
cargo bundle --release
@ -55,6 +77,7 @@ jobs:
jq '.ICD.library_path = "../../../Frameworks/libMoltenVK.dylib"' ./Resources/vulkan/icd.d/MoltenVK_icd.json > MoltenVK_icd.json
mv MoltenVK_icd.json ./Resources/vulkan/icd.d/
install_name_tool -add_rpath "@executable_path/../Frameworks" ./MacOS/neovide
- uses: actions/upload-artifact@v1
with:
name: Neovide.app
@ -78,16 +101,23 @@ jobs:
run: |
sudo apt-get install -y curl gnupg ca-certificates git gcc-multilib g++-multilib cmake libssl-dev pkg-config libfreetype6-dev libasound2-dev libexpat1-dev libxcb-composite0-dev libbz2-dev freeglut3-dev libxi-dev libsdl2-dev
- name: "Check formatting"
- name: Check formatting
run: |
cargo fmt --all -- --check
- name: Build
- name: Install Neovim
run: |
sudo apt-get install -y neovim
- name: Test
run: |
RUST_BACKTRACE=full cargo test
- name: Build Release
run: |
cargo test
cargo build --release
- uses: actions/upload-artifact@v1
with:
name: neovide-linux
path: ./target/release/neovide
path: ./target/release/neovide

230
Cargo.lock generated

@ -70,9 +70,9 @@ dependencies = [
[[package]]
name = "arc-swap"
version = "0.4.5"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d663a8e9a99154b5fb793032533f6328da35e23aac63d5c152279aa8ba356825"
checksum = "b585a98a234c46fc563103e9278c9391fde1f4e6850334da895d27edb9580f62"
[[package]]
name = "arrayref"
@ -101,9 +101,9 @@ version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da71fef07bc806586090247e971229289f64c210a278ee5ae419314eb386b31d"
dependencies = [
"proc-macro2 1.0.10",
"quote 1.0.3",
"syn 1.0.17",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
]
[[package]]
@ -151,8 +151,8 @@ dependencies = [
"lazycell",
"log",
"peeking_take_while",
"proc-macro2 1.0.10",
"quote 1.0.3",
"proc-macro2 1.0.12",
"quote 1.0.4",
"regex",
"rustc-hash",
"shlex",
@ -217,9 +217,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.0.50"
version = "1.0.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd"
checksum = "c3d87b23d6a92cd03af510a5ade527033f6aa6fa92161e2d5863a907d4c5e31d"
[[package]]
name = "cexpr"
@ -306,6 +306,21 @@ dependencies = [
"objc",
]
[[package]]
name = "cocoa"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a4736c86d51bd878b474400d9ec888156f4037015f5d09794fab9f26eab1ad4"
dependencies = [
"bitflags",
"block",
"core-foundation 0.7.0",
"core-graphics 0.19.0",
"foreign-types",
"libc",
"objc",
]
[[package]]
name = "color_quant"
version = "1.0.1"
@ -489,9 +504,9 @@ dependencies = [
[[package]]
name = "curl"
version = "0.4.28"
version = "0.4.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eda1c0c03cacf3365d84818a40293f0e3f3953db8759c9c565a3b434edf0b52e"
checksum = "762e34611d2d5233a506a79072be944fddd057db2f18e04c0d6fa79e3fd466fd"
dependencies = [
"curl-sys",
"libc",
@ -504,9 +519,9 @@ dependencies = [
[[package]]
name = "curl-sys"
version = "0.4.30+curl-7.69.1"
version = "0.4.31+curl-7.70.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "923b38e423a8f47a4058e96f2a1fa2865a6231097ee860debd678d244277d50c"
checksum = "dcd62757cc4f5ab9404bc6ca9f0ae447e729a1403948ce5106bd588ceac6a3b0"
dependencies = [
"cc",
"libc",
@ -533,9 +548,9 @@ version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71f31892cd5c62e414316f2963c5689242c43d8e7bbcaaeca97e5e28c95d91d9"
dependencies = [
"proc-macro2 1.0.10",
"quote 1.0.3",
"syn 1.0.17",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
]
[[package]]
@ -842,9 +857,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7"
dependencies = [
"proc-macro-hack",
"proc-macro2 1.0.10",
"quote 1.0.3",
"syn 1.0.17",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
]
[[package]]
@ -951,9 +966,9 @@ dependencies = [
[[package]]
name = "hermit-abi"
version = "0.1.11"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a0d737e0f947a1864e93d33fdef4af8445a00d1ed8dc0c8ddb73139ea6abf15"
checksum = "61565ff7aaace3525556587bd2dc31d4a07071957be715e63ce7b1eccf51a8f4"
dependencies = [
"libc",
]
@ -995,9 +1010,9 @@ dependencies = [
[[package]]
name = "instant"
version = "0.1.2"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c346c299e3fe8ef94dc10c2c0253d858a69aac1245157a3bf4125915d528caf"
checksum = "f7152d2aed88aa566e7a342250f21ba2222c1ae230ad577499dbfa3c18475b80"
[[package]]
name = "iovec"
@ -1016,9 +1031,9 @@ checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e"
[[package]]
name = "jpeg-decoder"
version = "0.1.18"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0256f0aec7352539102a9efbcb75543227b7ab1117e0f95450023af730128451"
checksum = "5b47b4c4e017b01abdc5bcc126d2d1002e5a75bbe3ce73f9f4f311a916363704"
dependencies = [
"byteorder",
"rayon",
@ -1158,14 +1173,14 @@ dependencies = [
[[package]]
name = "metal"
version = "0.17.1"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f83c7dcc2038e12f68493fa3de44235df27b2497178e257185b4b5b5d028a1e4"
checksum = "e198a0ee42bdbe9ef2c09d0b9426f3b2b47d90d93a4a9b0395c4cea605e92dc0"
dependencies = [
"bitflags",
"block",
"cocoa",
"core-graphics 0.17.3",
"cocoa 0.20.0",
"core-graphics 0.19.0",
"foreign-types",
"log",
"objc",
@ -1182,9 +1197,9 @@ dependencies = [
[[package]]
name = "mio"
version = "0.6.21"
version = "0.6.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f"
checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430"
dependencies = [
"cfg-if",
"fuchsia-zircon",
@ -1225,9 +1240,9 @@ dependencies = [
[[package]]
name = "mio-uds"
version = "0.6.7"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125"
checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0"
dependencies = [
"iovec",
"libc",
@ -1278,9 +1293,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447326d4e6d99ea272b6e5599cbbfc1e3407c23a856ccf1eb9427ad73267376f"
dependencies = [
"cfg-if",
"proc-macro2 1.0.10",
"quote 1.0.3",
"syn 1.0.17",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
]
[[package]]
@ -1301,6 +1316,7 @@ dependencies = [
"mockall",
"nvim-rs",
"parking_lot",
"rand",
"rmpv",
"rust-embed",
"sdl2-sys",
@ -1314,9 +1330,9 @@ dependencies = [
[[package]]
name = "net2"
version = "0.2.33"
version = "0.2.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7"
dependencies = [
"cfg-if",
"libc",
@ -1487,9 +1503,9 @@ dependencies = [
[[package]]
name = "parking_lot_core"
version = "0.7.1"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e136c1904604defe99ce5fd71a28d473fa60a12255d511aa78a9ddf11237aeb"
checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3"
dependencies = [
"cfg-if",
"cloudabi",
@ -1545,9 +1561,9 @@ version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8988430ce790d8682672117bc06dda364c0be32d3abd738234f19f3240bad99a"
dependencies = [
"proc-macro2 1.0.10",
"quote 1.0.3",
"syn 1.0.17",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
]
[[package]]
@ -1558,9 +1574,9 @@ checksum = "237844750cfbb86f67afe27eee600dfbbcb6188d734139b534cbfbf4f96792ae"
[[package]]
name = "pin-utils"
version = "0.1.0-alpha.4"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pkg-config"
@ -1580,6 +1596,12 @@ dependencies = [
"inflate",
]
[[package]]
name = "ppv-lite86"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
[[package]]
name = "predicates"
version = "1.0.4"
@ -1632,9 +1654,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.10"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3"
checksum = "8872cf6f48eee44265156c111456a700ab3483686b3f96df4cf5481c89157319"
dependencies = [
"unicode-xid 0.2.0",
]
@ -1656,11 +1678,52 @@ dependencies = [
[[package]]
name = "quote"
version = "1.0.3"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f"
checksum = "4c1f4b0efa5fc5e8ceb705136bfee52cfdb6a4e3509f770b478cd6ed434232a7"
dependencies = [
"proc-macro2 1.0.10",
"proc-macro2 1.0.12",
]
[[package]]
name = "rand"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom",
"libc",
"rand_chacha",
"rand_core",
"rand_hc",
]
[[package]]
name = "rand_chacha"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
"ppv-lite86",
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
"getrandom",
]
[[package]]
name = "rand_hc"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
"rand_core",
]
[[package]]
@ -1780,9 +1843,9 @@ version = "5.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60cacc306d294556771c6e92737ba7e6be0264144bc46dd713a14ef384b0d6b8"
dependencies = [
"quote 1.0.3",
"quote 1.0.4",
"rust-embed-utils",
"syn 1.0.17",
"syn 1.0.18",
"walkdir",
]
@ -1832,9 +1895,9 @@ dependencies = [
[[package]]
name = "ryu"
version = "1.0.3"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "535622e6be132bccd223f4bb2b8ac8d53cda3c7a6394944d3b2b33fb974f9d76"
checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1"
[[package]]
name = "same-file"
@ -1870,7 +1933,8 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "sdl2"
version = "0.33.0"
source = "git+https://github.com/Rust-SDL2/rust-sdl2#2b460ff49a1bde07b6c99111c9cf136f884e9cf2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f74124048ea86b5cd50236b2443f6f57cf4625a8e8818009b4e50dbb8729a43"
dependencies = [
"bitflags",
"lazy_static",
@ -1881,7 +1945,8 @@ dependencies = [
[[package]]
name = "sdl2-sys"
version = "0.33.0"
source = "git+https://github.com/Rust-SDL2/rust-sdl2#2b460ff49a1bde07b6c99111c9cf136f884e9cf2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2e1deb61ff274d29fb985017d4611d4004b113676eaa9c06754194caf82094e"
dependencies = [
"cfg-if",
"cmake",
@ -1914,9 +1979,9 @@ checksum = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399"
[[package]]
name = "serde_json"
version = "1.0.51"
version = "1.0.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da07b57ee2623368351e9a0488bb0b261322a15a6e0ae53e243cbdc0f4208da9"
checksum = "a7894c8ed05b7a3a279aeb79025fdec1d3158080b75b98a08faf2806bb799edd"
dependencies = [
"itoa",
"ryu",
@ -2014,7 +2079,7 @@ dependencies = [
[[package]]
name = "skulpin"
version = "0.9.0"
source = "git+https://github.com/kethku/skulpin?branch=windows-dpi-fix#24ce66e217980490e5891fa113ade2c9dbec02c6"
source = "git+https://github.com/j4qfrost/skulpin?branch=update-macos-deps#7ae2c4f6567e7f91c7dd4fbd81d2e07fcfad861d"
dependencies = [
"log",
"skulpin-app-winit",
@ -2026,7 +2091,7 @@ dependencies = [
[[package]]
name = "skulpin-app-winit"
version = "0.3.0"
source = "git+https://github.com/kethku/skulpin?branch=windows-dpi-fix#24ce66e217980490e5891fa113ade2c9dbec02c6"
source = "git+https://github.com/j4qfrost/skulpin?branch=update-macos-deps#7ae2c4f6567e7f91c7dd4fbd81d2e07fcfad861d"
dependencies = [
"log",
"skulpin-renderer",
@ -2036,7 +2101,7 @@ dependencies = [
[[package]]
name = "skulpin-renderer"
version = "0.3.0"
source = "git+https://github.com/kethku/skulpin?branch=windows-dpi-fix#24ce66e217980490e5891fa113ade2c9dbec02c6"
source = "git+https://github.com/j4qfrost/skulpin?branch=update-macos-deps#7ae2c4f6567e7f91c7dd4fbd81d2e07fcfad861d"
dependencies = [
"ash",
"log",
@ -2047,7 +2112,7 @@ dependencies = [
[[package]]
name = "skulpin-renderer-sdl2"
version = "0.3.0"
source = "git+https://github.com/kethku/skulpin?branch=windows-dpi-fix#24ce66e217980490e5891fa113ade2c9dbec02c6"
source = "git+https://github.com/j4qfrost/skulpin?branch=update-macos-deps#7ae2c4f6567e7f91c7dd4fbd81d2e07fcfad861d"
dependencies = [
"log",
"sdl2",
@ -2057,9 +2122,9 @@ dependencies = [
[[package]]
name = "skulpin-renderer-winit"
version = "0.3.0"
source = "git+https://github.com/kethku/skulpin?branch=windows-dpi-fix#24ce66e217980490e5891fa113ade2c9dbec02c6"
source = "git+https://github.com/j4qfrost/skulpin?branch=update-macos-deps#7ae2c4f6567e7f91c7dd4fbd81d2e07fcfad861d"
dependencies = [
"cocoa",
"cocoa 0.20.0",
"log",
"metal",
"objc",
@ -2077,9 +2142,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
[[package]]
name = "smallvec"
version = "1.3.0"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05720e22615919e4734f6a99ceae50d00226c3c5aca406e102ebc33298214e0a"
checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4"
[[package]]
name = "smithay-client-toolkit"
@ -2137,12 +2202,12 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.17"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03"
checksum = "410a7488c0a728c7ceb4ad59b9567eb4053d02e8cc7f5c0e0eeeb39518369213"
dependencies = [
"proc-macro2 1.0.10",
"quote 1.0.3",
"proc-macro2 1.0.12",
"quote 1.0.4",
"unicode-xid 0.2.0",
]
@ -2199,20 +2264,19 @@ dependencies = [
[[package]]
name = "time"
version = "0.1.42"
version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
dependencies = [
"libc",
"redox_syscall",
"winapi 0.3.8",
]
[[package]]
name = "tokio"
version = "0.2.18"
version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34ef16d072d2b6dc8b4a56c70f5c5ced1a37752116f8e7c1e80c659aa7cb6713"
checksum = "05c1d570eb1a36f0345a5ce9c6c6e665b70b73d11236912c0b477616aeec47b1"
dependencies = [
"bytes 0.5.4",
"fnv",
@ -2248,9 +2312,9 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389"
dependencies = [
"proc-macro2 1.0.10",
"quote 1.0.3",
"syn 1.0.17",
"proc-macro2 1.0.12",
"quote 1.0.4",
"syn 1.0.18",
]
[[package]]
@ -2452,9 +2516,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.4"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa515c5163a99cc82bab70fd3bfdd36d827be85de63737b40fcef2ce084a436e"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi 0.3.8",
]
@ -2473,7 +2537,7 @@ checksum = "fc53342d3d1a3d57f3949e0692d93d5a8adb7814d8683cef4a09c2b550e94246"
dependencies = [
"android_glue",
"bitflags",
"cocoa",
"cocoa 0.19.1",
"core-foundation 0.6.4",
"core-graphics 0.17.3",
"core-video-sys",
@ -2551,6 +2615,6 @@ checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57"
[[package]]
name = "xml-rs"
version = "0.8.2"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bb76e5c421bbbeb8924c60c030331b345555024d56261dae8f3e786ed817c23"
checksum = "b07db065a5cf61a7e4ba64f29e67db906fb1787316516c4e6e5ff0fea1efcd8a"

@ -15,7 +15,7 @@ euclid = "0.20.7"
font-kit = "0.6.0"
skribo = { git = "https://github.com/linebender/skribo" }
lru = "0.4.3"
skulpin = { git = "https://github.com/kethku/skulpin", branch = "windows-dpi-fix", features = ["skulpin_sdl2"] }
skulpin = { git = "https://github.com/j4qfrost/skulpin", branch = "update-macos-deps", features = ["skulpin_sdl2"] }
derive-new = "0.5"
rmpv = "0.4.4"
rust-embed = { version = "5.2.0", features = ["debug-embed"] }
@ -33,16 +33,17 @@ cfg-if = "0.1.10"
[dev-dependencies]
mockall = "0.7.0"
rand = "0.7"
[target.'cfg(windows)'.dependencies]
winapi = "0.3.8"
[build-dependencies]
winres = "0.1.11"
sdl2-sys = { git = "https://github.com/Rust-SDL2/rust-sdl2", default-features = false, features = ["bundled", "static-link"] }
sdl2-sys = { version = "0.33", default-features = false, features = ["bundled", "static-link"] }
[patch.crates-io]
sdl2 = { git = "https://github.com/Rust-SDL2/rust-sdl2", default-features = false }
# [patch.crates-io]
# sdl2 = { git = "https://github.com/Rust-SDL2/rust-sdl2", default-features = false }
[profile.release]
debug = true

@ -107,3 +107,126 @@ impl Cursor {
self.blinkoff = *blinkoff;
}
}
#[cfg(test)]
mod tests {
use super::*;
const COLORS: Colors = Colors {
foreground: Some(Color4f::new(0.1, 0.1, 0.1, 0.1)),
background: Some(Color4f::new(0.2, 0.1, 0.1, 0.1)),
special: Some(Color4f::new(0.3, 0.1, 0.1, 0.1)),
};
const DEFAULT_COLORS: Colors = Colors {
foreground: Some(Color4f::new(0.1, 0.2, 0.1, 0.1)),
background: Some(Color4f::new(0.2, 0.2, 0.1, 0.1)),
special: Some(Color4f::new(0.3, 0.2, 0.1, 0.1)),
};
const NONE_COLORS: Colors = Colors {
foreground: None,
background: None,
special: None,
};
#[test]
fn test_from_type_name() {
assert_eq!(
CursorShape::from_type_name("block"),
Some(CursorShape::Block)
);
assert_eq!(
CursorShape::from_type_name("horizontal"),
Some(CursorShape::Horizontal)
);
assert_eq!(
CursorShape::from_type_name("vertical"),
Some(CursorShape::Vertical)
);
}
#[test]
fn test_foreground() {
let mut cursor = Cursor::new();
let style = Some(Arc::new(Style::new(COLORS)));
assert_eq!(
cursor.foreground(&DEFAULT_COLORS),
DEFAULT_COLORS.background.clone().unwrap()
);
cursor.style = style.clone();
assert_eq!(
cursor.foreground(&DEFAULT_COLORS),
COLORS.foreground.clone().unwrap()
);
cursor.style = Some(Arc::new(Style::new(NONE_COLORS)));
assert_eq!(
cursor.foreground(&DEFAULT_COLORS),
DEFAULT_COLORS.background.clone().unwrap()
);
}
#[test]
fn test_background() {
let mut cursor = Cursor::new();
let style = Some(Arc::new(Style::new(COLORS)));
assert_eq!(
cursor.background(&DEFAULT_COLORS),
DEFAULT_COLORS.foreground.clone().unwrap()
);
cursor.style = style.clone();
assert_eq!(
cursor.background(&DEFAULT_COLORS),
COLORS.background.clone().unwrap()
);
cursor.style = Some(Arc::new(Style::new(NONE_COLORS)));
assert_eq!(
cursor.background(&DEFAULT_COLORS),
DEFAULT_COLORS.foreground.clone().unwrap()
);
}
#[test]
fn test_change_mode() {
let cursor_mode = CursorMode {
shape: Some(CursorShape::Horizontal),
style_id: Some(1),
cell_percentage: Some(100.0),
blinkwait: Some(1),
blinkon: Some(1),
blinkoff: Some(1),
};
let mut styles = HashMap::new();
styles.insert(1, Arc::new(Style::new(COLORS)));
let mut cursor = Cursor::new();
cursor.change_mode(&cursor_mode, &styles);
assert_eq!(cursor.shape, CursorShape::Horizontal);
assert_eq!(cursor.style, styles.get(&1).cloned());
assert_eq!(cursor.cell_percentage, Some(100.0));
assert_eq!(cursor.blinkwait, Some(1));
assert_eq!(cursor.blinkon, Some(1));
assert_eq!(cursor.blinkoff, Some(1));
let cursor_mode_with_none = CursorMode {
shape: None,
style_id: None,
cell_percentage: None,
blinkwait: None,
blinkon: None,
blinkoff: None,
};
cursor.change_mode(&cursor_mode_with_none, &styles);
assert_eq!(cursor.shape, CursorShape::Horizontal);
assert_eq!(cursor.style, styles.get(&1).cloned());
assert_eq!(cursor.cell_percentage, None);
assert_eq!(cursor.blinkwait, None);
assert_eq!(cursor.blinkon, None);
assert_eq!(cursor.blinkoff, None);
}
}

@ -16,16 +16,15 @@ pub struct CharacterGrid {
impl CharacterGrid {
pub fn new(size: (u64, u64)) -> CharacterGrid {
let mut result = CharacterGrid {
characters: vec![],
dirty: vec![],
width: 0,
height: 0,
let (width, height) = size;
let cell_count = (width * height) as usize;
CharacterGrid {
characters: vec![None; cell_count],
dirty: vec![true; cell_count],
width,
height,
should_clear: true,
};
result.resize(size.0, size.1);
result
}
}
pub fn resize(&mut self, width: u64, height: u64) {
@ -37,12 +36,8 @@ impl CharacterGrid {
pub fn clear(&mut self) {
trace!("Editor cleared");
self.characters.clear();
self.dirty.clear();
let cell_count = (self.width * self.height) as usize;
self.characters.resize_with(cell_count, || None);
self.dirty.resize_with(cell_count, || true);
self.set_characters_all(None);
self.set_dirty_all(true);
self.should_clear = true;
}
@ -83,9 +78,243 @@ impl CharacterGrid {
.resize_with((self.width * self.height) as usize, || value);
}
pub fn set_characters_all(&mut self, value: GridCell) {
let cloned_value = value.clone();
self.characters.clear();
self.characters
.resize_with((self.width * self.height) as usize, || {
cloned_value.as_ref().cloned()
});
}
pub fn rows(&self) -> impl Iterator<Item = &[GridCell]> {
(0..self.height).map(move |row| {
&self.characters[(row * self.width) as usize..((row + 1) * self.width) as usize]
})
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::editor::style::Colors;
use rand::*;
#[derive(Debug)]
struct Context {
none_colors: Colors,
size: (u64, u64),
x: u64,
y: u64,
area: usize,
index: usize,
}
impl Context {
fn new() -> Self {
let size = (
(thread_rng().gen::<u64>() % 500) + 1,
(thread_rng().gen::<u64>() % 500) + 1,
);
let (x, y) = (
thread_rng().gen::<u64>() % size.0,
thread_rng().gen::<u64>() % size.1,
);
Self {
none_colors: Colors {
foreground: None,
background: None,
special: None,
},
size,
x,
y,
area: (size.0 * size.1) as usize,
index: (x + y * size.0) as usize,
}
}
}
#[test]
fn test_new() {
let context = Context::new();
// RUN FUNCTION
let character_grid = CharacterGrid::new(context.size);
assert_eq!(character_grid.width, context.size.0);
assert_eq!(character_grid.height, context.size.1);
assert_eq!(character_grid.should_clear, true);
assert_eq!(character_grid.characters, vec![None; context.area]);
assert_eq!(character_grid.dirty, vec![true; context.area]);
}
#[test]
fn test_get_cell() {
let context = Context::new();
let mut character_grid = CharacterGrid::new(context.size);
character_grid.characters[context.index] = Some((
"foo".to_string(),
Some(Arc::new(Style::new(context.none_colors.clone()))),
));
let result = (
"foo".to_string(),
Some(Arc::new(Style::new(context.none_colors.clone()))),
);
// RUN FUNCTION
assert_eq!(
character_grid
.get_cell(context.x, context.y)
.unwrap()
.as_ref()
.unwrap(),
&result
);
}
#[test]
fn test_get_cell_mut() {
let context = Context::new();
let mut character_grid = CharacterGrid::new(context.size);
character_grid.characters[context.index] = Some((
"foo".to_string(),
Some(Arc::new(Style::new(context.none_colors.clone()))),
));
let result = (
"bar".to_string(),
Some(Arc::new(Style::new(context.none_colors.clone()))),
);
// RUN FUNCTION
let cell = character_grid.get_cell_mut(context.x, context.y).unwrap();
*cell = Some((
"bar".to_string(),
Some(Arc::new(Style::new(context.none_colors.clone()))),
));
assert_eq!(
character_grid
.get_cell_mut(context.x, context.y)
.unwrap()
.as_ref()
.unwrap(),
&result
);
}
#[test]
fn test_is_dirty_cell() {
let context = Context::new();
let mut character_grid = CharacterGrid::new(context.size);
character_grid.dirty[context.index] = false;
// RUN FUNCTION
assert!(!character_grid.is_dirty_cell(context.x, context.y));
}
#[test]
fn test_set_dirty_cell() {
let context = Context::new();
let mut character_grid = CharacterGrid::new(context.size);
character_grid.dirty = vec![false; context.area];
// RUN FUNCTION
character_grid.set_dirty_cell(context.x, context.y);
assert!(character_grid.dirty[context.index]);
}
#[test]
fn test_set_dirty_all() {
let context = Context::new();
let mut character_grid = CharacterGrid::new(context.size);
// RUN FUNCTION
character_grid.set_dirty_all(false);
assert_eq!(character_grid.dirty, vec![false; context.area]);
}
#[test]
fn test_set_characters_all() {
let context = Context::new();
let grid_cell = Some((
"foo".to_string(),
Some(Arc::new(Style::new(context.none_colors))),
));
let mut character_grid = CharacterGrid::new(context.size);
// RUN FUNCTION
character_grid.set_characters_all(grid_cell.clone());
assert_eq!(
character_grid.characters,
vec![grid_cell.clone(); context.area]
);
}
#[test]
fn test_clear() {
let context = Context::new();
let mut character_grid = CharacterGrid::new(context.size);
let grid_cell = Some((
"foo".to_string(),
Some(Arc::new(Style::new(context.none_colors))),
));
character_grid.dirty = vec![false; context.area];
character_grid.characters = vec![grid_cell.clone(); context.area];
character_grid.should_clear = false;
// RUN FUNCTION
character_grid.clear();
assert_eq!(character_grid.width, context.size.0);
assert_eq!(character_grid.height, context.size.1);
assert_eq!(character_grid.should_clear, true);
assert_eq!(character_grid.characters, vec![None; context.area]);
assert_eq!(character_grid.dirty, vec![true; context.area]);
}
#[test]
fn test_resize() {
let context = Context::new();
let mut character_grid = CharacterGrid::new(context.size);
let (width, height) = (
(thread_rng().gen::<u64>() % 500) + 1,
(thread_rng().gen::<u64>() % 500) + 1,
);
let new_area = (width * height) as usize;
let grid_cell = Some((
"foo".to_string(),
Some(Arc::new(Style::new(context.none_colors))),
));
character_grid.dirty = vec![false; context.area];
character_grid.characters = vec![grid_cell.clone(); context.area];
character_grid.should_clear = false;
// RUN FUNCTION
character_grid.resize(width, height);
assert_eq!(character_grid.width, width);
assert_eq!(character_grid.height, height);
assert_eq!(character_grid.should_clear, true);
assert_eq!(character_grid.characters, vec![None; new_area]);
assert_eq!(character_grid.dirty, vec![true; new_area]);
}
#[test]
fn test_rows() {
let context = Context::new();
let character_grid = CharacterGrid::new(context.size);
let mut end = 0;
// RUN FUNCTION
for (row_index, row) in character_grid.rows().enumerate() {
assert_eq!(row.len(), context.size.0 as usize);
end = row_index;
}
assert_eq!(end, (context.size.1 - 1) as usize);
}
}

@ -44,7 +44,7 @@ pub struct Editor {
impl Editor {
pub fn new() -> Editor {
let mut editor = Editor {
Editor {
grid: CharacterGrid::new(window_geometry_or_default()),
title: "Neovide".to_string(),
mouse_enabled: true,
@ -59,10 +59,7 @@ impl Editor {
previous_style: None,
mode_list: Vec::new(),
current_mode: EditorMode::Unknown(String::from("")),
};
editor.grid.clear();
editor
}
}
pub fn handle_redraw_event(&mut self, event: RedrawEvent) {

@ -62,3 +62,97 @@ impl Style {
.unwrap_or_else(|| default_colors.special.clone().unwrap())
}
}
#[cfg(test)]
mod tests {
use super::*;
const COLORS: Colors = Colors {
foreground: Some(Color4f::new(0.1, 0.1, 0.1, 0.1)),
background: Some(Color4f::new(0.2, 0.1, 0.1, 0.1)),
special: Some(Color4f::new(0.3, 0.1, 0.1, 0.1)),
};
const DEFAULT_COLORS: Colors = Colors {
foreground: Some(Color4f::new(0.1, 0.2, 0.1, 0.1)),
background: Some(Color4f::new(0.2, 0.2, 0.1, 0.1)),
special: Some(Color4f::new(0.3, 0.2, 0.1, 0.1)),
};
#[test]
fn test_foreground() {
let mut style = Style::new(COLORS);
assert_eq!(
style.foreground(&DEFAULT_COLORS),
COLORS.foreground.clone().unwrap()
);
style.colors.foreground = None;
assert_eq!(
style.foreground(&DEFAULT_COLORS),
DEFAULT_COLORS.foreground.clone().unwrap()
);
}
#[test]
fn test_foreground_reverse() {
let mut style = Style::new(COLORS);
style.reverse = true;
assert_eq!(
style.foreground(&DEFAULT_COLORS),
COLORS.background.clone().unwrap()
);
style.colors.background = None;
assert_eq!(
style.foreground(&DEFAULT_COLORS),
DEFAULT_COLORS.background.clone().unwrap()
);
}
#[test]
fn test_background() {
let mut style = Style::new(COLORS);
assert_eq!(
style.background(&DEFAULT_COLORS),
COLORS.background.clone().unwrap()
);
style.colors.background = None;
assert_eq!(
style.background(&DEFAULT_COLORS),
DEFAULT_COLORS.background.clone().unwrap()
);
}
#[test]
fn test_background_reverse() {
let mut style = Style::new(COLORS);
style.reverse = true;
assert_eq!(
style.background(&DEFAULT_COLORS),
COLORS.foreground.clone().unwrap()
);
style.colors.foreground = None;
assert_eq!(
style.background(&DEFAULT_COLORS),
DEFAULT_COLORS.foreground.clone().unwrap()
);
}
#[test]
fn test_special() {
let mut style = Style::new(COLORS);
assert_eq!(
style.special(&DEFAULT_COLORS),
COLORS.special.clone().unwrap()
);
style.colors.special = None;
assert_eq!(
style.special(&DEFAULT_COLORS),
DEFAULT_COLORS.special.clone().unwrap()
);
}
}

Loading…
Cancel
Save