vendor: update dependencies to latest

This commit is contained in:
Nick Craig-Wood
2018-11-26 14:10:33 +00:00
parent 58f7141c96
commit 89625e54cf
173 changed files with 4954 additions and 2224 deletions
+39 -6
View File
@@ -76,6 +76,10 @@ func (this coord) uintptr() uintptr {
return uintptr(*(*int32)(unsafe.Pointer(&this)))
}
func (this *small_rect) uintptr() uintptr {
return uintptr(unsafe.Pointer(this))
}
var kernel32 = syscall.NewLazyDLL("kernel32.dll")
var moduser32 = syscall.NewLazyDLL("user32.dll")
var is_cjk = runewidth.IsEastAsian()
@@ -83,6 +87,7 @@ var is_cjk = runewidth.IsEastAsian()
var (
proc_set_console_active_screen_buffer = kernel32.NewProc("SetConsoleActiveScreenBuffer")
proc_set_console_screen_buffer_size = kernel32.NewProc("SetConsoleScreenBufferSize")
proc_set_console_window_info = kernel32.NewProc("SetConsoleWindowInfo")
proc_create_console_screen_buffer = kernel32.NewProc("CreateConsoleScreenBuffer")
proc_get_console_screen_buffer_info = kernel32.NewProc("GetConsoleScreenBufferInfo")
proc_write_console_output = kernel32.NewProc("WriteConsoleOutputW")
@@ -129,6 +134,21 @@ func set_console_screen_buffer_size(h syscall.Handle, size coord) (err error) {
return
}
func set_console_window_info(h syscall.Handle, window *small_rect) (err error) {
var absolute uint32
absolute = 1
r0, _, e1 := syscall.Syscall(proc_set_console_window_info.Addr(),
3, uintptr(h), uintptr(absolute), window.uintptr())
if int(r0) == 0 {
if e1 != 0 {
err = error(e1)
} else {
err = syscall.EINVAL
}
}
return
}
func create_console_screen_buffer() (h syscall.Handle, err error) {
r0, _, e1 := syscall.Syscall6(proc_create_console_screen_buffer.Addr(),
5, uintptr(generic_read|generic_write), 0, 0, console_textmode_buffer, 0, 0)
@@ -278,6 +298,7 @@ func set_console_mode(h syscall.Handle, mode dword) (err error) {
}
func fill_console_output_character(h syscall.Handle, char wchar, n int) (err error) {
tmp_coord = coord{0, 0}
r0, _, e1 := syscall.Syscall6(proc_fill_console_output_character.Addr(),
5, uintptr(h), uintptr(char), uintptr(n), tmp_coord.uintptr(),
uintptr(unsafe.Pointer(&tmp_arg)), 0)
@@ -292,6 +313,7 @@ func fill_console_output_character(h syscall.Handle, char wchar, n int) (err err
}
func fill_console_output_attribute(h syscall.Handle, attr word, n int) (err error) {
tmp_coord = coord{0, 0}
r0, _, e1 := syscall.Syscall6(proc_fill_console_output_attribute.Addr(),
5, uintptr(h), uintptr(attr), uintptr(n), tmp_coord.uintptr(),
uintptr(unsafe.Pointer(&tmp_arg)), 0)
@@ -372,6 +394,7 @@ type input_event struct {
var (
orig_cursor_info console_cursor_info
orig_size coord
orig_window small_rect
orig_mode dword
orig_screen syscall.Handle
back_buffer cellbuf
@@ -413,12 +436,12 @@ func get_cursor_position(out syscall.Handle) coord {
return tmp_info.cursor_position
}
func get_term_size(out syscall.Handle) coord {
func get_term_size(out syscall.Handle) (coord, small_rect) {
err := get_console_screen_buffer_info(out, &tmp_info)
if err != nil {
panic(err)
}
return tmp_info.size
return tmp_info.size, tmp_info.window
}
func get_win_min_size(out syscall.Handle) coord {
@@ -466,10 +489,20 @@ func get_win_size(out syscall.Handle) coord {
return size
}
func fix_win_size(out syscall.Handle, size coord) (err error) {
window := small_rect{}
window.top = 0
window.bottom = size.y - 1
window.left = 0
window.right = size.x - 1
return set_console_window_info(out, &window)
}
func update_size_maybe() {
size := get_win_size(out)
if size.x != term_size.x || size.y != term_size.y {
set_console_screen_buffer_size(out, size)
fix_win_size(out, size)
term_size = size
back_buffer.resize(int(size.x), int(size.y))
front_buffer.resize(int(size.x), int(size.y))
@@ -490,8 +523,8 @@ var color_table_bg = []word{
background_green,
background_red | background_green, // yellow
background_blue,
background_red | background_blue, // magenta
background_green | background_blue, // cyan
background_red | background_blue, // magenta
background_green | background_blue, // cyan
background_red | background_blue | background_green, // white
}
@@ -502,8 +535,8 @@ var color_table_fg = []word{
foreground_green,
foreground_red | foreground_green, // yellow
foreground_blue,
foreground_red | foreground_blue, // magenta
foreground_green | foreground_blue, // cyan
foreground_red | foreground_blue, // magenta
foreground_green | foreground_blue, // cyan
foreground_red | foreground_blue | foreground_green, // white
}