Merge branch 'master' into ext_cmdline

This commit is contained in:
daa 2018-01-01 17:56:10 +03:00
commit 0b2fc12c4e
39 changed files with 996 additions and 679 deletions

531
Cargo.lock generated
View File

@ -1,65 +1,36 @@
[root]
name = "nvim-gtk"
version = "0.2.0"
dependencies = [
"cairo-rs 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gtk 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gtk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"neovim-lib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pango 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pangocairo 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"rmpv 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "aho-corasick"
version = "0.6.3"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "atk-sys"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bitflags"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bitflags"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "byteorder"
version = "1.1.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -69,23 +40,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cairo-rs"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cairo-sys-rs"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -95,19 +66,6 @@ name = "cfg-if"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "conv"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "custom_derive"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "dtoa"
version = "0.4.2"
@ -118,164 +76,178 @@ name = "env_logger"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gdk"
version = "0.6.0"
name = "fuchsia-zircon"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-rs 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-pixbuf 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"pango 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-zircon-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "fuchsia-zircon-sys"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "gdk"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-pixbuf 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"pango 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gdk-pixbuf"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gdk-pixbuf-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-pixbuf-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gdk-pixbuf-sys"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gdk-sys"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-pixbuf-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-pixbuf-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gio"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gio-sys"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "glib"
version = "0.3.0"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "glib-sys"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gobject-sys"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gtk"
version = "0.2.0"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-rs 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-pixbuf 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-pixbuf-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gtk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"pango 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-pixbuf 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-pixbuf-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gtk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"pango 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "gtk-sys"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"atk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-pixbuf-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"atk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-pixbuf-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -291,42 +263,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "lazy_static"
version = "0.2.8"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "lazy_static"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
version = "0.2.29"
version = "0.2.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "log"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "magenta"
version = "0.1.1"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "magenta-sys"
version = "0.1.1"
name = "log"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "memchr"
version = "1.0.1"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -334,65 +305,99 @@ name = "neovim-lib"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rmp 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)",
"rmpv 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-traits"
version = "0.1.40"
version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "pango"
name = "nvim-gtk"
version = "0.2.0"
dependencies = [
"cairo-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gdk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gio 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gtk 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gtk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"neovim-lib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pango 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pangocairo 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"pangocairo-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"rmpv 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "pango"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "pango-sys"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "pangocairo"
version = "0.2.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cairo-rs 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pango 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pangocairo-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"pango 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pangocairo-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "pangocairo-sys"
version = "0.4.0"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cairo-sys-rs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
"pango-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -419,7 +424,7 @@ version = "0.7.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -442,37 +447,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rand"
version = "0.3.16"
version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-zircon 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "regex"
version = "0.2.2"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "regex-syntax"
version = "0.4.1"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rmp"
version = "0.8.6"
version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -480,38 +485,38 @@ name = "rmpv"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
"rmp 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_bytes 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
"rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_bytes 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde"
version = "1.0.11"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde_bytes"
version = "0.10.2"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_derive"
version = "1.0.11"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive_internals 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive_internals 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_derive_internals"
version = "0.15.1"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
@ -520,13 +525,13 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.5"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -554,10 +559,10 @@ dependencies = [
[[package]]
name = "thread_local"
version = "0.3.4"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -566,7 +571,7 @@ name = "toml"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -580,7 +585,7 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -607,64 +612,64 @@ version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum aho-corasick 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "500909c4f87a9e52355b26626d890833e9e1d53ac566db76c36faa984b889699"
"checksum atk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c69658a4e18d5c9575f716e24559645d08a4044d6946c30c2e0025952c84d842"
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
"checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4"
"checksum atk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "33a67fd81e1922dddc335887516f2f5254534e89c9d39fa89bca5d79bd150d34"
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
"checksum byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d"
"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf"
"checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23"
"checksum c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6237ac5a4b1e81c213c24c6437964c61e646df910a914b4ab1487b46df20bd13"
"checksum cairo-rs 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9d336f1b2ff46c17475a14360de7f456707008da475c54824887e52e453ab00"
"checksum cairo-sys-rs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9e8a1e2a76ac09b959788c2c30a355d693ce6f7f7d7268f6d1dd5d8c3359c521"
"checksum cairo-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6b5695f59fd036fe5741bc5a4eb20c78fbe42256e3b08a2af26bbcbe8070bf3"
"checksum cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c6e18fecaeac51809db57f45f4553cc0975225a7eb435a7a7e91e5e8113a84d"
"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299"
"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9"
"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
"checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b"
"checksum gdk 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f30018ecbbb1e6f1d59c4024ec08675850744b799abc5420be0629ac9ba0abd2"
"checksum gdk-pixbuf 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "caf05dab73febcc6e90abaff8f24cfe1cf1bd2222cd648ddfe337bf3b994489f"
"checksum gdk-pixbuf-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "85eb441420653b33e5a29d13227ea34995383e65bf4f33b16492ec95e44a8996"
"checksum gdk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "679d86da2a4522a623e3ce4b67f2126a12e057a1f7269eee7028199f78b5a854"
"checksum gio 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b7bc3126c94109e65871e4228b990d1ea2953259483d5b06eb96e8b36a7bf196"
"checksum gio-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "189969f8189604c371d42b613d928c9d17fcfbf6e175d6b0ce9475a950f76dc6"
"checksum glib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67eb5b7251562f527d55d0ccf81bc5e6e75045df38b97cfee98ee7b2fc5aa7c0"
"checksum glib-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd7d911c5dc610aabe37caae7d3b9d2cfe6d8f4c85ff4c062f3d6f490e75067"
"checksum gobject-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "edc95561e538381576425264a4ddd08c65d5da218f10b2a47b4479dd147775da"
"checksum gtk 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce17f98e7dcdc9d06b3a5f7621d796a24937c04953481205b1be267c5a02697a"
"checksum gtk-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "854b56ce6d6b05945f7735651482835c5ac1f8582142ce67306726259a3dafb0"
"checksum fuchsia-zircon 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bd510087c325af53ba24f3be8f1c081b0982319adcb8b03cad764512923ccc19"
"checksum fuchsia-zircon-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "08b3a6f13ad6b96572b53ce7af74543132f1a7055ccceb6d073dd36c54481859"
"checksum gdk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e51db95be6565011bcd5cd99f9b17fdd585001057a999b21e09f1e8c28deb9"
"checksum gdk-pixbuf 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16160d212ae91abe9f3324c3fb233929ba322dde63585d15cda3336f8c529ed1"
"checksum gdk-pixbuf-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "798f97101eea8180da363d0e80e07ec7ec6d1809306601c0100c1de5bc8b4f52"
"checksum gdk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4ee916f5f25c5f4b21bd9dcb12a216ae697406940ff9476358c308a8ececada"
"checksum gio 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "84ba5a2beb559059a0c9c2bd3681743cdede8d9a36c775840bca800333b22867"
"checksum gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a303bbf7a5e75ab3b627117ff10e495d1b9e97e1d68966285ac2b1f6270091bc"
"checksum glib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "450247060df7d52fdad31e1d66f30d967e925c9d1d26a0ae050cfe33dcd00d08"
"checksum glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9693049613ff52b93013cc3d2590366d8e530366d288438724b73f6c7dc4be8"
"checksum gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60d507c87a71b1143c66ed21a969be9b99a76df234b342d733e787e6c9c7d7c2"
"checksum gtk 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0847c507e52c1feaede13ef56fb4847742438602655449d5f1f782e8633f146f"
"checksum gtk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "905fcfbaaad1b44ec0b4bba9e4d527d728284c62bc2ba41fccedace2b096766f"
"checksum htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e9025058dae765dee5070ec375f591e2ba14638c63feff74f13805a72e523163"
"checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c"
"checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf"
"checksum libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)" = "8a014d9226c2cc402676fbe9ea2e15dd5222cd1dd57f576b5b283178c944a264"
"checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b"
"checksum magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf0336886480e671965f794bc9b6fce88503563013d1bfb7a502c81fe3ac527"
"checksum magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40d014c7011ac470ae28e2f76a02bfea4a8480f73e701353b49ad7a8d75f4699"
"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4"
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d"
"checksum libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)" = "36fbc8a8929c632868295d0178dd8f63fc423fd7537ad0738372bd010b3ac9b0"
"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2"
"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"
"checksum neovim-lib 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1889b79fccec66b11f3f9d3a266ffd97c0944af82a62843ca2b9529fedd82fec"
"checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0"
"checksum pango 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5afa4b4c5380315b12075e7767d9bdd62d53beeb6087d9287ef6990e57a6b643"
"checksum pango-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e6ec8d90306b5ff43f5836f4363267ea95be02b3df71d2b31ba8fbb1680bdee1"
"checksum pangocairo 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8edeb86f36f8f10a252a888fa3d9aff4d0681373da918c207eac2208aa091e6"
"checksum pangocairo-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c26c200ef32a682bf8b693b47996c3c33e0b2de32b30f7251cc60673ad513bef"
"checksum num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "cacfcab5eb48250ee7d0c7896b51a2c5eec99c1feea5f32025635f5ae4b00070"
"checksum pango 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e81c404ab81ea7ea2fc2431a0a7672507b80e4b8bf4b41eac3fc83cc665104e"
"checksum pango-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34f34a1be107fe16abb2744e0e206bee4b3b07460b5fddd3009a6aaf60bd69ab"
"checksum pangocairo 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "41a8620ece55098d741bacf4d3aa52398f85ce83cfe0d8f670fa11de88f52c40"
"checksum pangocairo-sys 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e34ec010b38a2a6dafdf3d86ffe1251a0ae759208ec85f78c66c0445481bd5a8"
"checksum phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "cb325642290f28ee14d8c6201159949a872f220c62af6e110a56ea914fbe42fc"
"checksum phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "d62594c0bb54c464f633175d502038177e90309daf2e0158be42ed5f023ce88f"
"checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03"
"checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2"
"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
"checksum rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "eb250fd207a4729c976794d03db689c9be1d634ab5a1c9da9492a13d8fecbcdf"
"checksum regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1731164734096285ec2a5ec7fea5248ae2f5485b3feeb0115af4fda2183b2d1b"
"checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db"
"checksum rmp 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7ce560a5728f4eec697f07f8d7fa20608893d44b4f5b8f9f5f51a2987f3cffe2"
"checksum rand 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "9e7944d95d25ace8f377da3ac7068ce517e4c646754c43a1b1849177bbf72e59"
"checksum regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "744554e01ccbd98fff8c457c3b092cd67af62a555a43bfe97ae8a0451f7799fa"
"checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e"
"checksum rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a3d45d7afc9b132b34a2479648863aa95c5c88e98b32285326a6ebadc80ec5c9"
"checksum rmpv 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "29af0205707de955a396a1d3c657677c65f791ebabb63c0596c0b2fec0bf6325"
"checksum serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f7726f29ddf9731b17ff113c461e362c381d9d69433f79de4f3dd572488823e9"
"checksum serde_bytes 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5a35acc737295444cf7eb136236563f13dcddbfef65ac00d07870b590df77ed5"
"checksum serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cf823e706be268e73e7747b147aa31c8f633ab4ba31f115efb57e5047c3a76dd"
"checksum serde_derive_internals 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37aee4e0da52d801acfbc0cc219eb1eda7142112339726e427926a6f6ee65d3a"
"checksum serde_json 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1e67ce320daa7e494c578e34d4b00689f23bb94512fe0ca0dfaf02ea53fb67"
"checksum serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "db99f3919e20faa51bb2996057f5031d8685019b5a06139b1ce761da671b8526"
"checksum serde_bytes 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)" = "52b678af90a3aebc4484c22d639bf374eb7d598988edb33fa73c4febd6046a59"
"checksum serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "f4ba7591cfe93755e89eeecdbcc668885624829b020050e6aec99c2a03bd3fd0"
"checksum serde_derive_internals 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6e03f1c9530c3fb0a0a5c9b826bdd9246a5921ae995d75f512ac917fc4dd55b5"
"checksum serde_json 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c9db7266c7d63a4c4b7fe8719656ccdd51acf1bed6124b174f933b009fb10bcb"
"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537"
"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
"checksum thread_local 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1697c4b57aeeb7a536b647165a2825faddffb1d3bad386d507709bd51a90bb14"
"checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963"
"checksum toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7540f4ffc193e0d3c94121edb19b055670d369f77d5804db11ae053a45b6e7e"
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
"checksum unix_socket 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6aa2700417c405c38f5e6902d699345241c28c0b7ade4abaad71e35a87eb1564"

View File

@ -5,16 +5,17 @@ authors = ["daa84 <daa84@inbox.ru>"]
build = "build.rs"
[dependencies]
cairo-rs = "0.2"
pango = "0.2"
pango-sys = "0.4"
pangocairo = "0.2"
glib = "0.3"
glib-sys = "0.4"
gdk = "0.6"
gdk-sys = "0.4"
gio = "0.2"
gobject-sys = "0.4"
cairo-rs = "0.3"
pango = "0.3"
pango-sys = "0.5"
pangocairo = "0.4"
pangocairo-sys = "0.6"
glib = "0.4"
glib-sys = "0.5"
gdk = "0.7"
gdk-sys = "0.5"
gio = "0.3"
gobject-sys = "0.5"
#gdk = { git = 'https://github.com/gtk-rs/gdk' }
#gdk-sys = { git = 'https://github.com/gtk-rs/sys' }
#glib = { git = 'https://github.com/gtk-rs/glib' }
@ -27,7 +28,7 @@ gobject-sys = "0.4"
#pangocairo = { git = 'https://github.com/RazrFalcon/pangocairo-rs' }
neovim-lib = "0.5"
phf = "0.7"
log = "0.3"
log = "0.4"
env_logger = "0.4"
htmlescape = "0.3"
rmpv = "0.4"
@ -44,12 +45,12 @@ serde_json = "1.0"
phf_codegen = "0.7"
[dependencies.gtk]
version = "0.2"
version = "0.3"
features = ["v3_22"]
#git = "https://github.com/gtk-rs/gtk"
[dependencies.gtk-sys]
version = "0.4"
version = "0.5"
features = ["v3_22"]
#git = 'https://github.com/gtk-rs/sys'

View File

@ -15,8 +15,10 @@ install-resources:
mkdir -p $(PREFIX)/share/applications/
cp desktop/org.daa.NeovimGtk.desktop $(PREFIX)/share/applications/
sed -i "s|Exec=nvim-gtk|Exec=$(PREFIX)/bin/nvim-gtk|" $(PREFIX)/share/applications/org.daa.NeovimGtk.desktop
mkdir -p $(PREFIX)/share/icons/hicolor/128x128/apps/
cp desktop/org.daa.NeovimGtk.png $(PREFIX)/share/icons/hicolor/128x128/apps/
mkdir -p $(PREFIX)/share/icons/hicolor/48x48/apps/
cp desktop/org.daa.NeovimGtk.png $(PREFIX)/share/icons/hicolor/48x48/apps/
mkdir -p $(PREFIX)/share/icons/hicolor/scalable/apps/
cp desktop/org.daa.NeovimGtk.svg $(PREFIX)/share/icons/hicolor/scalable/apps/
mkdir -p $(PREFIX)/share/fonts/
cp -n desktop/dejavu_font/*.ttf $(PREFIX)/share/fonts/
fc-cache -fv

View File

@ -13,11 +13,6 @@ call rpcnotify(1, 'Gui', 'Font', 'DejaVu Sans Mono 12')
```
for more details see [wiki](https://github.com/daa84/neovim-gtk/wiki/Configuration)
# Command line
* pass nvim custom execution path (by default used `nvim` command)
```
cargo run -- --nvim-bin-path=E:\Neovim\bin\nvim.exe
```
# Install
## From sources
By default to `/usr/local`:

View File

@ -7,3 +7,4 @@ Type=Application
Terminal=false
Categories=GTK;Utility;TextEditor;
StartupNotify=true
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -64,20 +64,6 @@ impl ColorModel {
}
}
pub fn cell_colors<'a>(&'a self, cell: &'a Cell) -> (Option<&'a Color>, &'a Color) {
if !cell.attrs.reverse {
(
cell.attrs.background.as_ref(),
cell.attrs.foreground.as_ref().unwrap_or(&self.fg_color),
)
} else {
(
cell.attrs.foreground.as_ref().or(Some(&self.fg_color)),
cell.attrs.background.as_ref().unwrap_or(&self.bg_color),
)
}
}
pub fn cell_fg<'a>(&'a self, cell: &'a Cell) -> Option<&'a Color> {
if !cell.attrs.reverse {
cell.attrs.foreground.as_ref()

View File

@ -63,9 +63,8 @@ impl <CB: CursorRedrawCb> State <CB> {
fn reset_to(&mut self, phase: AnimPhase) {
self.alpha = Alpha(1.0);
self.anim_phase = phase;
if let Some(timer_id) = self.timer {
if let Some(timer_id) = self.timer.take() {
glib::source_remove(timer_id);
self.timer = None;
}
}
}
@ -257,7 +256,7 @@ fn anim_step<CB: CursorRedrawCb + 'static> (state: &Arc<UiMutex<State<CB>>>) ->
impl <CB: CursorRedrawCb> Drop for Cursor<CB> {
fn drop(&mut self) {
if let Some(timer_id) = self.state.borrow().timer {
if let Some(timer_id) = self.state.borrow_mut().timer.take() {
glib::source_remove(timer_id);
}
}

View File

@ -30,4 +30,3 @@ fn get_xdg_config_dir() -> Result<PathBuf, String> {
home_dir.push(".config");
Ok(home_dir)
}

View File

@ -20,8 +20,8 @@ impl ErrorArea {
let label = gtk::Label::new(None);
label.set_line_wrap(true);
let error_image = gtk::Image::new_from_icon_name("dialog-error",
gtk_sys::GTK_ICON_SIZE_DIALOG as i32);
let error_image =
gtk::Image::new_from_icon_name("dialog-error", gtk_sys::GTK_ICON_SIZE_DIALOG as i32);
base.pack_start(&error_image, false, true, 10);
base.pack_start(&label, true, true, 1);

View File

@ -18,8 +18,9 @@ pub fn keyval_to_input_string(in_str: &str, in_state: gdk::ModifierType) -> Stri
debug!("keyval -> {}", in_str);
// CTRL-^ and CTRL-@ don't work in the normal way.
if state.contains(gdk::CONTROL_MASK) && !state.contains(gdk::SHIFT_MASK) &&
!state.contains(gdk::MOD1_MASK) {
if state.contains(gdk::ModifierType::CONTROL_MASK) && !state.contains(gdk::ModifierType::SHIFT_MASK) &&
!state.contains(gdk::ModifierType::MOD1_MASK)
{
if val == "6" {
val = "^";
} else if val == "2" {
@ -34,7 +35,7 @@ pub fn keyval_to_input_string(in_str: &str, in_state: gdk::ModifierType) -> Stri
// Remove SHIFT
if ch.is_ascii() && !ch.is_alphanumeric() {
state.remove(gdk::SHIFT_MASK);
state.remove(gdk::ModifierType::SHIFT_MASK);
}
}
@ -42,13 +43,13 @@ pub fn keyval_to_input_string(in_str: &str, in_state: gdk::ModifierType) -> Stri
val = "lt";
}
if state.contains(gdk::SHIFT_MASK) {
if state.contains(gdk::ModifierType::SHIFT_MASK) {
input.push_str("S-");
}
if state.contains(gdk::CONTROL_MASK) {
if state.contains(gdk::ModifierType::CONTROL_MASK) {
input.push_str("C-");
}
if state.contains(gdk::MOD1_MASK) {
if state.contains(gdk::ModifierType::MOD1_MASK) {
input.push_str("A-");
}
@ -79,7 +80,14 @@ pub fn convert_key(ev: &EventKey) -> Option<String> {
pub fn im_input(nvim: &mut Neovim, input: &str) {
debug!("nvim_input -> {}", input);
nvim.input(input).expect("Error run input command to nvim");
let input: String = input
.chars()
.map(|ch| {
keyval_to_input_string(&ch.to_string(), gdk::ModifierType::empty())
})
.collect();
nvim.input(&input).expect("Error run input command to nvim");
}
pub fn gtk_key_press(nvim: &mut Neovim, ev: &EventKey) -> Inhibit {

View File

@ -11,6 +11,7 @@ extern crate cairo;
extern crate pango;
extern crate pango_sys;
extern crate pangocairo;
extern crate pango_cairo_sys;
extern crate neovim_lib;
extern crate phf;
#[macro_use]
@ -52,65 +53,92 @@ mod error;
use std::env;
use gio::{ApplicationExt, FileExt};
use std::time::Duration;
use std::str::FromStr;
use gio::prelude::*;
use ui::Ui;
use shell::ShellOptions;
const BIN_PATH_ARG: &'static str = "--nvim-bin-path";
const BIN_PATH_ARG: &str = "--nvim-bin-path";
const TIMEOUT_ARG: &str = "--timeout";
fn main() {
env_logger::init().expect("Can't initialize env_logger");
let app_flags = gio::APPLICATION_HANDLES_OPEN;
let app_flags = gio::ApplicationFlags::HANDLES_OPEN | gio::ApplicationFlags::NON_UNIQUE;
let app = if cfg!(debug_assertions) {
gtk::Application::new(Some("org.daa.NeovimGtkDebug"),
app_flags)
} else {
gtk::Application::new(Some("org.daa.NeovimGtk"), app_flags)
}
.expect("Failed to initialize GTK application");
gtk::Application::new(Some("org.daa.NeovimGtkDebug"), app_flags)
} else {
gtk::Application::new(Some("org.daa.NeovimGtk"), app_flags)
}.expect("Failed to initialize GTK application");
app.connect_activate(activate);
{
use gio::ApplicationExtManual;
app.connect_open(open);
}
app.connect_open(open);
let new_window_action = gio::SimpleAction::new("new-window", None);
let app_ref = app.clone();
new_window_action.connect_activate(move |_, _| activate(&app_ref));
app.add_action(&new_window_action);
gtk::Window::set_default_icon_name("org.daa.NeovimGtk");
let args: Vec<String> = env::args().collect();
let argv: Vec<&str> = args.iter()
let argv: Vec<String> = args.iter()
.filter(|a| !a.starts_with(BIN_PATH_ARG))
.map(String::as_str)
.filter(|a| !a.starts_with(TIMEOUT_ARG))
.cloned()
.collect();
app.run(&argv);
}
fn open(app: &gtk::Application, files: &[gio::File], _: &str) {
for f in files {
let mut ui = Ui::new(ShellOptions::new(nvim_bin_path(std::env::args()),
f.get_path().and_then(|p| p.to_str().map(str::to_owned))));
let mut ui = Ui::new(ShellOptions::new(
nvim_bin_path(std::env::args()),
f.get_path().and_then(|p| p.to_str().map(str::to_owned)),
nvim_timeout(std::env::args()),
));
ui.init(app);
}
}
fn activate(app: &gtk::Application) {
let mut ui = Ui::new(ShellOptions::new(nvim_bin_path(std::env::args()), None));
let mut ui = Ui::new(ShellOptions::new(
nvim_bin_path(std::env::args()),
None,
nvim_timeout(std::env::args()),
));
ui.init(app);
}
fn nvim_bin_path<I>(args: I) -> Option<String>
where I: Iterator<Item = String>
fn nvim_bin_path<I>(mut args: I) -> Option<String>
where
I: Iterator<Item = String>,
{
args.skip_while(|a| !a.starts_with(BIN_PATH_ARG))
.map(|p| p.split('=').nth(1).map(str::to_owned))
.nth(0)
.unwrap_or(None)
args.find(|a| a.starts_with(BIN_PATH_ARG)).and_then(|p| {
p.split('=').nth(1).map(str::to_owned)
})
}
fn nvim_timeout<I>(mut args: I) -> Option<Duration>
where
I: Iterator<Item = String>,
{
args.find(|a| a.starts_with(TIMEOUT_ARG))
.and_then(|p| p.split('=').nth(1).map(str::to_owned))
.and_then(|timeout| match u64::from_str(&timeout) {
Ok(timeout) => Some(timeout),
Err(err) => {
error!("Can't convert timeout argument to integer: {}", err);
None
}
})
.map(|timeout| Duration::from_secs(timeout))
}
#[cfg(test)]
@ -119,9 +147,24 @@ mod tests {
#[test]
fn test_bin_path_arg() {
assert_eq!(Some("/test_path".to_string()),
nvim_bin_path(vec!["neovim-gtk", "--nvim-bin-path=/test_path"]
.iter()
.map(|s| s.to_string())));
assert_eq!(
Some("/test_path".to_string()),
nvim_bin_path(
vec!["neovim-gtk", "--nvim-bin-path=/test_path"]
.iter()
.map(|s| s.to_string()),
)
);
}
#[test]
fn test_timeout_arg() {
assert_eq!(
Some(Duration::from_secs(100)),
nvim_timeout(vec!["neovim-gtk", "--timeout=100"].iter().map(
|s| s.to_string(),
))
);
}
}

View File

@ -27,9 +27,7 @@ impl Mode {
}
pub fn mode_info(&self) -> Option<&nvim::ModeInfo> {
self.info
.as_ref()
.and_then(|i| i.get(self.idx))
self.info.as_ref().and_then(|i| i.get(self.idx))
}
pub fn update(&mut self, mode: &str, idx: usize) {

View File

@ -2,7 +2,8 @@ use std::ops::{Deref, DerefMut};
use std::cell::{Cell, RefCell, RefMut};
use std::sync::{Arc, Mutex, MutexGuard};
use neovim_lib::Neovim;
use super::ErrorReport;
use neovim_lib::{Neovim, NeovimApi};
#[derive(Clone, Copy, PartialEq)]
enum NeovimClientState {
@ -31,6 +32,17 @@ impl<'a> NeovimRef<'a> {
None
}
}
pub fn non_blocked(mut self) -> Option<Self> {
self.get_mode().ok_and_report().and_then(|mode| {
mode.iter()
.find(|kv| {
kv.0.as_str().map(|key| key == "blocking").unwrap_or(false)
})
.map(|kv| kv.1.as_bool().unwrap_or(false))
.and_then(|block| if block { None } else { Some(self) })
})
}
}
impl<'a> Deref for NeovimRef<'a> {

23
src/nvim/ext.rs Normal file
View File

@ -0,0 +1,23 @@
use std::result;
use neovim_lib::CallError;
pub trait ErrorReport<T> {
fn report_err(&self);
fn ok_and_report(self) -> Option<T>;
}
impl<T> ErrorReport<T> for result::Result<T, CallError> {
fn report_err(&self) {
if let Err(ref err) = *self {
error!("{}", err);
}
}
fn ok_and_report(self) -> Option<T> {
self.report_err();
self.ok()
}
}

View File

@ -4,11 +4,13 @@ mod handler;
mod mode_info;
mod redraw_handler;
mod repaint_mode;
mod ext;
pub use self::redraw_handler::{RedrawEvents, GuiApi};
pub use self::redraw_handler::{RedrawEvents, GuiApi, CompleteItem};
pub use self::repaint_mode::RepaintMode;
pub use self::client::{NeovimClient, NeovimClientAsync, NeovimRef};
pub use self::mode_info::{ModeInfo, CursorShape};
pub use self::ext::ErrorReport;
use std::error;
use std::fmt;
@ -16,8 +18,9 @@ use std::env;
use std::process::{Stdio, Command};
use std::result;
use std::sync::Arc;
use std::time::Duration;
use neovim_lib::{Neovim, NeovimApi, Session, UiAttachOptions, CallError};
use neovim_lib::{Neovim, NeovimApi, Session, UiAttachOptions};
use ui::UiMutex;
use shell;
@ -78,6 +81,7 @@ impl error::Error for NvimInitError {
pub fn start(
shell: Arc<UiMutex<shell::State>>,
nvim_bin_path: Option<&String>,
timeout: Option<Duration>,
) -> result::Result<Neovim, NvimInitError> {
let mut cmd = if let Some(path) = nvim_bin_path {
Command::new(path)
@ -116,11 +120,13 @@ pub fn start(
let session = Session::new_child_cmd(&mut cmd);
let session = match session {
let mut session = match session {
Err(e) => return Err(NvimInitError::new(&cmd, e)),
Ok(s) => s,
};
session.set_timeout(timeout.unwrap_or(Duration::from_millis(10_000)));
let mut nvim = Neovim::new(session);
nvim.session.start_event_loop_handler(
@ -163,23 +169,3 @@ pub fn post_start_init(
Ok(())
}
pub trait ErrorReport<T> {
fn report_err(&self, nvim: &mut NeovimApi);
fn ok_and_report(self, nvim: &mut NeovimApi) -> Option<T>;
}
impl<T> ErrorReport<T> for result::Result<T, CallError> {
fn report_err(&self, _: &mut NeovimApi) {
if let Err(ref err) = *self {
println!("{}", err);
//nvim.report_error(&err_msg).expect("Error report error :)");
}
}
fn ok_and_report(self, nvim: &mut NeovimApi) -> Option<T> {
self.report_err(nvim);
self.ok()
}
}

View File

@ -45,7 +45,7 @@ pub trait RedrawEvents {
fn popupmenu_show(
&mut self,
menu: Vec<Vec<String>>,
menu: &[CompleteItem],
selected: i64,
row: u64,
col: u64,
@ -208,7 +208,20 @@ pub fn call(
"mouse_off" => ui.on_mouse(false),
"busy_start" => ui.on_busy(true),
"busy_stop" => ui.on_busy(false),
"popupmenu_show" => call!(ui->popupmenu_show(args: ext, int, uint, uint)),
"popupmenu_show" => {
let menu_items = map_array!(args[0], "Error get menu list array", |item| {
map_array!(item, "Error get menu item array", |col| {
col.as_str().ok_or("Error get menu column")
})
})?;
ui.popupmenu_show(
&CompleteItem::map(&menu_items),
try_int!(args[1]),
try_uint!(args[2]),
try_uint!(args[3]),
)
}
"popupmenu_hide" => ui.popupmenu_hide(),
"popupmenu_select" => call!(ui->popupmenu_select(args: int)),
"tabline_update" => {
@ -251,3 +264,26 @@ pub fn call(
Ok(repaint_mode)
}
pub struct CompleteItem<'a> {
pub word: &'a str,
pub kind: &'a str,
pub menu: &'a str,
pub info: &'a str,
}
impl<'a> CompleteItem<'a> {
fn map(menu: &'a [Vec<&str>]) -> Vec<Self> {
menu.iter()
.map(|menu| {
CompleteItem {
word: menu[0],
kind: menu[1],
menu: menu[2],
info: menu[3],
}
})
.collect()
}
}

View File

@ -56,13 +56,13 @@ impl Manager {
}
}
PlugManageState::VimPlug => {
if Store::is_config_exists() {
if Store::is_config_exists() {
self.store = Store::load();
self.plug_manage_state = PlugManageState::NvimGtk;
} else {
self.store = Store::empty();
}
}
}
}
if let PlugManageState::Unknown = self.plug_manage_state {
if self.vim_plug.is_loaded() {
@ -106,7 +106,11 @@ impl PlugManagerConfigSource {
for plug in store.get_plugs() {
if !plug.removed {
builder += &format!("Plug '{}', {{ 'as': '{}' }}\n", plug.get_plug_path(), plug.name);
builder += &format!(
"Plug '{}', {{ 'as': '{}' }}\n",
plug.get_plug_path(),
plug.name
);
}
}

View File

@ -16,7 +16,7 @@ impl<'a> Builder<'a> {
let dlg = gtk::Dialog::new_with_buttons(
Some(self.title),
Some(parent),
gtk::DIALOG_USE_HEADER_BAR | gtk::DIALOG_DESTROY_WITH_PARENT,
gtk::DialogFlags::USE_HEADER_BAR | gtk::DialogFlags::DESTROY_WITH_PARENT,
&[
("Cancel", gtk::ResponseType::Cancel.into()),
("Ok", gtk::ResponseType::Ok.into()),

View File

@ -68,7 +68,10 @@ impl Store {
pub fn add_plug(&mut self, plug: PlugInfo) -> bool {
let path = plug.get_plug_path();
if self.settings.plugs.iter().any(|p| p.get_plug_path() == path || p.name == plug.name) {
if self.settings.plugs.iter().any(|p| {
p.get_plug_path() == path || p.name == plug.name
})
{
return false;
}
self.settings.plugs.push(plug);
@ -81,7 +84,10 @@ impl Store {
pub fn move_item(&mut self, idx: usize, offset: i32) {
let plug = self.settings.plugs.remove(idx);
self.settings.plugs.insert((idx as i32 + offset) as usize, plug);
self.settings.plugs.insert(
(idx as i32 + offset) as usize,
plug,
);
}
}
@ -93,7 +99,10 @@ struct Settings {
impl Settings {
fn new(plugs: Vec<PlugInfo>) -> Self {
Settings { plugs, enabled: false }
Settings {
plugs,
enabled: false,
}
}
}
@ -101,7 +110,10 @@ impl SettingsLoader for Settings {
const SETTINGS_FILE: &'static str = "plugs.toml";
fn empty() -> Self {
Settings { plugs: vec![], enabled: false }
Settings {
plugs: vec![],
enabled: false,
}
}
fn from_str(s: &str) -> Result<Self, String> {

View File

@ -30,7 +30,7 @@ impl<'a> Ui<'a> {
let dlg = gtk::Dialog::new_with_buttons(
Some("Plug"),
Some(parent),
gtk::DIALOG_DESTROY_WITH_PARENT,
gtk::DialogFlags::DESTROY_WITH_PARENT,
&[
("Cancel", gtk::ResponseType::Cancel.into()),
("Ok", gtk::ResponseType::Ok.into()),
@ -43,7 +43,9 @@ impl<'a> Ui<'a> {
let header_bar = gtk::HeaderBar::new();
let add_plug_btn = gtk::Button::new_with_label("Add..");
add_plug_btn.get_style_context().map(|c| c.add_class("suggested-action"));
add_plug_btn.get_style_context().map(|c| {
c.add_class("suggested-action")
});
header_bar.pack_end(&add_plug_btn);
@ -116,7 +118,9 @@ impl<'a> Ui<'a> {
let mut manager = self.manager.borrow_mut();
manager.clear_removed();
manager.save();
if let Some(config_path) = NvimConfig::new(manager.generate_config()).generate_config() {
if let Some(config_path) =
NvimConfig::new(manager.generate_config()).generate_config()
{
if let Some(path) = config_path.to_str() {
manager.vim_plug.reload(path);
}
@ -156,8 +160,10 @@ fn create_up_down_btns(
manager: &Arc<UiMutex<manager::Manager>>,
) -> gtk::Box {
let buttons_panel = gtk::Box::new(gtk::Orientation::Horizontal, 5);
let up_btn = gtk::Button::new_from_icon_name("go-up-symbolic", gtk_sys::GTK_ICON_SIZE_BUTTON as i32);
let down_btn = gtk::Button::new_from_icon_name("go-down-symbolic", gtk_sys::GTK_ICON_SIZE_BUTTON as i32);
let up_btn =
gtk::Button::new_from_icon_name("go-up-symbolic", gtk_sys::GTK_ICON_SIZE_BUTTON as i32);
let down_btn =
gtk::Button::new_from_icon_name("go-down-symbolic", gtk_sys::GTK_ICON_SIZE_BUTTON as i32);
up_btn.connect_clicked(clone!(plugs_panel, manager => move |_| {
if let Some(row) = plugs_panel.get_selected_row() {

View File

@ -70,7 +70,7 @@ impl Manager {
if let Some(mut nvim) = self.nvim() {
let loaded_plug = nvim.eval("exists('g:loaded_plug')");
loaded_plug
.ok_and_report(&mut *nvim)
.ok_and_report()
.and_then(|loaded_plug| loaded_plug.as_i64())
.map_or(false, |loaded_plug| if loaded_plug > 0 {
true
@ -84,7 +84,7 @@ impl Manager {
pub fn reload(&self, path: &str) {
if let Some(mut nvim) = self.nvim() {
nvim.command(&format!("source {}", path)).report_err(&mut *nvim);
nvim.command(&format!("source {}", path)).report_err();
}
}
}
@ -100,4 +100,3 @@ impl VimPlugInfo {
VimPlugInfo { name, uri }
}
}

View File

@ -42,9 +42,10 @@ fn request(query: Option<&str>) -> io::Result<DescriptionList> {
if out.stdout.is_empty() {
Ok(DescriptionList::empty())
} else {
let description_list: DescriptionList = serde_json::from_slice(&out.stdout).map_err(|e| {
io::Error::new(io::ErrorKind::Other, e)
})?;
let description_list: DescriptionList =
serde_json::from_slice(&out.stdout).map_err(|e| {
io::Error::new(io::ErrorKind::Other, e)
})?;
Ok(description_list)
}
} else {
@ -147,9 +148,7 @@ pub struct DescriptionList {
impl DescriptionList {
fn empty() -> DescriptionList {
DescriptionList {
plugins: Box::new([]),
}
DescriptionList { plugins: Box::new([]) }
}
}

View File

@ -22,6 +22,7 @@ struct State {
tree: gtk::TreeView,
scroll: gtk::ScrolledWindow,
css_provider: gtk::CssProvider,
info_label: gtk::Label,
}
impl State {
@ -32,12 +33,36 @@ impl State {
let style_context = tree.get_style_context().unwrap();
style_context.add_provider(&css_provider, gtk::STYLE_PROVIDER_PRIORITY_APPLICATION);
let renderer = gtk::CellRendererText::new();
// word
let column = gtk::TreeViewColumn::new();
column.pack_start(&renderer, true);
column.add_attribute(&renderer, "text", 0);
tree.append_column(&column);
// kind
let column = gtk::TreeViewColumn::new();
column.pack_start(&renderer, true);
column.add_attribute(&renderer, "text", 1);
tree.append_column(&column);
// menu
let column = gtk::TreeViewColumn::new();
column.pack_start(&renderer, true);
column.add_attribute(&renderer, "text", 2);
tree.append_column(&column);
let info_label = gtk::Label::new(None);
info_label.set_line_wrap(true);
State {
nvim: None,
renderer: gtk::CellRendererText::new(),
tree,
scroll: gtk::ScrolledWindow::new(None, None),
renderer,
css_provider,
info_label,
}
}
@ -46,6 +71,8 @@ impl State {
self.nvim = Some(ctx.nvim.clone());
}
self.scroll.set_max_content_width(ctx.max_width);
self.scroll.set_propagate_natural_width(true);
self.update_tree(&ctx);
self.select(ctx.selected);
}
@ -69,25 +96,11 @@ impl State {
self.update_css(color_model);
let col_count = ctx.menu_items[0].len();
let columns = self.tree.get_columns();
if columns.len() != col_count {
for col in columns {
self.tree.remove_column(&col);
}
for i in 0..col_count {
self.append_column(i as i32);
}
}
let list_store = gtk::ListStore::new(&vec![gtk::Type::String; col_count]);
let all_column_ids: Vec<u32> = (0..col_count).map(|i| i as u32).collect();
let list_store = gtk::ListStore::new(&vec![gtk::Type::String; 4]);
let all_column_ids: Vec<u32> = (0..4).map(|i| i as u32).collect();
for line in ctx.menu_items {
let line_array: Vec<&glib::ToValue> =
line.iter().map(|v| v as &glib::ToValue).collect();
let line_array: [&glib::ToValue; 4] = [&line.word, &line.kind, &line.menu, &line.info];
list_store.insert_with_values(None, &all_column_ids, &line_array[..]);
}
@ -98,28 +111,19 @@ impl State {
let bg = color_model.pmenu_bg_sel();
let fg = color_model.pmenu_fg_sel();
match gtk::CssProviderExtManual::load_from_data(
match gtk::CssProviderExt::load_from_data(
&self.css_provider,
&format!(
".view {{ color: {}; background-color: {};}}",
fg.to_hex(),
bg.to_hex()
),
).as_bytes(),
) {
Err(e) => error!("Can't update css {}", e),
Ok(_) => (),
};
}
fn append_column(&self, id: i32) {
let renderer = &self.renderer;
let column = gtk::TreeViewColumn::new();
column.pack_start(renderer, true);
column.add_attribute(renderer, "text", id);
self.tree.append_column(&column);
}
fn select(&self, selected: i64) {
if selected >= 0 {
let selected_path = gtk::TreePath::new_from_string(&format!("{}", selected));
@ -131,8 +135,31 @@ impl State {
0.0,
0.0,
);
self.show_info_column(&selected_path);
} else {
self.tree.get_selection().unselect_all();
self.info_label.hide();
}
}
fn show_info_column(&self, selected_path: &gtk::TreePath) {
let model = self.tree.get_model().unwrap();
let iter = model.get_iter(selected_path);
if let Some(iter) = iter {
let info_value = model.get_value(&iter, 3);
let info: &str = info_value.get().unwrap();
if !info.trim().is_empty() {
self.info_label.show();
self.info_label.set_text(&info);
} else {
self.info_label.hide();
}
} else {
self.info_label.hide();
}
}
@ -161,18 +188,24 @@ impl PopupMenu {
let popover = gtk::Popover::new(Some(drawing));
popover.set_modal(false);
let content = gtk::Box::new(gtk::Orientation::Vertical, 0);
state.tree.set_headers_visible(false);
state.tree.set_can_focus(false);
state.scroll.set_policy(
gtk::PolicyType::Never,
gtk::PolicyType::Automatic,
gtk::PolicyType::Automatic,
);
state.scroll.add(&state.tree);
state.scroll.show_all();
popover.add(&state.scroll);
content.pack_start(&state.scroll, true, true, 0);
content.pack_start(&state.info_label, false, true, 0);
content.show();
popover.add(&content);
let state = Rc::new(RefCell::new(state));
let state_ref = state.clone();
@ -216,7 +249,6 @@ impl PopupMenu {
}
pub fn show(&mut self, ctx: PopupMenuContext) {
self.open = true;
self.popover.set_pointing_to(&gtk::Rectangle {
@ -246,12 +278,13 @@ pub struct PopupMenuContext<'a> {
pub nvim: &'a Rc<NeovimClient>,
pub color_model: &'a ColorModel,
pub font_ctx: &'a render::Context,
pub menu_items: &'a [Vec<String>],
pub menu_items: &'a [nvim::CompleteItem<'a>],
pub selected: i64,
pub x: i32,
pub y: i32,
pub width: i32,
pub height: i32,
pub max_width: i32,
}
fn tree_button_press(tree: &gtk::TreeView, ev: &EventButton, nvim: &mut Neovim) -> Inhibit {
@ -284,7 +317,7 @@ fn tree_button_press(tree: &gtk::TreeView, ev: &EventButton, nvim: &mut Neovim)
}
apply_command.push_str("<C-y>");
nvim.input(&apply_command).report_err(nvim);
nvim.input(&apply_command).report_err();
}
Inhibit(false)

View File

@ -30,18 +30,22 @@ enum ProjectViewColumns {
}
const COLUMN_COUNT: usize = 6;
const COLUMN_TYPES: [Type; COLUMN_COUNT] = [Type::String,
Type::String,
Type::String,
Type::String,
Type::Bool,
Type::Bool];
const COLUMN_IDS: [u32; COLUMN_COUNT] = [ProjectViewColumns::Name as u32,
ProjectViewColumns::Path as u32,
ProjectViewColumns::Uri as u32,
ProjectViewColumns::Pixbuf as u32,
ProjectViewColumns::Project as u32,
ProjectViewColumns::ProjectStored as u32];
const COLUMN_TYPES: [Type; COLUMN_COUNT] = [
Type::String,
Type::String,
Type::String,
Type::String,
Type::Bool,
Type::Bool,
];
const COLUMN_IDS: [u32; COLUMN_COUNT] = [
ProjectViewColumns::Name as u32,
ProjectViewColumns::Path as u32,
ProjectViewColumns::Uri as u32,
ProjectViewColumns::Pixbuf as u32,
ProjectViewColumns::Project as u32,
ProjectViewColumns::ProjectStored as u32,
];
pub struct Projects {
shell: Rc<RefCell<Shell>>,
@ -79,9 +83,10 @@ impl Projects {
vbox.pack_start(&search_box, false, true, 0);
projects
.scroll
.set_policy(PolicyType::Never, PolicyType::Automatic);
projects.scroll.set_policy(
PolicyType::Never,
PolicyType::Automatic,
);
projects.scroll.add(&projects.tree);
@ -97,10 +102,9 @@ impl Projects {
let projects = Rc::new(RefCell::new(projects));
let prj_ref = projects.clone();
projects
.borrow()
.tree
.connect_size_allocate(move |_, _| on_treeview_allocate(prj_ref.clone()));
projects.borrow().tree.connect_size_allocate(move |_, _| {
on_treeview_allocate(prj_ref.clone())
});
let prj_ref = projects.clone();
search_box.connect_changed(move |search_box| {
@ -115,45 +119,44 @@ impl Projects {
let prj_ref = projects.clone();
search_box.connect_activate(move |_| {
let model = prj_ref.borrow().tree.get_model().unwrap();
if let Some(iter) = model.get_iter_first() {
prj_ref.borrow().open_uri(&model, &iter);
let popup = prj_ref.borrow().popup.clone();
popup.popdown();
}
});
let model = prj_ref.borrow().tree.get_model().unwrap();
if let Some(iter) = model.get_iter_first() {
prj_ref.borrow().open_uri(&model, &iter);
let popup = prj_ref.borrow().popup.clone();
popup.popdown();
}
});
let prj_ref = projects.clone();
projects
.borrow()
.tree
.connect_row_activated(move |tree, _, _| {
let selection = tree.get_selection();
if let Some((model, iter)) = selection.get_selected() {
prj_ref.borrow().open_uri(&model, &iter);
let popup = prj_ref.borrow().popup.clone();
popup.popdown();
}
});
projects.borrow().tree.connect_row_activated(
move |tree, _, _| {
let selection = tree.get_selection();
if let Some((model, iter)) = selection.get_selected() {
prj_ref.borrow().open_uri(&model, &iter);
let popup = prj_ref.borrow().popup.clone();
popup.popdown();
}
},
);
let prj_ref = projects.clone();
open_btn.connect_clicked(move |_| {
prj_ref.borrow().show_open_file_dlg();
let popup = prj_ref.borrow().popup.clone();
popup.popdown();
});
prj_ref.borrow().show_open_file_dlg();
let popup = prj_ref.borrow().popup.clone();
popup.popdown();
});
let prj_ref = projects.clone();
projects
.borrow()
.popup
.connect_closed(move |_| prj_ref.borrow_mut().clear());
projects.borrow().popup.connect_closed(
move |_| prj_ref.borrow_mut().clear(),
);
let prj_ref = projects.clone();
projects
.borrow()
.toggle_renderer
.connect_toggled(move |_, path| prj_ref.borrow_mut().toggle_stored(&path));
projects.borrow().toggle_renderer.connect_toggled(
move |_, path| {
prj_ref.borrow_mut().toggle_stored(&path)
},
);
projects
}
@ -165,9 +168,11 @@ impl Projects {
.get()
.unwrap();
list_store.set_value(&iter,
ProjectViewColumns::ProjectStored as u32,
&ToValue::to_value(&!value));
list_store.set_value(
&iter,
ProjectViewColumns::ProjectStored as u32,
&ToValue::to_value(&!value),
);
let pixbuf = if value {
CURRENT_DIR_PIXBUF
@ -175,9 +180,11 @@ impl Projects {
BOOKMARKED_PIXBUF
};
list_store.set_value(&iter,
ProjectViewColumns::Pixbuf as u32,
&ToValue::to_value(pixbuf));
list_store.set_value(
&iter,
ProjectViewColumns::Pixbuf as u32,
&ToValue::to_value(pixbuf),
);
let uri_value = list_store.get_value(&iter, ProjectViewColumns::Uri as i32);
let uri: String = uri_value.get().unwrap();
@ -194,8 +201,14 @@ impl Projects {
fn open_uri(&self, model: &TreeModel, iter: &TreeIter) {
let uri: String = model.get_value(iter, ProjectViewColumns::Uri as i32).get().unwrap();
let project: bool = model.get_value(iter, ProjectViewColumns::Project as i32).get().unwrap();
let uri: String = model
.get_value(iter, ProjectViewColumns::Uri as i32)
.get()
.unwrap();
let project: bool = model
.get_value(iter, ProjectViewColumns::Project as i32)
.get()
.unwrap();
let shell = self.shell.borrow();
if project {
@ -218,9 +231,11 @@ impl Projects {
.unwrap()
.downcast::<gtk::Window>()
.ok();
let dlg = gtk::FileChooserDialog::new(Some("Open Document"),
window.as_ref(),
gtk::FileChooserAction::Open);
let dlg = gtk::FileChooserDialog::new(
Some("Open Document"),
window.as_ref(),
gtk::FileChooserAction::Open,
);
const OPEN_ID: i32 = 0;
const CANCEL_ID: i32 = 1;
@ -268,9 +283,11 @@ impl Projects {
let icon_renderer = CellRendererPixbuf::new();
image_column.pack_start(&icon_renderer, true);
image_column.add_attribute(&icon_renderer,
"icon-name",
ProjectViewColumns::Pixbuf as i32);
image_column.add_attribute(
&icon_renderer,
"icon-name",
ProjectViewColumns::Pixbuf as i32,
);
self.tree.append_column(&image_column);
@ -278,18 +295,23 @@ impl Projects {
self.name_renderer.set_property_width_chars(60);
self.path_renderer.set_property_width_chars(60);
self.path_renderer
.set_property_ellipsize(pango::EllipsizeMode::Start);
self.path_renderer.set_property_ellipsize(
pango::EllipsizeMode::Start,
);
text_column.pack_start(&self.name_renderer, true);
text_column.pack_start(&self.path_renderer, true);
text_column.add_attribute(&self.name_renderer,
"markup",
ProjectViewColumns::Name as i32);
text_column.add_attribute(&self.path_renderer,
"markup",
ProjectViewColumns::Path as i32);
text_column.add_attribute(
&self.name_renderer,
"markup",
ProjectViewColumns::Name as i32,
);
text_column.add_attribute(
&self.path_renderer,
"markup",
ProjectViewColumns::Path as i32,
);
let area = text_column
.get_area()
@ -306,12 +328,16 @@ impl Projects {
self.toggle_renderer.set_padding(10, 0);
toggle_column.pack_start(&self.toggle_renderer, true);
toggle_column.add_attribute(&self.toggle_renderer,
"visible",
ProjectViewColumns::Project as i32);
toggle_column.add_attribute(&self.toggle_renderer,
"active",
ProjectViewColumns::ProjectStored as i32);
toggle_column.add_attribute(
&self.toggle_renderer,
"visible",
ProjectViewColumns::Project as i32,
);
toggle_column.add_attribute(
&self.toggle_renderer,
"active",
ProjectViewColumns::ProjectStored as i32,
);
self.tree.append_column(&toggle_column);
}
@ -333,19 +359,19 @@ fn on_treeview_allocate(projects: Rc<RefCell<Projects>>) {
let treeview_height = projects.borrow().calc_treeview_height();
idle_add(move || {
let prj = projects.borrow();
let prj = projects.borrow();
// strange solution to make gtk assertions happy
let previous_height = prj.scroll.get_max_content_height();
if previous_height < treeview_height {
prj.scroll.set_max_content_height(treeview_height);
prj.scroll.set_min_content_height(treeview_height);
} else if previous_height > treeview_height {
prj.scroll.set_min_content_height(treeview_height);
prj.scroll.set_max_content_height(treeview_height);
}
Continue(false)
});
// strange solution to make gtk assertions happy
let previous_height = prj.scroll.get_max_content_height();
if previous_height < treeview_height {
prj.scroll.set_max_content_height(treeview_height);
prj.scroll.set_min_content_height(treeview_height);
} else if previous_height > treeview_height {
prj.scroll.set_min_content_height(treeview_height);
prj.scroll.set_max_content_height(treeview_height);
}
Continue(false)
});
}
@ -368,7 +394,7 @@ fn list_old_files(nvim: &mut Neovim) -> Vec<String> {
}
}
err @ Err(_) => {
err.report_err(nvim);
err.report_err();
vec![]
}
}
@ -381,9 +407,7 @@ pub struct EntryStore {
impl EntryStore {
pub fn find_mut(&mut self, uri: &str) -> Option<&mut Entry> {
self.entries
.iter_mut()
.find(|e| e.project && e.uri == uri)
self.entries.iter_mut().find(|e| e.project && e.uri == uri)
}
pub fn load(nvim: &mut Neovim) -> EntryStore {
@ -396,17 +420,14 @@ impl EntryStore {
match nvim.call_function("getcwd", vec![]) {
Ok(pwd) => {
if let Some(pwd) = pwd.as_str() {
if entries
.iter()
.find(|e| e.project && e.uri == pwd)
.is_none() {
if entries.iter().find(|e| e.project && e.uri == pwd).is_none() {
entries.insert(0, Entry::new_current_project(pwd));
}
} else {
println!("Error get current directory");
}
}
err @ Err(_) => err.report_err(nvim),
err @ Err(_) => err.report_err(),
}
let old_files = list_old_files(nvim);
@ -420,24 +441,26 @@ impl EntryStore {
pub fn save(&self) {
if self.changed {
ProjectSettings::new(self.entries
.iter()
.filter(|e| e.project && e.stored)
.map(|p| p.to_entry_settings())
.collect())
.save();
ProjectSettings::new(
self.entries
.iter()
.filter(|e| e.project && e.stored)
.map(|p| p.to_entry_settings())
.collect(),
).save();
}
}
pub fn populate(&self, list_store: &ListStore, filter: Option<&String>) {
for file in &self.entries {
if match filter.map(|f| f.to_uppercase()) {
Some(ref filter) => {
file.file_name.to_uppercase().contains(filter) ||
file.path.to_uppercase().contains(filter)
}
None => true,
} {
Some(ref filter) => {
file.file_name.to_uppercase().contains(filter) ||
file.path.to_uppercase().contains(filter)
}
None => true,
}
{
list_store.insert_with_values(None, &COLUMN_IDS, &file.to_values());
}
}
@ -465,7 +488,9 @@ impl Entry {
Entry {
uri: uri.to_owned(),
path: path.parent()
.map(|s| format!("<small>{}</small>", encode_minimal(&s.to_string_lossy())))
.map(|s| {
format!("<small>{}</small>", encode_minimal(&s.to_string_lossy()))
})
.unwrap_or_else(|| "".to_owned()),
file_name: format!("<big>{}</big>", encode_minimal(name)),
name: name.to_owned(),
@ -484,7 +509,9 @@ impl Entry {
Entry {
uri: uri.to_owned(),
path: path.parent()
.map(|s| format!("<small>{}</small>", encode_minimal(&s.to_string_lossy())))
.map(|s| {
format!("<small>{}</small>", encode_minimal(&s.to_string_lossy()))
})
.unwrap_or_else(|| "".to_owned()),
file_name: format!("<big>{}</big>", encode_minimal(&name)),
name,
@ -504,9 +531,8 @@ impl Entry {
uri: uri.to_owned(),
path: path.parent()
.map(|s| {
format!("<small>{}</small>",
encode_minimal(&s.to_string_lossy()))
})
format!("<small>{}</small>", encode_minimal(&s.to_string_lossy()))
})
.unwrap_or_else(|| "".to_owned()),
file_name: format!("<big>{}</big>", encode_minimal(&name)),
name,
@ -517,12 +543,16 @@ impl Entry {
}
fn to_values(&self) -> Box<[&gtk::ToValue]> {
Box::new([&self.file_name,
&self.path,
&self.uri,
&self.pixbuf,
&self.project,
&self.stored])
Box::new(
[
&self.file_name,
&self.path,
&self.uri,
&self.pixbuf,
&self.project,
&self.stored,
],
)
}
fn to_entry_settings(&self) -> ProjectEntrySettings {
@ -576,4 +606,3 @@ impl ProjectSettings {
ProjectSettings { projects }
}
}

View File

@ -57,7 +57,7 @@ struct ContextState {
impl ContextState {
pub fn new(font_desc: pango::FontDescription) -> Self {
let font_map = FontMap::get_default();
let font_map = FontMap::get_default().unwrap();
let pango_context = font_map.create_context().unwrap();
pango_context.set_font_description(&font_desc);

View File

@ -9,10 +9,12 @@ use self::model_clip_iterator::{RowView, ModelClipIteratorFactory};
use mode;
use color;
use sys::pango::*;
use sys::pangocairo::*;
use pango;
use cairo;
use pangocairo;
use cursor;
use pangocairo::CairoContextExt;
use ui_model;
pub fn render<RC: cursor::CursorRedrawCb + 'static>(
@ -34,6 +36,15 @@ pub fn render<RC: cursor::CursorRedrawCb + 'static>(
let &CellMetrics { char_width, .. } = cell_metrics;
let (cursor_row, cursor_col) = ui_model.get_cursor();
for cell_view in ui_model.get_clip_iterator(ctx, cell_metrics) {
let mut line_x = 0.0;
for (col, cell) in cell_view.line.line.iter().enumerate() {
draw_cell_bg(&cell_view, color_model, cell, col, line_x);
line_x += char_width;
}
}
for cell_view in ui_model.get_clip_iterator(ctx, cell_metrics) {
let mut line_x = 0.0;
let RowView { line, row, line_y, .. } = cell_view;
@ -44,7 +55,6 @@ pub fn render<RC: cursor::CursorRedrawCb + 'static>(
draw_underline(&cell_view, color_model, cell, line_x);
if row == cursor_row && col == cursor_col {
let double_width = line.line.get(col + 1).map_or(
false,
@ -96,7 +106,7 @@ fn draw_underline(
let undercurl_height = (underline_thickness * 4.0).min(max_undercurl_height);
let undercurl_y = line_y + underline_position - undercurl_height / 2.0;
ctx.show_error_underline(line_x, undercurl_y, char_width, undercurl_height);
pangocairo::functions::error_underline_path(ctx, line_x, undercurl_y, char_width, undercurl_height);
} else if cell.attrs.underline {
let fg = color_model.actual_cell_fg(cell);
ctx.set_source_rgb(fg.0, fg.1, fg.2);
@ -108,6 +118,48 @@ fn draw_underline(
}
}
fn draw_cell_bg(
cell_view: &RowView,
color_model: &color::ColorModel,
cell: &ui_model::Cell,
col: usize,
line_x: f64,
) {
let &RowView {
ctx,
line,
line_y,
cell_metrics: &CellMetrics {
char_width,
line_height,
..
},
..
} = cell_view;
let bg = color_model.cell_bg(cell);
if let Some(bg) = bg {
if !line.is_binded_to_item(col) {
if bg != &color_model.bg_color {
ctx.set_source_rgb(bg.0, bg.1, bg.2);
ctx.rectangle(line_x, line_y, char_width, line_height);
ctx.fill();
}
} else {
ctx.set_source_rgb(bg.0, bg.1, bg.2);
ctx.rectangle(
line_x,
line_y,
char_width * line.item_len_from_idx(col) as f64,
line_height,
);
ctx.fill();
}
}
}
fn draw_cell(
cell_view: &RowView,
color_model: &color::ColorModel,
@ -121,41 +173,22 @@ fn draw_cell(
line,
line_y,
cell_metrics: &CellMetrics {
char_width,
line_height,
ascent,
..
},
..
} = cell_view;
let (bg, fg) = color_model.cell_colors(cell);
if let Some(item) = line.item_line[col].as_ref() {
if let Some(bg) = bg {
ctx.set_source_rgb(bg.0, bg.1, bg.2);
ctx.rectangle(
line_x,
line_y,
char_width * line.item_len_from_idx(col) as f64,
line_height,
);
ctx.fill();
}
if let Some(ref glyphs) = item.glyphs {
let fg = color_model.actual_cell_fg(cell);
ctx.move_to(line_x, line_y + ascent);
ctx.set_source_rgb(fg.0, fg.1, fg.2);
ctx.show_glyph_string(item.font(), glyphs);
show_glyph_string(ctx, item.font(), glyphs);
}
} else if !line.is_binded_to_item(col) {
let bg = color_model.cell_bg(cell);
if let Some(bg) = bg {
ctx.set_source_rgb(bg.0, bg.1, bg.2);
ctx.rectangle(line_x, line_y, char_width, line_height);
ctx.fill();
}
}
}

View File

@ -1,12 +1,12 @@
use std::cell::{RefCell, Cell};
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::{Arc, Condvar, Mutex};
use std::ops::Deref;
use std::thread;
use std::collections::HashMap;
use std::time::Duration;
use cairo;
use pangocairo::CairoContextExt;
use pango::{LayoutExt, FontDescription};
use gdk;
use gdk::{ModifierType, EventButton, EventMotion, EventType, EventScroll};
@ -14,6 +14,7 @@ use gdk_sys;
use glib;
use gtk;
use gtk::prelude::*;
use pangocairo;
use neovim_lib::{Neovim, NeovimApi, Value};
use neovim_lib::neovim_api::Tabpage;
@ -21,16 +22,15 @@ use neovim_lib::neovim_api::Tabpage;
use settings::{Settings, FontSource};
use ui_model::{UiModel, Attrs, ModelRect};
use color::{ColorModel, Color, COLOR_BLACK, COLOR_WHITE, COLOR_RED};
use nvim::{self, RedrawEvents, GuiApi, RepaintMode, ErrorReport, NeovimClient, NeovimRef,
NeovimClientAsync};
use input::{self, keyval_to_input_string};
use nvim::{self, RedrawEvents, GuiApi, RepaintMode, ErrorReport, NeovimClient,
NeovimRef, NeovimClientAsync, CompleteItem};
use input;
use input::keyval_to_input_string;
use cursor::{Cursor, CursorRedrawCb};
use ui::UiMutex;
use popup_menu::{self, PopupMenu};
use tabline::Tabline;
use cmd_line::{self, CmdLine};
use cmd_line::CmdLine;
use error;
use mode;
use render;
@ -52,12 +52,27 @@ macro_rules! idle_cb_call {
}
#[derive(Debug, Clone, Copy)]
enum ResizeState {
NvimResizeTimer(glib::SourceId, usize, usize),
enum ResizeStateEnum {
NvimResizeTimer(usize, usize),
NvimResizeRequest(usize, usize),
Wait,
}
pub struct ResizeState {
state: ResizeStateEnum,
timer: Option<glib::SourceId>,
}
impl ResizeState {
pub fn new() -> Self {
ResizeState {
state: ResizeStateEnum::Wait,
timer: None,
}
}
}
pub struct RenderState {
pub font_ctx: render::Context,
pub color_model: ColorModel,
@ -86,12 +101,12 @@ pub struct State {
render_state: Rc<RefCell<RenderState>>,
stack: gtk::Stack,
drawing_area: gtk::DrawingArea,
pub drawing_area: gtk::DrawingArea,
tabs: Tabline,
im_context: gtk::IMMulticontext,
error_area: error::ErrorArea,
resize_state: Rc<Cell<ResizeState>>,
resize_state: Rc<RefCell<ResizeState>>,
options: ShellOptions,
@ -124,7 +139,7 @@ impl State {
im_context: gtk::IMMulticontext::new(),
error_area: error::ErrorArea::new(),
resize_state: Rc::new(Cell::new(ResizeState::Wait)),
resize_state: Rc::new(RefCell::new(ResizeState::new())),
options,
@ -133,6 +148,13 @@ impl State {
}
}
/// Return NeovimRef only if vim in non blocking state
///
/// Note that this call also do neovim api call get_mode
pub fn nvim_non_blocked(&self) -> Option<NeovimRef> {
self.nvim().and_then(NeovimRef::non_blocked)
}
pub fn nvim(&self) -> Option<NeovimRef> {
self.nvim.nvim()
}
@ -183,20 +205,20 @@ impl State {
pub fn open_file(&self, path: &str) {
if let Some(mut nvim) = self.nvim() {
nvim.command(&format!("e {}", path)).report_err(&mut *nvim);
nvim.command(&format!("e {}", path)).report_err();
}
}
pub fn cd(&self, path: &str) {
if let Some(mut nvim) = self.nvim() {
nvim.command(&format!("cd {}", path)).report_err(&mut *nvim);
nvim.command(&format!("cd {}", path)).report_err();
}
}
fn close_popup_menu(&self) {
if self.popup_menu.is_open() {
if let Some(mut nvim) = self.nvim() {
nvim.input("<Esc>").report_err(&mut *nvim);
nvim.input("<Esc>").report_err();
}
}
}
@ -282,24 +304,26 @@ impl State {
fn try_nvim_resize(&self) {
let (columns, rows) = self.calc_nvim_size();
let mut resize_state = self.resize_state.borrow_mut();
match self.resize_state.get() {
ResizeState::NvimResizeTimer(timer, req_columns, req_rows) => {
match resize_state.state {
ResizeStateEnum::NvimResizeTimer(req_columns, req_rows) => {
if req_columns == columns && req_rows == rows {
return;
}
glib::source_remove(timer);
glib::source_remove(resize_state.timer.take().unwrap());
resize_state.state = ResizeStateEnum::Wait;
}
ResizeState::NvimResizeRequest(req_columns, req_rows) => {
ResizeStateEnum::NvimResizeRequest(req_columns, req_rows) => {
if req_columns == columns && req_rows == rows {
return;
}
}
ResizeState::Wait => (),
ResizeStateEnum::Wait => (),
}
let resize_state = self.resize_state.clone();
let resize_state_ref = self.resize_state.clone();
let nvim = self.nvim.clone();
@ -307,21 +331,19 @@ impl State {
return;
}
self.resize_state.set(ResizeState::NvimResizeTimer(
gtk::timeout_add(250, move || {
resize_state.set(ResizeState::NvimResizeRequest(columns, rows));
resize_state.state = ResizeStateEnum::NvimResizeTimer(columns, rows);
resize_state.timer = Some(gtk::timeout_add(250, move || {
let mut resize_state = resize_state_ref.borrow_mut();
resize_state.state = ResizeStateEnum::NvimResizeRequest(columns, rows);
resize_state.timer = None;
if let Some(mut nvim) = nvim.nvim() {
if let Err(err) = nvim.ui_try_resize(columns as u64, rows as u64) {
error!("Error trying resize nvim {}", err);
}
if let Some(mut nvim) = nvim.nvim().and_then(NeovimRef::non_blocked) {
if let Err(err) = nvim.ui_try_resize(columns as u64, rows as u64) {
error!("Error trying resize nvim {}", err);
}
Continue(false)
}),
columns,
rows,
));
}
Continue(false)
}));
}
fn get_window(&self) -> gtk::Window {
@ -361,10 +383,10 @@ impl State {
render_state.mode.is(&mode::NvimMode::Normal)
{
let paste_code = format!("normal! \"{}P", clipboard);
nvim.command(&paste_code).report_err(&mut *nvim);
nvim.command(&paste_code).report_err();
} else {
let paste_code = format!("<C-r>{}", clipboard);
nvim.input(&paste_code).report_err(&mut *nvim);
nvim.input(&paste_code).report_err();
};
}
@ -373,11 +395,15 @@ impl State {
pub struct UiState {
mouse_pressed: bool,
scroll_delta: (f64, f64),
}
impl UiState {
pub fn new() -> UiState {
UiState { mouse_pressed: false }
UiState {
mouse_pressed: false,
scroll_delta: (0.0, 0.0),
}
}
}
@ -385,13 +411,19 @@ impl UiState {
pub struct ShellOptions {
nvim_bin_path: Option<String>,
open_path: Option<String>,
timeout: Option<Duration>,
}
impl ShellOptions {
pub fn new(nvim_bin_path: Option<String>, open_path: Option<String>) -> Self {
pub fn new(
nvim_bin_path: Option<String>,
open_path: Option<String>,
timeout: Option<Duration>,
) -> Self {
ShellOptions {
nvim_bin_path,
open_path,
timeout,
}
}
}
@ -443,8 +475,8 @@ impl Shell {
state.drawing_area.set_events(
(gdk_sys::GDK_BUTTON_RELEASE_MASK | gdk_sys::GDK_BUTTON_PRESS_MASK |
gdk_sys::GDK_BUTTON_MOTION_MASK |
gdk_sys::GDK_SCROLL_MASK)
gdk_sys::GDK_BUTTON_MOTION_MASK | gdk_sys::GDK_SCROLL_MASK |
gdk_sys::GDK_SMOOTH_SCROLL_MASK)
.bits() as i32,
);
@ -490,18 +522,19 @@ impl Shell {
let ref_state = self.state.clone();
state.drawing_area.connect_key_press_event(move |_, ev| {
let mut shell = ref_state.borrow_mut();
shell.cursor.as_mut().unwrap().reset_state();
// GtkIMContext will eat a Shift-Space and not tell us about shift.
// Also don't let IME eat any GDK_KEY_KP_ events
if !ev.get_state().contains(gdk::SHIFT_MASK) &&
ev.get_keyval() < gdk_sys::GDK_KEY_KP_Space as u32 &&
ev.get_keyval() > gdk_sys::GDK_KEY_KP_Divide as u32 &&
shell.im_context.filter_keypress(ev)
{
ref_state
.borrow_mut()
.cursor
.as_mut()
.unwrap()
.reset_state();
if ref_state.borrow().im_context.filter_keypress(ev) {
Inhibit(true)
} else {
if let Some(mut nvim) = shell.nvim() {
let state = ref_state.borrow();
let nvim = state.nvim();
if let Some(mut nvim) = nvim {
input::gtk_key_press(&mut nvim, ev)
} else {
Inhibit(false)
@ -515,8 +548,13 @@ impl Shell {
});
let ref_state = self.state.clone();
let ref_ui_state = self.ui_state.clone();
state.drawing_area.connect_scroll_event(move |_, ev| {
gtk_scroll_event(&mut *ref_state.borrow_mut(), ev)
gtk_scroll_event(
&mut *ref_state.borrow_mut(),
&mut *ref_ui_state.borrow_mut(),
ev,
)
});
let ref_state = self.state.clone();
@ -596,7 +634,7 @@ impl Shell {
let nvim = state.nvim();
if let Some(mut nvim) = nvim {
nvim.command(":wa").report_err(&mut *nvim);
nvim.command(":wa").report_err();
}
}
@ -626,9 +664,9 @@ impl Deref for Shell {
}
fn gtk_focus_in(state: &mut State) -> Inhibit {
if let Some(mut nvim) = state.nvim() {
if let Some(mut nvim) = state.nvim_non_blocked() {
nvim.command("if exists('#FocusGained') | doautocmd FocusGained | endif")
.report_err(&mut *nvim);
.report_err();
}
state.im_context.focus_in();
@ -639,9 +677,9 @@ fn gtk_focus_in(state: &mut State) -> Inhibit {
}
fn gtk_focus_out(state: &mut State) -> Inhibit {
if let Some(mut nvim) = state.nvim() {
if let Some(mut nvim) = state.nvim_non_blocked() {
nvim.command("if exists('#FocusLost') | doautocmd FocusLost | endif")
.report_err(&mut *nvim);
.report_err();
}
state.im_context.focus_out();
@ -652,26 +690,50 @@ fn gtk_focus_out(state: &mut State) -> Inhibit {
Inhibit(false)
}
fn gtk_scroll_event(state: &mut State, ev: &EventScroll) -> Inhibit {
fn gtk_scroll_event(state: &mut State, ui_state: &mut UiState, ev: &EventScroll) -> Inhibit {
if !state.mouse_enabled {
return Inhibit(false);
}
state.close_popup_menu();
match ev.as_ref().direction {
gdk_sys::GdkScrollDirection::Right => {
match ev.get_direction() {
gdk::ScrollDirection::Right => {
mouse_input(state, "ScrollWheelRight", ev.get_state(), ev.get_position())
}
gdk_sys::GdkScrollDirection::Left => {
gdk::ScrollDirection::Left => {
mouse_input(state, "ScrollWheelLeft", ev.get_state(), ev.get_position())
}
gdk_sys::GdkScrollDirection::Up => {
gdk::ScrollDirection::Up => {
mouse_input(state, "ScrollWheelUp", ev.get_state(), ev.get_position())
}
gdk_sys::GdkScrollDirection::Down => {
gdk::ScrollDirection::Down => {
mouse_input(state, "ScrollWheelDown", ev.get_state(), ev.get_position())
}
gdk::ScrollDirection::Smooth => {
// Remember and accumulate scroll deltas, so slow scrolling still
// works.
ui_state.scroll_delta.0 += ev.as_ref().delta_x;
ui_state.scroll_delta.1 += ev.as_ref().delta_y;
// Perform scroll action for deltas with abs(delta) >= 1.
let x = ui_state.scroll_delta.0 as isize;
let y = ui_state.scroll_delta.1 as isize;
for _ in 0..x {
mouse_input(state, "ScrollWheelRight", ev.get_state(), ev.get_position())
}
for _ in 0..-x {
mouse_input(state, "ScrollWheelLeft", ev.get_state(), ev.get_position())
}
for _ in 0..y {
mouse_input(state, "ScrollWheelDown", ev.get_state(), ev.get_position())
}
for _ in 0..-y {
mouse_input(state, "ScrollWheelUp", ev.get_state(), ev.get_position())
}
// Subtract performed scroll deltas.
ui_state.scroll_delta.0 -= x as f64;
ui_state.scroll_delta.1 -= y as f64;
}
_ => (),
}
Inhibit(false)
@ -790,7 +852,11 @@ fn init_nvim_async(
rows: usize,
) {
// execute nvim
let nvim = match nvim::start(state_arc.clone(), options.nvim_bin_path.as_ref()) {
let nvim = match nvim::start(
state_arc.clone(),
options.nvim_bin_path.as_ref(),
options.timeout,
) {
Ok(nvim) => nvim,
Err(err) => {
show_nvim_start_error(&err, state_arc);
@ -873,7 +939,7 @@ fn set_nvim_initialized(state_arc: Arc<UiMutex<State>>) {
fn draw_initializing(state: &State, ctx: &cairo::Context) {
let render_state = state.render_state.borrow();
let color_model = &render_state.color_model;
let layout = ctx.create_pango_layout();
let layout = pangocairo::functions::create_layout(ctx).unwrap();
let desc = render_state.font_ctx.font_description();
let alloc = state.drawing_area.get_allocation();
@ -897,8 +963,8 @@ fn draw_initializing(state: &State, ctx: &cairo::Context) {
color_model.fg_color.1,
color_model.fg_color.2,
);
ctx.update_pango_layout(&layout);
ctx.show_pango_layout(&layout);
pangocairo::functions::update_layout(ctx, &layout);
pangocairo::functions::show_layout(ctx, &layout);
ctx.move_to(x + width as f64, y);
@ -917,9 +983,7 @@ fn init_nvim(state_ref: &Arc<UiMutex<State>>) {
if state.start_nvim_initialization() {
let (cols, rows) = state.calc_nvim_size();
state.model = UiModel::new(rows as u64, cols as u64);
state.resize_state.set(
ResizeState::NvimResizeRequest(cols, rows),
);
state.resize_state.borrow_mut().state = ResizeStateEnum::NvimResizeRequest(cols, rows);
let state_arc = state_ref.clone();
let options = state.options.clone();
@ -951,16 +1015,17 @@ impl RedrawEvents for State {
}
fn on_resize(&mut self, columns: u64, rows: u64) -> RepaintMode {
match self.resize_state.get() {
ResizeState::NvimResizeTimer(..) => {
let state = self.resize_state.borrow().state.clone();
match state {
ResizeStateEnum::NvimResizeTimer(..) => {
if self.model.columns != columns as usize || self.model.rows != rows as usize {
self.model = UiModel::new(rows, columns);
}
}
ResizeState::Wait |
ResizeState::NvimResizeRequest(..) => {
ResizeStateEnum::Wait |
ResizeStateEnum::NvimResizeRequest(..) => {
if self.model.columns != columns as usize || self.model.rows != rows as usize {
self.resize_state.set(ResizeState::Wait);
self.resize_state.borrow_mut().state = ResizeStateEnum::Wait;
self.model = UiModel::new(rows, columns);
self.resize_main_window();
}
@ -1054,7 +1119,7 @@ impl RedrawEvents for State {
fn popupmenu_show(
&mut self,
menu: Vec<Vec<String>>,
menu: &[CompleteItem],
selected: i64,
row: u64,
col: u64,
@ -1073,6 +1138,7 @@ impl RedrawEvents for State {
y,
width,
height,
max_width: self.drawing_area.get_allocated_width() - 20,
};
self.popup_menu.show(context);

View File

@ -31,7 +31,7 @@ fn show_not_saved_dlg(comps: &UiMutex<Components>, shell: &Shell, changed_bufs:
.fold(String::new(), |acc, v| acc + v + "\n");
changed_files.pop();
let flags = gtk::DIALOG_MODAL | gtk::DIALOG_DESTROY_WITH_PARENT;
let flags = gtk::DialogFlags::MODAL | gtk::DialogFlags::DESTROY_WITH_PARENT;
let dlg = MessageDialog::new(
Some(comps.borrow().window()),
flags,

View File

@ -1,2 +1,3 @@
pub mod pango;
pub mod pangocairo;

View File

@ -5,15 +5,13 @@ use glib::translate::*;
pub struct Analysis<'a>(&'a pango_sys::PangoAnalysis);
impl <'a> Analysis <'a> {
impl<'a> Analysis<'a> {
pub fn from(analysis: &'a pango_sys::PangoAnalysis) -> Self {
Analysis(analysis)
}
pub fn font(&self) -> pango::Font {
unsafe {
from_glib_none(self.0.font)
}
unsafe { from_glib_none(self.0.font) }
}
pub fn to_glib_ptr(&self) -> *const pango_sys::PangoAnalysis {

View File

@ -23,7 +23,7 @@ pub trait AttrIteratorFactory {
impl AttrIteratorFactory for pango::AttrList {
fn get_iterator(&self) -> AttrIterator {
unsafe {
from_glib_none(pango_sys::pango_attr_list_get_iterator(
from_glib_full(pango_sys::pango_attr_list_get_iterator(
self.to_glib_none().0,
))
}

View File

@ -22,9 +22,7 @@ glib_wrapper! {
impl Item {
#[cfg(test)]
pub fn new() -> Self {
unsafe {
from_glib_none(pango_sys::pango_item_new())
}
unsafe { from_glib_full(pango_sys::pango_item_new()) }
}
pub fn analysis(&self) -> analysis::Analysis {
@ -32,6 +30,10 @@ impl Item {
}
pub fn offset(&self) -> (usize, usize, usize) {
(self.0.offset as usize, self.0.length as usize, self.0.num_chars as usize)
(
self.0.offset as usize,
self.0.length as usize,
self.0.num_chars as usize,
)
}
}

View File

@ -10,6 +10,7 @@ use std::ptr;
use pango;
use pango_sys;
use glib_ffi;
use glib::translate::*;
@ -22,17 +23,26 @@ pub fn pango_itemize(
cached_iter: Option<&mut AttrIterator>,
) -> Vec<Item> {
unsafe {
FromGlibPtrContainer::from_glib_container(pango_sys::pango_itemize(
//FromGlibPtrContainer::from_glib_full(pango_sys::pango_itemize(
from_glib_full_as_vec(pango_sys::pango_itemize(
context.to_glib_none().0,
text.as_ptr() as *const i8,
start_index as i32,
length as i32,
attrs.to_glib_none().0,
cached_iter.map(|iter| iter.to_glib_none_mut().0).unwrap_or(ptr::null_mut()),
cached_iter
.map(|iter| iter.to_glib_none_mut().0)
.unwrap_or(ptr::null_mut()),
))
}
}
unsafe fn from_glib_full_as_vec(ptr: *mut glib_ffi::GList) -> Vec<Item> {
let num = glib_ffi::g_list_length(ptr) as usize;
FromGlibContainer::from_glib_full_num(ptr, num)
}
pub fn pango_shape(
text: &str,
offset: usize,
@ -51,4 +61,3 @@ pub fn pango_shape(
);
}
}

16
src/sys/pangocairo/mod.rs Normal file
View File

@ -0,0 +1,16 @@
use pango;
use cairo;
use pango_cairo_sys as ffi;
use glib::translate::*;
pub fn show_glyph_string(cr: &cairo::Context, font: &pango::Font, glyphs: &pango::GlyphString) {
unsafe {
ffi::pango_cairo_show_glyph_string(
mut_override(cr.to_glib_none().0),
font.to_glib_none().0,
mut_override(glyphs.to_glib_none().0),
);
}
}

View File

@ -5,6 +5,7 @@ use std::cell::RefCell;
use gtk;
use gtk::prelude::*;
use glib;
use glib::signal;
use pango;
@ -34,7 +35,7 @@ impl State {
let target = &self.data[idx as usize];
if Some(target) != self.selected.as_ref() {
if let Some(mut nvim) = self.nvim.as_ref().unwrap().nvim() {
nvim.set_current_tabpage(target).report_err(&mut *nvim);
nvim.set_current_tabpage(target).report_err();
}
}
}
@ -43,7 +44,7 @@ impl State {
pub struct Tabline {
tabs: gtk::Notebook,
state: Rc<RefCell<State>>,
switch_handler_id: u64,
switch_handler_id: glib::SignalHandlerId,
}
impl Tabline {
@ -102,7 +103,7 @@ impl Tabline {
self.update_state(nvim, selected, tabs);
signal::signal_handler_block(&self.tabs, self.switch_handler_id);
signal::signal_handler_block(&self.tabs, &self.switch_handler_id);
let count = self.tabs.get_n_pages() as usize;
if count < tabs.len() {
@ -134,7 +135,7 @@ impl Tabline {
}
}
signal::signal_handler_unblock(&self.tabs, self.switch_handler_id);
signal::signal_handler_unblock(&self.tabs, &self.switch_handler_id);
}
}

View File

@ -55,12 +55,16 @@ fn get_hl_color(map: &HashMap<&str, &Value>, color_name: &str) -> Option<Color>
fn get_hl_colors(nvim: &mut Neovim, hl: &str) -> (Option<Color>, Option<Color>) {
nvim.get_hl_by_name(hl, true)
.ok_and_report(nvim)
.ok_and_report()
.and_then(|m| if let Some(m) = m.to_attrs_map_report() {
Some((
get_hl_color(&m, "background"),
get_hl_color(&m, "foreground"),
))
let reverse = m.get("reverse").and_then(|v| v.as_bool()).unwrap_or(false);
let bg = get_hl_color(&m, "background");
let fg = get_hl_color(&m, "foreground");
if reverse {
Some((fg, bg))
} else {
Some((bg, fg))
}
} else {
None
})

View File

@ -6,9 +6,9 @@ use std::sync::Arc;
use gtk;
use gtk_sys;
use gtk::prelude::*;
use gtk::{ApplicationWindow, HeaderBar, ToolButton, Image, AboutDialog};
use gtk::{ApplicationWindow, HeaderBar, ToolButton, Image, AboutDialog, SettingsExt};
use gio::prelude::*;
use gio::{Menu, MenuExt, MenuItem, MenuItemExt, SimpleAction};
use gio::{Menu, MenuExt, MenuItem, SimpleAction};
use settings::Settings;
use shell::{Shell, ShellOptions};
@ -105,6 +105,15 @@ impl Ui {
comps.window = Some(ApplicationWindow::new(app));
let window = comps.window.as_ref().unwrap();
let prefer_dark_theme = env::var("NVIM_GTK_PREFER_DARK_THEME")
.map(|opt| opt.trim() == "1")
.unwrap_or(false);
if prefer_dark_theme {
if let Some(settings) = window.get_settings() {
settings.set_property_gtk_application_prefer_dark_theme(true);
}
}
// Client side decorations including the toolbar are disabled via NVIM_GTK_NO_HEADERBAR=1
let use_header_bar = env::var("NVIM_GTK_NO_HEADERBAR")
.map(|opt| opt.trim() != "1")
@ -185,14 +194,16 @@ impl Ui {
let menu = Menu::new();
let plugs = MenuItem::new("Plugins", None);
plugs.set_detailed_action("app.Plugins");
menu.append_item(&plugs);
let section = Menu::new();
section.append_item(&MenuItem::new("New Window", "app.new-window"));
menu.append_section(None, &section);
let about = MenuItem::new("About", None);
about.set_detailed_action("app.HelpAbout");
menu.append_item(&about);
let section = Menu::new();
section.append_item(&MenuItem::new("Plugins", "app.Plugins"));
section.append_item(&MenuItem::new("About", "app.HelpAbout"));
menu.append_section(None, &section);
menu.freeze();
app.set_app_menu(Some(&menu));
let plugs_action = SimpleAction::new("Plugins", None);

View File

@ -16,7 +16,7 @@ impl ValueMapExt for Vec<(Value, Value)> {
.ok_or_else(|| "Can't convert map key to string".to_owned())
.map(|key| (key, &p.1))
})
.collect::<Result<HashMap<&str, &Value>, String>>()
.collect::<Result<HashMap<&str, &Value>, String>>()
}