rthornton128 / goncurses Goto Github PK
View Code? Open in Web Editor NEWNCurses Library for Go
License: Other
NCurses Library for Go
License: Other
Window.HLine has the signature "func (w *Window) HLine(y, x int, ch Char, wid
int)", whereas Window.VLine is "func (w *Window) VLine(y, x, ch Char, wid
int)". This makes the y and x coordinate values Char type - which doesn't seem
right, presumably this should be "func (w *Window) VLine(y, x int, ch Char, wid
int)".
Original issue reported on code.google.com by [email protected]
on 10 Dec 2013 at 10:43
I'm running into problems using REQ_LEFT.
The following code doesn't compile:
package main
import (
gc "github.com/rthornton128/goncurses"
)
func main() {
menuWin, _ := gc.Init()
gc.Raw(true)
gc.Echo(false)
menuWin.Keypad(true)
gc.Cursor(0)
menuWin.Keypad(true)
itemPos, _ := gc.NewItem("YES", "")
itemNeg, _ := gc.NewItem("NO","")
choices := []*gc.MenuItem {itemNeg, itemPos}
menu, _ := gc.NewMenu(choices)
menu.SetWindow(menuWin)
height, width := dimensions(menuWin)
menu.SubWindow(menuWin.Derived(height, width, 0, 0))
menu.Format(1, 2)
menu.Post()
menuWin.Refresh()
var key gc.Key
for ; ; key = menuWin.GetChar(){
switch key {
case gc.KEY_RIGHT:
menu.Driver(gc.REQ_RIGHT) // Works
case gc.KEY_LEFT:
menu.Driver(gc.REQ_LEFT) // Compilation error
}
}
gc.End()
}
func dimensions(w *gc.Window) (height int, width int) {
y, x := w.YX()
maxy, maxx := w.MaxYX()
height = maxy - y
width = maxx - x
return
}
Compilation error:
$ go build req_left.go
# command-line-arguments
./req_left.go:36:15: cannot use goncurses.REQ_LEFT (type goncurses.MenuDriverReq) as type int in argument to menu.Driver
However if I change REQ_LEFT to REQ_RIGHT it does compile.
$ go version
go version go1.13.8 linux/amd64
goncurses version seems to be v0.0.0-20200419155752-a72cfe131f63
according to my go.mod
file.
Should be vice versa :-)
http://code.google.com/p/goncurses/source/browse/defs.go#237
And I was debugging it like a crazy :X
Take care!
LZ
Original issue reported on code.google.com by [email protected]
on 31 Dec 2012 at 4:27
When I click then press any key it produces this panic
john@john-laptop:mouse$ go run *.go
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x8 pc=0x40bd66]
goroutine 1 [running]:
main.main()
/home/john/Documents/go/src/github.com/rthornton128/goncurses/examples/mouse/mouse.go:89 +0xcb6
goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1696 +0x1
exit status 2
https://github.com/rthornton128/goncurses/blob/master/examples/mouse/mouse.go#L89
go version go1.5 linux/amd64
Linux john-laptop 3.16.0-49-generic #65~14.04.1-Ubuntu SMP Wed Sep 9 10:03:23 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
I was just playing with it and thought someone else might have the same issue when really using it sometime.
Examples does not work, here is the fix:
http://code.google.com/r/lukas-goncurses-examples/
If you like my work, I can go ahead and fix the rest.
ps - I am not sure how Pull Requests work here :-)
Original issue reported on code.google.com by [email protected]
on 5 Nov 2012 at 7:34
I have been looking into #32 and #34 regarding the event KEY_RESIZE
not firing.
I suggest adding this information to the wiki page KnownIssues (I do not have rights to do that).
A new approach that I found out to be working (despite Go's limitations with the signal handler) is to compile the Go program with go build -buildmode=c-shared
and then link the .so
file in a C program that handles the getch()
loop.
KEY_RESIZE
will then be synthesised correctly.
Hey - is this a good idea?
func Lines() int {
return int(C.LINES)
}
func Cols() int {
return int(C.COLS)
}
I cant think of anything going wrong, and its useful for dealing with SIGWINCH.
Of course it doesn't work without calling endwin() and refresh but its still
convenient to get the new term size this way.
Original issue reported on code.google.com by [email protected]
on 10 Sep 2013 at 12:04
What steps will reproduce the problem?
1. go get on a platform not supported by existing constraints
2. watch as build errors from some files because of inconsistent availability
What version of the product are you using? On what operating system?
hg version 558b54308275 on Darwin
Please provide any additional information below.
Unfortunately, my go editing environment automatically stripped off trailing
spaces in lines, so the attached diff has a little more diff than strictly
needed. Leaving intact anyway.
Original issue reported on code.google.com by syscomet
on 5 Oct 2013 at 12:15
Attachments:
Hello
I am not sure if it must work at all I did not find any mention of utf8 support here, both ncurses (since version 5.13) and golang's C.CString support utf8, however.
In my case it is ncurses 6.1.20181013 and I tested C.CString separatelly in a simple C call from go, it prints utf-8
When using utf-8 strings with goncurses I get this output:
Све�~@�~E�~C видно в�~A�~Q
The problem seems to be down this call
Line 391 in 52220cf
Does anyone have utf-8 working ?
Hello. I'm on macosx. I've just installed pkg-config and ncurses through macport. If I go get
or either go build
in the directory, I get those errors: (edited because too long)
$ go build -v
github.com/rthornton128/goncurses
# github.com/rthornton128/goncurses
Undefined symbols for architecture x86_64:
"_current_item", referenced from:
__cgo_2373549b0191_Cfunc_current_item in _x006.o
(maybe you meant: __cgo_2373549b0191_Cfunc_set_current_item, __cgo_2373549b0191_Cfunc_current_item )
"_free_item", referenced from:
__cgo_2373549b0191_Cfunc_free_item in _x006.o
(maybe you meant: __cgo_2373549b0191_Cfunc_free_item)
"_free_menu", referenced from:
__cgo_2373549b0191_Cfunc_free_menu in _x006.o
(maybe you meant: __cgo_2373549b0191_Cfunc_free_menu)
"_item_count", referenced from:
__cgo_2373549b0191_Cfunc_item_count in _x006.o
(maybe you meant: __cgo_2373549b0191_Cfunc_item_count)
"_item_description", referenced from:
__cgo_2373549b0191_Cfunc_item_description in _x006.o
(maybe you meant: __cgo_2373549b0191_Cfunc_item_description)
"_item_index", referenced from:
__cgo_2373549b0191_Cfunc_item_index in _x006.o
(maybe you meant: __cgo_2373549b0191_Cfunc_item_index)
[EDITED]
"_set_menu_items", referenced from:
__cgo_2373549b0191_Cfunc_set_menu_items in _x006.o
(maybe you meant: __cgo_2373549b0191_Cfunc_set_menu_items)
"_set_menu_mark", referenced from:
__cgo_2373549b0191_Cfunc_set_menu_mark in _x006.o
(maybe you meant: __cgo_2373549b0191_Cfunc_set_menu_mark)
"_set_menu_pad", referenced from:
__cgo_2373549b0191_Cfunc_set_menu_pad in _x006.o
(maybe you meant: __cgo_2373549b0191_Cfunc_set_menu_pad)
"_set_menu_pattern", referenced from:
__cgo_2373549b0191_Cfunc_set_menu_pattern in _x006.o
(maybe you meant: __cgo_2373549b0191_Cfunc_set_menu_pattern)
"_set_menu_spacing", referenced from:
__cgo_2373549b0191_Cfunc_set_menu_spacing in _x006.o
(maybe you meant: __cgo_2373549b0191_Cfunc_set_menu_spacing)
"_set_menu_sub", referenced from:
__cgo_2373549b0191_Cfunc_set_menu_sub in _x006.o
(maybe you meant: __cgo_2373549b0191_Cfunc_set_menu_sub)
"_set_menu_win", referenced from:
__cgo_2373549b0191_Cfunc_set_menu_win in _x006.o
(maybe you meant: __cgo_2373549b0191_Cfunc_set_menu_win)
"_unpost_menu", referenced from:
__cgo_2373549b0191_Cfunc_unpost_menu in _x006.o
(maybe you meant: __cgo_2373549b0191_Cfunc_unpost_menu)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I found a workaround this issue: I removed the menu.go file, then the compilation passed. All those errors looks like they concern only the menu.go file. Then, doing so, all the examples compiles as well, except the examples related to the menu.
I have no idea on how to fix this issue in a more reliable way, since I never used cgo. Have any clue?
Regards
Yves
examples/{menu_mcol,menu_scroll,menugrey,menutoggle} all fail to build due to this issue.
cannot use gc.DriverActions[ch] (map index expression of type int) as goncurses.MenuDriverReq value in argument to menu.Driver
type MenuDriverReq C.int
Related? #53
I cannot work out how to add color to a part of a MenuItem. When I try droping ansi sequences into the string, I get nothing...
Is there a better way to do this?
items := make([]*gc.MenuItem, 1)
//itemStr := string("\033[31m") + "hello" + string("\033[0m") + "world"
itemStr := fmt.Sprintf(string("\033[31m") + "hello" + string("\033[0m") + "world")
items[0], _ = gc.NewItem(itemStr, "")
defer items[0].Free()
As of Go version 1.16, modules will be the default. Probably for the best this project gets brought more up to date.
What steps will reproduce the problem?
Run the attached program: go run bug.go
What is the expected output? What do you see instead?
On the first call to redraw_screen(), sometimes the output is very garbled.
What version of the product are you using? On what operating system?
go version go1.0.3
goncurses: today I did an update, so the latest version, as of today 2.2.13, I
think (go get -u ...)
OS: Arch Linux
core/ncurses 5.9-3
multilib/lib32-ncurses 5.9-1 (I use a 64 bit system)
Please provide any additional information below.
If you press the "r" key, then the message appears as intended. (It only
appears garbled the first time.)
If I remove the code for the goroutine for checking of new keyboard input, then
everything works fine. (go poll_keyboard())
I've just noticed the ncurses version doesn't match the version of the 32-bit
compatibility library... Might this have something to do with it?
Original issue reported on code.google.com by [email protected]
on 2 Feb 2013 at 12:15
Attachments:
I'm trying to use the go get command but I'm getting the following error:
go get github.com/rthornton128/goncurses
go build github.com/rthornton128/goncurses: invalid flag in pkg-config --libs: -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
OS: Arch linux
ncurses: ncurses-6.2-1
go version
go version go1.15.6 linux/amd64
This go code doesn't receive KEY_RESIZE, when I resize the terminal window.
package main
import (
gc "github.com/rthornton128/goncurses"
)
func main() {
stdscr, _ := gc.Init()
defer gc.End()
gc.Echo(false)
for {
y, x := stdscr.MaxYX()
stdscr.Printf("x=%d, y=%d\n", x, y)
ch := stdscr.GetChar()
switch ch {
case gc.KEY_RESIZE:
stdscr.Println("KEY_RESIZE")
case 'q':
return
}
}
}
Here is the other version that can get KEY_RESIZE which is written in C.
#include <curses.h>
#include <string.h>
int main()
{
WINDOW *win = initscr();
int key;
while (1) {
key = wgetch(win);
if (key == 27) {
break;
} else if (key == KEY_RESIZE) {
clear();
mvprintw(0, 0, "COLS = %d, LINES = %d", COLS, LINES);
for (int i = 0; i < COLS; i++)
mvaddch(1, i, '*');
refresh();
}
}
endwin();
return 0;
}
Hey, how should I use SetBackground? I tried SetBackground with a color pair,
it expects a char, even when I cast it doesn't set the background color of the
window. I am able to use Color Pairs everywhere else
Original issue reported on code.google.com by [email protected]
on 16 Oct 2013 at 1:39
Not sure if the title is clear, here's my situation:
machine 1 -> Arch linux with libncurse6
machine 2 -> Ubuntu with libncurse5
I do my development on the Arch machine but run my application on my Ubuntu machine, the problem is that if i build it on the arch machine it can't run on the Ubuntu machine because it's looking for libncursesw.so.6.
If i compile on my ubuntu machine from the source then it's ok.
Is there a way to change this so that it only requires libncurses of which ever version is available on the client system ?
What steps will reproduce the problem?
1. sudo port install ncurses (ncurses @5.9_2)
2. go get code.google.com/p/goncurses
What is the expected output? What do you see instead?
The expectation is installation. Instead I get the following panic:
# code.google.com/p/goncurses
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x15672]
goroutine 16 [running]:
runtime.panic(0x1dae60, 0x31b9e4)
/usr/local/go/src/pkg/runtime/panic.c:279 +0xf5
main.(*typeConv).Type(0x208466420, 0x2208384a00, 0x2084dbf20, 0xb3c4, 0x1)
/usr/local/go/src/cmd/cgo/gcc.go:1288 +0x1632
main.(*typeConv).Type(0x208466420, 0x2208384908, 0x2084dbe30, 0xb3c4, 0x4)
/usr/local/go/src/cmd/cgo/gcc.go:1189 +0x3dd6
main.(*typeConv).Struct(0x208466420, 0x2085c1e60, 0xb3c4, 0x6, 0x0, 0x0, 0x8)
/usr/local/go/src/cmd/cgo/gcc.go:1551 +0x70b
main.(*typeConv).Type(0x208466420, 0x220838a070, 0x2085c1e60, 0xb3c4,
0x2084ddac0)
/usr/local/go/src/cmd/cgo/gcc.go:1234 +0x3038
main.(*typeConv).Type(0x208466420, 0x2208384a00, 0x2084da690, 0xb3c4, 0x26d401)
/usr/local/go/src/cmd/cgo/gcc.go:1269 +0x1301
main.(*typeConv).Type(0x208466420, 0x2208384908, 0x2084da390, 0xb3c4, 0x4)
/usr/local/go/src/cmd/cgo/gcc.go:1189 +0x3dd6
main.(*typeConv).Struct(0x208466420, 0x2085c1c80, 0xb3c4, 0x6, 0x0, 0x0, 0x4)
/usr/local/go/src/cmd/cgo/gcc.go:1551 +0x70b
main.(*typeConv).Type(0x208466420, 0x220838a070, 0x2085c1c80, 0xb3c4, 0x1)
/usr/local/go/src/cmd/cgo/gcc.go:1234 +0x3038
main.(*typeConv).Type(0x208466420, 0x2208384908, 0x2084fd980, 0xb3c4, 0x0)
/usr/local/go/src/cmd/cgo/gcc.go:1189 +0x3dd6
main.(*typeConv).Struct(0x208466420, 0x2085c1b00, 0xb3c4, 0x6, 0x0, 0x0, 0x8)
/usr/local/go/src/cmd/cgo/gcc.go:1551 +0x70b
main.(*typeConv).Type(0x208466420, 0x220838a070, 0x2085c1b00, 0xb3c4,
0x2084dd840)
/usr/local/go/src/cmd/cgo/gcc.go:1234 +0x3038
main.(*typeConv).Type(0x208466420, 0x2208384a00, 0x2084fce70, 0xb3c4, 0x1)
/usr/local/go/src/cmd/cgo/gcc.go:1269 +0x1301
main.(*typeConv).Type(0x208466420, 0x2208384908, 0x2084fce10, 0xb3c4, 0x4)
/usr/local/go/src/cmd/cgo/gcc.go:1189 +0x3dd6
main.(*typeConv).FuncArg(0x208466420, 0x2208384908, 0x2084fce10, 0xb3c4, 0x1)
/usr/local/go/src/cmd/cgo/gcc.go:1405 +0x59
main.(*typeConv).FuncType(0x208466420, 0x20852ab40, 0xb3c4, 0x20852ab40)
/usr/local/go/src/cmd/cgo/gcc.go:1458 +0x534
main.(*Package).loadDWARF(0x20836f1e0, 0x208439500, 0x208516c00, 0x42, 0x80)
/usr/local/go/src/cmd/cgo/gcc.go:539 +0x1462
main.(*Package).Translate(0x20836f1e0, 0x208439500)
/usr/local/go/src/cmd/cgo/gcc.go:182 +0x150
main.main()
/usr/local/go/src/cmd/cgo/main.go:259 +0xef1
goroutine 19 [finalizer wait]:
runtime.park(0x4fed0, 0x31feb8, 0x31f269)
/usr/local/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0x31feb8, 0x31f269)
/usr/local/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
/usr/local/go/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
/usr/local/go/src/pkg/runtime/proc.c:1445
What version of the product are you using? On what operating system?
Head version on OS X 10.9.3.
Please provide any additional information below.
ncurses confirmed installed and working correctly with a "Hello World" app.
$ vi ncurses.c
$ gcc -o ncurses ncurses.c -lncurses
$ ./ncurses
$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/chris/go:/Users/chris/go/src"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments
-fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"
$ go version
go version go1.3 darwin/amd64
$ go run hello.go
Hello, world
On the same machine with the same configuration, this worked in Go 1.2.
Original issue reported on code.google.com by [email protected]
on 21 Jun 2014 at 1:40
I need to run an external application. StackOverflow recommends this way [1]:
def_prog_mode() then endwin()
execute system call
and refresh() should restore it
[1] https://stackoverflow.com/questions/3258163/c-going-from-ncurses-ui-to-external-program-and-back
Is there a way to call def_prog_mode()
via goncurses
?
Steps to reproduce:
Expected results: The program doesn't segfault.
The reason this happens is because of SetFields on form.go line 211. It creates an array of CFIELD pointers and passes the CFIELD** to set_form_fields. ncurses will save this pointer internally and expect that the memory will continue to be valid. However, since this is an array allocated by go, it's under the influence of the go garbage collector. After SetFields returns, it's only a matter of time before it is garbage collected, since no go pointer exists that points to this memory.
In 0b9eb14, the README note to Windows Users trails off as incomplete saying:
Instead, Goncurses uses PDCurses which is not 100% compatible with ncurses. As a result,
The inclusion of the second part of the sentence that begins with "As a result..." would be useful!
Simple regex should suffice with go tool.
code.google.com/p/goncurses->github.com/rthornton128/goncurses
When I print goncurses.ACS_ULCORNER, it is a lower left corner character. And
when I print concourses.ACS_LLCORNER, it is an upper left corner character.
If you look at curses.h, the symbols are defined as:
#define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */
#define ACS_LLCORNER NCURSES_ACS('m') /* lower left corner */
#define ACS_URCORNER NCURSES_ACS('k') /* upper right corner */
#define ACS_LRCORNER NCURSES_ACS('j') /* lower right corner */
So the order is LR, UR, UL, LL.
But in defs_posix.go, you have the order as LR, UR, LL, UL.
Thanks!
Daniel
Original issue reported on code.google.com by [email protected]
on 6 Apr 2014 at 1:05
This is a question rather than a bug report (I hope). I'm attempting to create a program that will react to resizing virtual terminals by resizing the ncurses window. So far I've tried repeatedly reading MaxYX()
to look for changes, but that doesn't seem to change. I've also tried using Keypad(true)
and Getchar()
to detect KEY_RESIZE
events, but those don't seem to fire. Am I doing something wrong?
I've looked around for other people's solutions, and at least one project is completely re-initializing ncurses.
I know this ought to be possible because I've seen other, raw-C ncurses programs that can resize without starting from scratch. What would be ideal is another example that shows how to do this under goncurses. I'm playing around with making such an example and will send a PR if I get one working.
I'm brand new to ncurses programming. Apparently there are two constants, LINES and COLS, that allow you to determine the screen size. How do I access these using goncurses?
go build gives error stdscr not defined if I use it in a func
What steps will reproduce the problem?
1. Get a window. [stdscr, _ := goncurses.Init()]
2. Call Maxyx. [y, x := stdscr.Maxyx()]
What is the expected output? What do you see instead?
I expect the width and height of the window. I instead get the width and height
plus one. (For example, on a standard 80x24 terminal window, I would expect to
get 80 & 24 back. Instead I get 85 & 21.)
What version of the product are you using? On what operating system?
Latest from repository.
Please provide any additional information below.
I believe the issue was introduced in revision 73b8b800ab54. In window.go, you
switched from:
return int(w.win._maxy + 1), int(w.win._maxx + 1)
to:
C.ncurses_getmaxyx(w.win, &cy, &cx)
return int(cy) + 1, int(cx) + 1
Quick experimentation with my local ncurses library indicates that _maxx, _maxy
are (on an 80x24 terminal) 79 and 23, so this used to work. But evidently
getmaxyx is already doing the offset calculation--it is returning 80 and 24, so
the additional +1 is causing the error. I think this can be solved by changing
the second line to return int(cy), int(cx).
Original issue reported on code.google.com by [email protected]
on 12 Jan 2013 at 10:21
I'd like to use Esc key and set_escdelay.
Why is not Esc key implemented?
This is my branch.
https://github.com/ywkw1717/goncurses/tree/feature/add_esc_key_and_escdelay
go get github.com/rthornton128/goncurses
github.com/rthornton128/goncurses
go build github.com/rthornton128/goncurses: invalid flag in pkg-config --libs: -Wl,-O2
What steps will reproduce the problem?
1. Add call to field.Buffer(0) to code
2. Run go build
3. Read errors
What is the expected output? What do you see instead?
Expect code to compile and return contents of field. Actually see build
errors, as Field does not have a Buffer method.
What version of the product are you using? On what operating system?
85c70fa432ac+ tip, go 1.1, Ubuntu 12.04
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 20 Oct 2014 at 3:23
When I run go get github.com/rthornton128/goncurses
, I get
go build github.com/rthornton128/goncurses: invalid flag in pkg-config --libs: -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
I'm on Arch Linux.
What steps will reproduce the problem?
1.Checkout the repo
2.run the examples menu
What is the expected output? What do you see instead?
Error:
./menu.go:33: cannot use err (type error) as type string in function argument:
need type assertion
What version of the product are you using? On what operating system?
go version go1.0.2
Linux 3.5.0-19-generic #30-Ubuntu
How to fix this:
Change line 33 with:
stdscr.Print(err.Error())
Original issue reported on code.google.com by [email protected]
on 14 Jan 2013 at 10:02
This is a pretty nifty project. Any thought about converting over to using static linking instead of a shared library to ease installation?
What steps will reproduce the problem?
1.go get code.google.com/p/goncurses
What do you see instead?
# code.google.com/p/goncurses
error: 'has_mouse' undeclared (first use in this function)
error: (Each undeclared identifier is reported only once
What version of the product are you using? On what operating system?
go version weekly.2012-03-27 +d13076ae2f82
Mac OSX 10.7.4
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 19 Jun 2012 at 3:10
Example:
package main
import (
"github.com/rthornton128/goncurses"
"log"
"time"
)
func main() {
stdscr, err1 := goncurses.Init()
if err1 != nil {
log.Fatal("init:", err1)
}
defer goncurses.End()
err2 := goncurses.StartColor()
if err2 != nil {
log.Fatal("StartColor", err2)
}
/* Box Drawing unicode example */
stdscr.Print("┌─ Title ──────────────────────┐")
stdscr.Print("│ │")
stdscr.Print("└──────────────────────────────┘")
stdscr.Refresh()
time.Sleep(1 * time.Minute)
}
Result:
What steps will reproduce the problem?
1.go get code.google.com/p/goncurses
What is the expected output? What do you see instead?
I expected the package to install correctly.
I got:
# code.google.com/p/goncurses
go/src/code.google.com/p/goncurses/window.go:24: cannot use
_Cfunc_newwin(C.int(h), C.int(w), C.int(y), C.int(x)) (type *C.WINDOW) as type
*C.struct__win_st in field value
go/src/code.google.com/p/goncurses/window.go:34: cannot use w.win (type
*C.struct__win_st) as type *C.WINDOW in argument to _Cfunc_waddch
go/src/code.google.com/p/goncurses/window.go:40: cannot use w.win (type
*C.struct__win_st) as type *C.WINDOW in argument to _Cfunc_mvwaddch
...
go/src/code.google.com/p/goncurses/window.go:95: too many errors
What version of the product are you using? On what operating system?
I am using go 1.3. On linux with ncurses 5.9.
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 20 Jun 2014 at 1:07
When I try to go get the library I'm given the following error. Does this mean that there are system calls being made in the library that are not supported on ARM?
# github.com/rthornton128/goncurses
Undefined symbols for architecture arm64:
"_current_item", referenced from:
__cgo_a651d9278453_Cfunc_current_item in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_current_item, __cgo_a651d9278453_Cfunc_current_item )
"_free_item", referenced from:
__cgo_a651d9278453_Cfunc_free_item in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_free_item)
"_free_menu", referenced from:
__cgo_a651d9278453_Cfunc_free_menu in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_free_menu)
"_item_count", referenced from:
__cgo_a651d9278453_Cfunc_item_count in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_item_count)
"_item_description", referenced from:
__cgo_a651d9278453_Cfunc_item_description in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_item_description)
"_item_index", referenced from:
__cgo_a651d9278453_Cfunc_item_index in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_item_index)
"_item_name", referenced from:
__cgo_a651d9278453_Cfunc_item_name in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_item_name)
"_item_opts_off", referenced from:
__cgo_a651d9278453_Cfunc_item_opts_off in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_item_opts_off)
"_item_opts_on", referenced from:
__cgo_a651d9278453_Cfunc_item_opts_on in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_item_opts_on)
"_item_value", referenced from:
__cgo_a651d9278453_Cfunc_item_value in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_item_value, __cgo_a651d9278453_Cfunc_item_value )
"_item_visible", referenced from:
__cgo_a651d9278453_Cfunc_item_visible in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_item_visible)
"_menu_back", referenced from:
__cgo_a651d9278453_Cfunc_menu_back in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_back, __cgo_a651d9278453_Cfunc_menu_back )
"_menu_driver", referenced from:
__cgo_a651d9278453_Cfunc_menu_driver in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_menu_driver)
"_menu_fore", referenced from:
__cgo_a651d9278453_Cfunc_menu_fore in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_fore, __cgo_a651d9278453_Cfunc_menu_fore )
"_menu_items", referenced from:
__cgo_a651d9278453_Cfunc_menu_items in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_items, __cgo_a651d9278453_Cfunc_menu_items )
"_menu_opts_off", referenced from:
__cgo_a651d9278453_Cfunc_menu_opts_off in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_menu_opts_off)
"_menu_opts_on", referenced from:
__cgo_a651d9278453_Cfunc_menu_opts_on in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_menu_opts_on)
"_menu_pad", referenced from:
__cgo_a651d9278453_Cfunc_menu_pad in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_pad, __cgo_a651d9278453_Cfunc_menu_pad )
"_menu_pattern", referenced from:
__cgo_a651d9278453_Cfunc_menu_pattern in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_pattern, __cgo_a651d9278453_Cfunc_menu_pattern )
"_menu_request_by_name", referenced from:
__cgo_a651d9278453_Cfunc_menu_request_by_name in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_menu_request_by_name)
"_menu_request_name", referenced from:
__cgo_a651d9278453_C2func_menu_request_name in _x006.o
__cgo_a651d9278453_Cfunc_menu_request_name in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_menu_request_name, __cgo_a651d9278453_C2func_menu_request_name )
"_menu_spacing", referenced from:
__cgo_a651d9278453_Cfunc_menu_spacing in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_spacing, __cgo_a651d9278453_Cfunc_menu_spacing )
"_menu_win", referenced from:
__cgo_a651d9278453_Cfunc_menu_win in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_menu_win, __cgo_a651d9278453_Cfunc_set_menu_win )
"_new_item", referenced from:
__cgo_a651d9278453_C2func_new_item in _x006.o
__cgo_a651d9278453_Cfunc_new_item in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_new_item, __cgo_a651d9278453_C2func_new_item )
"_new_menu", referenced from:
__cgo_a651d9278453_C2func_new_menu in _x006.o
__cgo_a651d9278453_Cfunc_new_menu in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_new_menu, __cgo_a651d9278453_C2func_new_menu )
"_pos_menu_cursor", referenced from:
__cgo_a651d9278453_Cfunc_pos_menu_cursor in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_pos_menu_cursor)
"_post_menu", referenced from:
__cgo_a651d9278453_Cfunc_post_menu in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_post_menu)
"_scale_menu", referenced from:
__cgo_a651d9278453_Cfunc_scale_menu in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_scale_menu)
"_set_current_item", referenced from:
__cgo_a651d9278453_Cfunc_set_current_item in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_current_item)
"_set_item_value", referenced from:
__cgo_a651d9278453_Cfunc_set_item_value in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_item_value)
"_set_menu_back", referenced from:
__cgo_a651d9278453_Cfunc_set_menu_back in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_back)
"_set_menu_fore", referenced from:
__cgo_a651d9278453_Cfunc_set_menu_fore in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_fore)
"_set_menu_format", referenced from:
__cgo_a651d9278453_Cfunc_set_menu_format in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_format)
"_set_menu_grey", referenced from:
__cgo_a651d9278453_Cfunc_set_menu_grey in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_grey)
"_set_menu_items", referenced from:
__cgo_a651d9278453_Cfunc_set_menu_items in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_items)
"_set_menu_mark", referenced from:
__cgo_a651d9278453_Cfunc_set_menu_mark in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_mark)
"_set_menu_pad", referenced from:
__cgo_a651d9278453_Cfunc_set_menu_pad in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_pad)
"_set_menu_pattern", referenced from:
__cgo_a651d9278453_Cfunc_set_menu_pattern in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_pattern)
"_set_menu_spacing", referenced from:
__cgo_a651d9278453_Cfunc_set_menu_spacing in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_spacing)
"_set_menu_sub", referenced from:
__cgo_a651d9278453_Cfunc_set_menu_sub in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_sub)
"_set_menu_win", referenced from:
__cgo_a651d9278453_Cfunc_set_menu_win in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_set_menu_win)
"_unpost_menu", referenced from:
__cgo_a651d9278453_Cfunc_unpost_menu in _x006.o
(maybe you meant: __cgo_a651d9278453_Cfunc_unpost_menu)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
$ go version
go version devel +ab5aaf4b34f2 Tue Jan 29 14:57:11 2013 +0400 darwin/amd64
I have installed ncurses-5.9, with --prefix=/usr/local/lib. I got the head
goncurses, and modified form_posix.go, menu_posix.go, ncurses.go and
panel_posix.go to have
#cgo LDFLAGS: -L/usr/local/lib -lncurses
to force it to use the new library (I couldn't get "go install" to do the right
thing).
I have got a C ncurses hello world to work fine. I cannot get a Go hello world
program (at the bottom of this report) to even build. It fails with
$ go run test.go
# command-line-arguments
.dynsym: COLOR_PAIRS(0): not defined
-----
package main
import (
"log"
"code.google.com/p/goncurses"
)
func main() {
w, err := goncurses.Init()
if err != nil {
log.Fatalf("goncurses.Init: %v", err)
}
defer goncurses.End()
w.Print("Hello World! Press any key to quit.")
w.Refresh()
w.GetChar()
}
-----
Original issue reported on code.google.com by [email protected]
on 8 Feb 2013 at 2:16
$ go get -v code.google.com/p/goncurses
code.google.com/p/goncurses
Package form was not found in the pkg-config search path.
Perhaps you should add the directory containing form.pc' to the PKG_CONFIG_PATH environment variable No package 'form' found Package menu was not found in the pkg-config search path. Perhaps you should add the directory containing
menu.pc'
to the PKG_CONFIG_PATH environment variable
No package 'menu' found
Package ncurses was not found in the pkg-config search path.
Perhaps you should add the directory containing ncurses.pc' to the PKG_CONFIG_PATH environment variable No package 'ncurses' found Package panel was not found in the pkg-config search path. Perhaps you should add the directory containing
panel.pc'
to the PKG_CONFIG_PATH environment variable
No package 'panel' found
exit status 1
Original issue reported on code.google.com by [email protected]
on 10 Jun 2013 at 9:41
Hi,
I've read that ncurses is thread safe, or atleast has thread safe capabilities, by version 5.7. Is that already included/used in goncurses or is there maybe any way to determine that or switch it on? Reason I'm asking is that i face some visual noise in my application which I relate to a concurrency problem and I'd like to get this some how fixed.
Best,
Henning
I have a goroutine that just waits for the terminal to be resized, and then show the size of the new terminal. However, while SIGWINCH does get triggered, the size from GetMaxYX() never changes. Here is the application:
package main
import (
"os"
"os/signal"
"strconv"
"sync"
"syscall"
g "github.com/rthornton128/goncurses"
)
var wg sync.WaitGroup
func main() {
wg.Add(1)
resizeChannel := make(chan os.Signal)
signal.Notify(resizeChannel, syscall.SIGWINCH)
go onResize(resizeChannel)
wg.Wait()
}
func onResize(channel chan os.Signal) {
stdScr, _ := g.Init()
stdScr.ScrollOk(true)
g.NewLines(true)
for {
<-channel
g.StdScr().Clear()
y, x := g.StdScr().MaxYX()
g.StdScr().Println(strconv.Itoa(x) + ", " + strconv.Itoa(y))
g.StdScr().Refresh()
}
wg.Done()
}
Hey - wondering if I am missing how to call use_default_colors per
http://linux.die.net/man/3/use_default_colors
This seems to work:
func UseDefaultColors() {
C.use_default_colors()
}
Thanks!
Original issue reported on code.google.com by [email protected]
on 15 Oct 2013 at 4:12
I have this error:
# pkg-config --cflags ncurses form menu ncurses ncurses panel
Package ncurses was not found in the pkg-config search path.
Perhaps you should add the directory containing `ncurses.pc'
to the PKG_CONFIG_PATH environment variable
No package 'ncurses' found
Package form was not found in the pkg-config search path.
Perhaps you should add the directory containing `form.pc'
to the PKG_CONFIG_PATH environment variable
No package 'form' found
Package menu was not found in the pkg-config search path.
Perhaps you should add the directory containing `menu.pc'
to the PKG_CONFIG_PATH environment variable
No package 'menu' found
Package ncurses was not found in the pkg-config search path.
Perhaps you should add the directory containing `ncurses.pc'
to the PKG_CONFIG_PATH environment variable
No package 'ncurses' found
Package ncurses was not found in the pkg-config search path.
Perhaps you should add the directory containing `ncurses.pc'
to the PKG_CONFIG_PATH environment variable
No package 'ncurses' found
Package panel was not found in the pkg-config search path.
Perhaps you should add the directory containing `panel.pc'
to the PKG_CONFIG_PATH environment variable
No package 'panel' found
pkg-config: exit status 1
I installed ncurses
via brew install ncurses
.
Do you have a solution?
What steps will reproduce the problem?
1.someWin.HLine(2, 1, gc.ACS_HLINE, x-3) // Compiles
2.someWin.VLine(1, 2, gc.ACS_VLINE, y-3) // Doesn't.
3.
What is the expected output? What do you see instead?
I expected those two to both compile, or neither of them to compile.
What version of the product are you using? On what operating system?
go1.0.3
latest source from goncurses
Please provide any additional information below.
Window.go:
func (w *Window) HLine(y, x int, ch Character, wid int)
func (w *Window) VLine(y, x, ch, h int)
defs.go:
type Character int
I believe the proper solution for this is to set VLine to use Character instead
of int. The defined characters (e.g. ACS_VLINE) are defined as type Character.
Original issue reported on code.google.com by [email protected]
on 29 May 2013 at 5:11
If there is content in the window that exceeds the height of the window, how to set the mouse to scroll to the content that exceeds the window? I tried to set scrollok, but it had no effect
Please consider re-licensing your library to MIT or BSD, even if LGPL is fine
for most open source projects, it is of very limited use in the Go world.
Generally, static linking (Go currently doesn't have dynamic linking) to
LGPL-licensed code isn't possible w/o releasing your code. Some projects (like
OGRE) add exception clauses but this all makes stuff complicated. If it's
mostly for the fame, use BSD or MIT and be fine ;-)
Original issue reported on code.google.com by [email protected]
on 16 Oct 2011 at 2:19
What steps will reproduce the problem?
1. Within my local Go workspace, ~/mygo/src, I do a "go get
code.google.com/p/goncurses
2. I watch as the install process generates many errors
3.
What is the expected output? What do you see instead?
When installing Go packages, there is typically no output.
I am seeing the following:
code.google.com/p/goncurses/form.go:30: cannot assign *C.FIELD to
new_field.field (type *C.struct_fieldnode) in multiple assignment
code.google.com/p/goncurses/form.go:44: cannot use f.field (type
*C.struct_fieldnode) as type *C.FIELD in argument to _C2func_dup_field
code.google.com/p/goncurses/form.go:44: cannot assign *C.FIELD to
new_field.field (type *C.struct_fieldnode) in multiple assignment
code.google.com/p/goncurses/form.go:56: cannot use f.field (type
*C.struct_fieldnode) as type *C.FIELD in argument to _Cfunc_free_field
code.google.com/p/goncurses/form.go:79: cannot use f.field (type
*C.struct_fieldnode) as type *C.FIELD in argument to _Cfunc_move_field
code.google.com/p/goncurses/form.go:86: cannot use f.field (type
*C.struct_fieldnode) as type *C.FIELD in argument to _Cfunc_field_opts_on
code.google.com/p/goncurses/form.go:89: cannot use f.field (type
*C.struct_fieldnode) as type *C.FIELD in argument to _Cfunc_field_opts_off
code.google.com/p/goncurses/form.go:99: cannot use f.field (type
*C.struct_fieldnode) as type *C.FIELD in argument to _Cfunc_set_field_just
code.google.com/p/goncurses/form.go:105: cannot use f.field (type
*C.struct_fieldnode) as type *C.FIELD in argument to _Cfunc_field_opts_off
code.google.com/p/goncurses/form.go:114: cannot use f.field (type
*C.struct_fieldnode) as type *C.FIELD in argument to _Cfunc_field_opts_on
code.google.com/p/goncurses/form.go:114: too many errors
What version of the product are you using? On what operating system?
go get code.google.com/p/goncurses
I am using go version go1.3 linux/amd64, and presumably the latest version of
Goncurses.
Please provide any additional information below.
Platform is x86-64 Manjaro Linux.
Original issue reported on code.google.com by [email protected]
on 29 Jul 2014 at 3:19
I was getting invalid flag in pkg-config --libs: -Wl,--push-state,--as-needed
, and that was fixed with export CGO_CFLAGS_ALLOW=".*" && export CGO_LDFLAGS_ALLOW=".*"
. But now I'm getting this when running go build
:
# github.com/rthornton128/goncurses
goncurses.c: In function ‘goncurses_set_escdelay’:
goncurses.c:96:12: error: lvalue required as left operand of assignment
96 | ESCDELAY = size;
| ^
I'm on openSUSE (Tumbleweed), go1.20.2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.