2008 Июн 05 19 14 45 darkk what is the reason to have bind-ings hell i

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
2008 Июн 05 19:14:45 <darkk^> what is the reason to have /bind-ings hell? isn't there some possibility to map F11 as F11 and not as meta2-23$ (urxvt), 23~ (xterm) and 23~ (terminal) 23~ (vte) ?
2008 Июн 05 19:14:55 <darkk^> what is the source of this madness?
2008 Июн 05 19:52:35 <FlashCode> darkk^: you mean in weechat or in terminal ?
2008 Июн 05 19:53:39 <darkk^> I don't know. weechat has "/key" to workaround terminal issues, but is there some library to solve this issue?
2008 Июн 05 19:54:00 <FlashCode> not sure there's some help by a library..
2008 Июн 05 19:54:09 <darkk^> it annoys a bit to recreate bindings when switching to another terminal...
2008 Июн 05 19:55:15 <FlashCode> yes, I know this problem
2008 Июн 05 19:55:43 <darkk^> don't you know, what is the root of the problem ? :)
2008 Июн 05 19:56:06 <FlashCode> I looked at irssi code some months ago, they're binding many codes on one key
2008 Июн 05 19:56:18 <FlashCode> not very clean, but it works I think
2008 Июн 05 19:57:28 <FlashCode> I don't know how to find (and be sure) that meta-code1 and meta-code2 codes are in fact same key
2008 Июн 05 19:57:31 <darkk^> well, the question is - why do different terminals send different codes for same keys?.. I can't understand that.
2008 Июн 05 20:00:52 <darkk^> I asked here as weechat is the first app I know, that tries to solve this issue at least :)
2008 Июн 05 21:50:27 <divVerent> FlashCode: why does weechat need that handling anyway?
2008 Июн 05 21:50:32 <divVerent> doesn't curses provide that?
2008 Июн 05 21:53:49 <FlashCode> I don't think so
2008 Июн 05 21:54:10 <divVerent> The keypad option enables the keypad of the user's terminal. If enabled (bf is TRUE), the user can
2008 Июн 05 21:54:12 <divVerent> press a function key (such as an arrow key) and wgetch returns a single value representing the function
2008 Июн 05 21:54:14 <divVerent> key, as in KEY_LEFT. If disabled (bf is FALSE), curses does not treat function keys specially and the
2008 Июн 05 21:54:16 <divVerent> program has to interpret the escape sequences itself.
2008 Июн 05 21:54:24 <divVerent> int keypad(WINDOW *win, bool bf);
2008 Июн 05 21:54:57 <FlashCode> I'm not using (w)getch to read keyboard input
2008 Июн 05 21:55:00 <divVerent> what else?
2008 Июн 05 21:55:04 <divVerent> and why?
2008 Июн 05 21:55:17 <FlashCode> because I'm using flood detection
2008 Июн 05 21:55:29 <divVerent> you can't do that using wgetch?
2008 Июн 05 21:55:46 <divVerent> you sure can...
2008 Июн 05 21:56:06 <FlashCode> I was using getch before, and I removed it when I added anti flood
2008 Июн 05 21:56:19 <divVerent> well, you probably can do antiflood with getch too
2008 Июн 05 21:56:32 <divVerent> but I once had a curses issue with getch... I wonder how you managed to not have that problem
2008 Июн 05 21:56:40 <divVerent> I wanted to simultaneously wait for input and socket data
2008 Июн 05 21:56:43 <divVerent> how to do that?
2008 Июн 05 21:56:49 <divVerent> I ended up running select() on stdin and the socket...
2008 Июн 05 21:56:57 <divVerent> but using stdin is not exactly good when using curses
2008 Июн 05 21:57:10 <divVerent> ESPECIALLY in keypad(..., 1) mode
2008 Июн 05 21:57:26 <divVerent> like, if just ESC[ is in the buffer, and the rest still to come
2008 Июн 05 21:57:40 <divVerent> then select would say there is data, but getch not return a key but block till the sequence is complete or a timeout
2008 Июн 05 21:59:11 <FlashCode> divVerent: when using getch you can use select on fd too
2008 Июн 05 21:59:30 <FlashCode> in keypad mode I don't know
2008 Июн 05 22:00:19 <FlashCode> and getch is not always blocking, you can tell ncurses to not block
2008 Июн 05 22:00:34 <FlashCode> by calling another function before (I don't remember the name)
2008 Июн 05 22:03:48 <divVerent> FlashCode: using select on the fd is not safe, IIRC
2008 Июн 05 22:03:53 <divVerent> when a partial keycode is there