Re: [dev] [surf] Disable javascript

2012-11-15 Thread Julian Dammann
 I read them, but I suppose I don't remember them...

No.
Not to sound too rude, but this is not the problem here...

Welcome to How to answer almost all your questions about any software without 
wasting other people's time:

1.  Is there a manual? If no goto 2 else 1a
1a. Have you read it? If no read it; goto 1c
1b. Do you remember all of it? If no read/search it; goto 1c
1c. Is the answer to your question in the manual? If no goto 2; else done

2.  Google it. 5min time investment minimum. goto 2a
2a. Found a solution? If no goto 3; else done

3.  You may now start involving other people. Good luck.


Some futher observations: Both 1 and 2 would have solved your problem.
The man page includes information about '-s', and google's first answer to 
suckless surf disable java script is the man page as well, highlighting '-s'.

The reason why I wrote this: instead of taking 5 min of your own time, you just 
went ahead and posted a trivial question to a mailing list of many people (how 
many?), thus wasting, even if only 1 min, of everyone's time.
This is not only rude to others, but this also adds up to a lot more time 
wasted than you would have on your own.

Sorry for wasting the time of those people who follow this algorithm, maybe 
it will save some time in the future though (I don't have much hope for that :( 
)



Re: [dev] [surf] Disable javascript

2012-11-15 Thread 7heo

On 11/15/2012 10:40 AM, Julian Dammann wrote:

I read them, but I suppose I don't remember them...

No.
Not to sound too rude, but this is not the problem here...

Welcome to How to answer almost all your questions about any software without 
wasting other people's time:

1.  Is there a manual? If no goto 2 else 1a
1a. Have you read it? If no read it; goto 1c
1b. Do you remember all of it? If no read/search it; goto 1c
1c. Is the answer to your question in the manual? If no goto 2; else done

2.  Google it. 5min time investment minimum. goto 2a
2a. Found a solution? If no goto 3; else done

3.  You may now start involving other people. Good luck.


Some futher observations: Both 1 and 2 would have solved your problem.
The man page includes information about '-s', and google's first answer to suckless 
surf disable java script is the man page as well, highlighting '-s'.

The reason why I wrote this: instead of taking 5 min of your own time, you just 
went ahead and posted a trivial question to a mailing list of many people (how 
many?), thus wasting, even if only 1 min, of everyone's time.
This is not only rude to others, but this also adds up to a lot more time 
wasted than you would have on your own.

Sorry for wasting the time of those people who follow this algorithm, maybe 
it will save some time in the future though (I don't have much hope for that :( )

While we're talking about the man page [1], it could use a little 
refreshment, as it's not very up to date. Even if the answer to this 
problem is there; I was searching for a way to zoom with surf, and I 
have not found it in the online man.


[1] http://man.suckless.org/surf



Re: [dev] [surf] Disable javascript

2012-11-15 Thread Thuban
Well, you don't know what I did, so don't judge too fast.
I alsa used for a while a kind of noscript in .surf/script.js.

I did read the manual, a long time ago, bit I did. And I'm sure such
mistakes can happen to anyone.

Le 10:40:08 le 15 nov. 2012 , Julian Dammann a écrit :
  I read them, but I suppose I don't remember them...
 
 No.
 Not to sound too rude, but this is not the problem here...
 
 Welcome to How to answer almost all your questions about any software 
 without wasting other people's time:
 
 1.  Is there a manual? If no goto 2 else 1a
 1a. Have you read it? If no read it; goto 1c
 1b. Do you remember all of it? If no read/search it; goto 1c
 1c. Is the answer to your question in the manual? If no goto 2; else done
 
 2.  Google it. 5min time investment minimum. goto 2a
 2a. Found a solution? If no goto 3; else done
 
 3.  You may now start involving other people. Good luck.
 
 
 Some futher observations: Both 1 and 2 would have solved your problem.
 The man page includes information about '-s', and google's first answer to 
 suckless surf disable java script is the man page as well, highlighting 
 '-s'.
 
 The reason why I wrote this: instead of taking 5 min of your own time, you 
 just went ahead and posted a trivial question to a mailing list of many 
 people (how many?), thus wasting, even if only 1 min, of everyone's time.
 This is not only rude to others, but this also adds up to a lot more time 
 wasted than you would have on your own.
 
 Sorry for wasting the time of those people who follow this algorithm, maybe 
 it will save some time in the future though (I don't have much hope for that 
 :( )
 

-- 
 ,--.   Xavier Cartron   ,   /(
: /` )  M2 MEFPCo **}=\\,\(,,  
| `-'   Debian user0--(___(_\\
 \_ jabber : thu...@jabber.fr  / ,)   ,/ ``==



Re: [dev] [surf] Disable javascript

2012-11-15 Thread Nick
Quoth Thuban:
 I alsa used for a while a kind of noscript in .surf/script.js.

Care to share the details? I'd like to be able to disable javascript 
on a per site basis, but have never got around to doing that. Adding 
proper support in surf rather than just script.js would probably be 
better, but I'd be interested to hear what you hacked together.



Re: [dev] [surf] Disable javascript

2012-11-15 Thread Julian Dammann
 Well, you don't know what I did, so don't judge too fast.

I'm stating facts, take away any judgement you feel entitled to.
Fact is: your question was trivial; the answer to your question *was* one man 
surf or web search away.

 I did read the manual, a long time ago, bit I did. And I'm sure such
 mistakes can happen to anyone.

Yes, I have read many man pages, too, and i too am sure that almost anyone 
forgets this stuff eventually.
I'm just saying, instead of making these mistakes you should take a moment to 
consider re-reading man or doing the research yourself, before bothering 
other people.

Also stop making excuses - you asked a trivial question (nothing more, nothing 
*bad* happened - no need for excuses really).
Maybe next time you can avoid making this mistake.

Have a nice day



Re: [dev] [surf] Disable javascript

2012-11-15 Thread Julian Dammann
On 2012/11/15 - 09:49:04 +, Raphael Proust wrote:
 On Thu, Nov 15, 2012 at 9:40 AM, Julian Dammann damma...@googlemail.com 
 wrote:
  I read them, but I suppose I don't remember them...
 
  No.
  Not to sound too rude, but this is not the problem here...
 
 The problem is surf has no GUI with drop-down menus and stuff… If it
 had, then everyone would refer to http://xkcd.com/627/ and the list
 would be more silent.

Yes, everyone refers to this - as we all know ;D
And now I'm off to my student job as support monkey. Have you tried turning it 
off and on again?



Re: [dev] [surf] Disable javascript

2012-11-15 Thread skls
Nick suckless-...@njw.me.uk wrote:

 (...) I'd like to be able to disable javascript 
 on a per site basis, but have never got around to doing that. 
 (...)

Hello,

Sorry, not related to the per site basis :

The handiest way to deal with javascript on surf at the moment
is IMO the toggle patch you put on the wiki,
being able to toggle on the fly is very convenient.

As a side note, I wonder how difficult would it be to create
a generic toggle function for surf which could be called with
any WebKitWebSettings boolean parameter in config.h such as
auto-load-images, enable-scripts and so on ...

It is out of my reach because I don't c
but maybe some more knowledgeable user has a clue about it.
Furthermore, it could save surf a few command line switches,
but I guess that if they're here at the moment
it's because someone use them ...

--

Julien





Re: [dev] [surf] Disable javascript

2012-11-15 Thread Christoph Lohmann
Greetings.

On Thu, 15 Nov 2012 14:11:09 +0100 Raphael Proust raphla...@gmail.com wrote:
 On Thu, Nov 15, 2012 at 9:40 AM, Julian Dammann damma...@googlemail.com 
 wrote:
  I read them, but I suppose I don't remember them...
 
  No.
  Not to sound too rude, but this is not the problem here...
 
 The problem is surf has no GUI with drop-down menus and stuff… If it
 had, then everyone would refer to http://xkcd.com/627/ and the list
 would be more silent.

This bugreport has been marked as:

WONTFIX

Reason: GUI is unrelated to suckless.


Sincerely,

Christoph




Re: [dev] [surf] Disable javascript

2012-11-15 Thread stanio

* s...@alternametz.org [2012-11-15 12:56]:
 As a side note, I wonder how difficult would it be to create
 a generic toggle function for surf which could be called with
 any WebKitWebSettings boolean parameter in config.h such as
 auto-load-images, enable-scripts and so on ...

look for 20120602113939.GA26438 in your mailbox or 
http://permalink.gmane.org/gmane.comp.misc.suckless/9458

--s_



Re: [dev] [surf] Disable javascript

2012-11-15 Thread stanio
* sta...@cs.tu-berlin.de [2012-11-15 14:34]:
 * s...@alternametz.org [2012-11-15 12:56]:
  As a side note, I wonder how difficult would it be to create
  a generic toggle function for surf which could be called with
 
 look for 20120602113939.GA26438 in your mailbox or 
 http://permalink.gmane.org/gmane.comp.misc.suckless/9458

If you use that you might be interested in the following to keep track
of the status. 
http://permalink.gmane.org/gmane.comp.misc.suckless/9461

--s_



Re: [dev] [st] Fix the tab key

2012-11-15 Thread Roberto E. Vargas Caballero

Hello,

A new serie of patches that fix some problems detected in last serie:

- Tab problems
- Return problems in not newline modes
- arrow problems

Please, if you find some new errors (I am pretty sure something can happen)
notice me. This new series apply over the actual mercurial tip.

Best regards.
From 931003d3252ab1a0c97b762ae29c5f939db1de44 Mon Sep 17 00:00:00 2001
From: Roberto E. Vargas Caballero k...@shike2.com
Date: Wed, 14 Nov 2012 11:00:08 +0100
Subject: Fix tab key

When Shift + Tab is pressed X server send the event XK_ISO_Left_Tab with
ShiftMask, so this is the entry we need in config.def.h

This patch also revert the previous patch for this issue because it breaks
the keyboard.
---
 config.def.h |2 +-
 st.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/config.def.h b/config.def.h
index 5d887fc..972285b 100644
--- a/config.def.h
+++ b/config.def.h
@@ -141,7 +141,7 @@ static Key key[] = {
 	{ XK_Right, ShiftMask,  \033[1;2C, 0,0,0},
 	{ XK_Right, ControlMask,\033[1;5C, 0,0,0},
 	{ XK_Right, Mod1Mask,   \033[1;3C, 0,0,0},
-	{ XK_Tab,   ShiftMask,  \033[Z,0,0,0},
+	{ XK_ISO_Left_Tab,  ShiftMask,  \033[Z,0,0,0},
 	{ XK_Return,XK_NO_MOD,  \n,0,0,   -1},
 	{ XK_Return,XK_NO_MOD,  \r\n,  0,0,   +1},
 	{ XK_Return,Mod1Mask,   \033\n,0,0,   -1},
diff --git a/st.c b/st.c
index ca4248a..932253c 100644
--- a/st.c
+++ b/st.c
@@ -2700,7 +2700,7 @@ kmap(KeySym k, uint state) {
 		if(kp-k != k)
 			continue;
 
-		if((state  mask) != mask ||
+		if((state  mask) != mask 
 (mask == XK_NO_MOD  state)) {
 			continue;
 		}
-- 
1.7.10.4

From b3c76defd2fc66584d221cadae3f8d85fb7fe0d5 Mon Sep 17 00:00:00 2001
From: Roberto E. Vargas Caballero k...@shike2.com
Date: Thu, 15 Nov 2012 10:59:07 +0100
Subject: Fix XK_NO_MOD and XK_ANY_MOD behavior

XK_NO_MOD match a key without modifiers and XK_ANY_MOD match a key does not
matter what modifiers are pressed to. Like they are mask the best value for
XK_ANY_MOD is all the bits to 1, so the and with any state will be equal to
the state. This also imply that is necessary check the case for XK_NO_MOD
(no modifiers at all) with some modifier in state, and the inverse
(some mask different to XK_ANY_MOD or XK_NO_MOD and no modifiers in state).
---
 st.c |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/st.c b/st.c
index 932253c..b8b2bbf 100644
--- a/st.c
+++ b/st.c
@@ -59,8 +59,8 @@
 #define STR_ARG_SIZ   16
 #define DRAW_BUF_SIZ  20*1024
 #define UTF_SIZ   4
-#define XK_NO_MOD UINT_MAX
-#define XK_ANY_MOD0
+#define XK_ANY_MODUINT_MAX
+#define XK_NO_MOD 0
 
 #define REDRAW_TIMEOUT (80*1000) /* 80 ms */
 
@@ -2700,10 +2700,12 @@ kmap(KeySym k, uint state) {
 		if(kp-k != k)
 			continue;
 
-		if((state  mask) != mask 
-(mask == XK_NO_MOD  state)) {
+		if(mask == XK_NO_MOD  state)
+			continue;
+		if(mask != XK_ANY_MOD  mask != XK_NO_MOD  !state)
+			continue;
+		if((state  mask) != state)
 			continue;
-		}
 
 		if((kp-appkey  0  IS_SET(MODE_APPKEYPAD)) ||
 (kp-appkey  0  !IS_SET(MODE_APPKEYPAD))) {
-- 
1.7.10.4

From f752242029dc32ce6ce57bec3353e7f912931856 Mon Sep 17 00:00:00 2001
From: Roberto E. Vargas Caballero k...@shike2.com
Date: Thu, 15 Nov 2012 11:09:36 +0100
Subject: Use XK_ANY_MOD instead of XK_NO_MOD in key definition

Usually terminal emulators don't generate any sequence for a combination
they don't have registered, for example Shift + Next, but st behavior
previous to the keyboard patch generates the sequence without the modifier,
in this example Next. This patch uses the XK_ANY_MOD in order to get this
same behaviour.
---
 config.def.h |  114 ++
 1 file changed, 59 insertions(+), 55 deletions(-)

diff --git a/config.def.h b/config.def.h
index 972285b..bd5a888 100644
--- a/config.def.h
+++ b/config.def.h
@@ -72,91 +72,95 @@ static unsigned int defaultucs = 257;
  * * 0: no value
  * *  0: crlf mode is enabled
  * *  0: crlf mode is disabled
+ *
+ * Be careful with the order of the definitons because st searchs in
+ * this table sequencially, so any XK_ANY_MOD must be in the last
+ * position for a key.
  */
 
 /* key, mask, output, keypad, cursor, crlf */
 static Key key[] = {
 	/* keysym mask string keypad cursor crlf */
-	{ XK_KP_Home,   XK_NO_MOD,  \033[H,0,0,0},
 	{ XK_KP_Home,   ShiftMask,  \033[1;2H, 0,0,0},
-	{ XK_KP_Up, XK_NO_MOD,  \033Ox,   +1,0,0},
-	{ XK_KP_Up, XK_NO_MOD,  \033[A,0,   -1,0},
-	{ XK_KP_Up, XK_NO_MOD,  \033OA,0,   +1,0},
-	{ XK_KP_Down,   XK_NO_MOD,  \033Or,   +1,0,0},
-	{ XK_KP_Down,   

Re: [dev] [st] Fix the tab key

2012-11-15 Thread Eckehard Berns
 Please, if you find some new errors (I am pretty sure something can happen)
 notice me.

For me Shift+Insert inserts \E[2;2~ just before the selection.

-- 
Eckehard Berns



Re: [dev] [surf] Disable javascript

2012-11-15 Thread Thuban
No problem. The method is based on a piece of code found on uzbl wiki.

Just paste this in ~/.surf/script.js (see attachement).

The first part of the code is just simple rules towhitelist some
domains. (see examples)

Have a nice day everyone!




Le 10:38:28 le 15 nov. 2012 , Nick a écrit :
 Quoth Thuban:
  I alsa used for a while a kind of noscript in .surf/script.js.
 
 Care to share the details? I'd like to be able to disable javascript 
 on a per site basis, but have never got around to doing that. Adding 
 proper support in surf rather than just script.js would probably be 
 better, but I'd be interested to hear what you hacked together.
 

-- 
 ,--.   Xavier Cartron   ,   /(
: /` )  M2 MEFPCo **}=\\,\(,,  
| `-'   Debian user0--(___(_\\
 \_ jabber : thu...@jabber.fr  / ,)   ,/ ``==


noscript.js
Description: application/javascript


[dev] [st] Add insert mode

2012-11-15 Thread Eckehard Berns
I added some code to make insert mode work in st. I don't know if I
missed something, but It's Working For Me(tm). Patch attached.

-- 
Eckehard Berns
diff -r 19ef42df8e7d st.c
--- a/st.c  Wed Nov 14 06:37:24 2012 +0100
+++ b/st.c  Thu Nov 15 15:19:52 2012 +0100
@@ -2100,6 +2100,10 @@
sel.bx = -1;
if(IS_SET(MODE_WRAP)  term.c.state  CURSOR_WRAPNEXT)
tnewline(1); /* always go to first col */
+   if(IS_SET(MODE_INSERT)  term.c.x+1  term.col)
+   memmove(term.line[term.c.y][term.c.x+1],
+   term.line[term.c.y][term.c.x],
+   (term.col - term.c.x - 1) * sizeof(Glyph));
tsetchar(c, term.c.attr, term.c.x, term.c.y);
if(term.c.x+1  term.col)
tmoveto(term.c.x+1, term.c.y);
diff -r 19ef42df8e7d st.info
--- a/st.info   Wed Nov 14 06:37:24 2012 +0100
+++ b/st.info   Thu Nov 15 15:19:52 2012 +0100
@@ -153,6 +153,7 @@
ritm=\E[23m,
rmacs=\E(B,
rmcup=\E[?1049l,
+   rmir=\E[4l,
rmkx=\E[?1l\E,
rmso=\E[23m,
rmul=\E[m,
@@ -168,6 +169,7 @@
sitm=\E[3m,
smacs=\E(0,
smcup=\E[?1049h,
+   smir=\E[4h,
smkx=\E[?1h\E=,
smso=\E[3m,
smul=\E[4m,


Re: [dev] [st] Add insert mode

2012-11-15 Thread Roberto E. Vargas Caballero
On Thu, Nov 15, 2012 at 03:25:52PM +0100, Eckehard Berns wrote:
 I added some code to make insert mode work in st. I don't know if I
 missed something, but It's Working For Me(tm). Patch attached.

I had a patch already ready for sending to solve this issue, but you were
faster ;). I put my code in tsetchar instead of tputc, but the code is
basically the same and the result is the same. It is ok.

Best regards.

 --
 Eckehard Berns

 diff -r 19ef42df8e7d st.c
 --- a/st.cWed Nov 14 06:37:24 2012 +0100
 +++ b/st.cThu Nov 15 15:19:52 2012 +0100
 @@ -2100,6 +2100,10 @@
   sel.bx = -1;
   if(IS_SET(MODE_WRAP)  term.c.state  CURSOR_WRAPNEXT)
   tnewline(1); /* always go to first col */
 + if(IS_SET(MODE_INSERT)  term.c.x+1  term.col)
 + memmove(term.line[term.c.y][term.c.x+1],
 + term.line[term.c.y][term.c.x],
 + (term.col - term.c.x - 1) * sizeof(Glyph));
   tsetchar(c, term.c.attr, term.c.x, term.c.y);
   if(term.c.x+1  term.col)
   tmoveto(term.c.x+1, term.c.y);
 diff -r 19ef42df8e7d st.info
 --- a/st.info Wed Nov 14 06:37:24 2012 +0100
 +++ b/st.info Thu Nov 15 15:19:52 2012 +0100
 @@ -153,6 +153,7 @@
   ritm=\E[23m,
   rmacs=\E(B,
   rmcup=\E[?1049l,
 + rmir=\E[4l,
   rmkx=\E[?1l\E,
   rmso=\E[23m,
   rmul=\E[m,
 @@ -168,6 +169,7 @@
   sitm=\E[3m,
   smacs=\E(0,
   smcup=\E[?1049h,
 + smir=\E[4h,
   smkx=\E[?1h\E=,
   smso=\E[3m,
   smul=\E[4m,



Re: [dev] [surf] Disable javascript

2012-11-15 Thread Nick
On Thu, Nov 15, 2012 at 03:29:45PM +0100, Christoph Lohmann wrote:
 Thanks for the patches. Toggle, insert and the status area patch are now
 in surf tip. And they are documented in the manpage too.

Insert mode? Since when did surf become modal? Why is this needed
(except for people who like to pretend they're using vim)?

In my experience modality in a web browser seems neat for the first
day or two, then becomes really annoying, as you have to keep track
of which mode you're in, keep accidentally toggling stuff rather
than typing into text fields, etc.



Re: [dev] [st] Add insert mode

2012-11-15 Thread Christoph Lohmann
Greetings.

On Thu, 15 Nov 2012 15:42:40 +0100 Eckehard Berns ecki-suckl...@ecki.to wrote:
 I added some code to make insert mode work in st. I don't know if I
 missed something, but It's Working For Me(tm). Patch attached.

What are you using this insert mode for?


Sincerely,

Christoph Lohmann




Re: [dev] [st] Fix the tab key

2012-11-15 Thread Christoph Lohmann
Greetings.

On Thu, 15 Nov 2012 15:43:25 +0100 Roberto E. Vargas Caballero 
k...@shike2.com wrote:
 
 Hello,
 
 A new serie of patches that fix some problems detected in last serie:
 
   - Tab problems
   - Return problems in not newline modes
   - arrow problems
 
 Please, if you find some new errors (I am pretty sure something can happen)
 notice me. This new series apply over the actual mercurial tip.

Thanks, most of the keys are working. Now Return is sending two line breaks.


Sincerely,

Christoph Lohmann





Re: [dev] [st] Add insert mode

2012-11-15 Thread Roberto E. Vargas Caballero
 What are you using this insert mode for?

The sequence for this mode was in st from historical times (before I met
it), it changes the st mode but does nothing. Maybe you should ask to
Aurielien why he implemented the set/reset sequences but not the behaviour.

Best regards,



Re: [dev] [st] Add insert mode

2012-11-15 Thread Eckehard Berns
On Thu, Nov 15, 2012 at 03:42:40PM +0100, Christoph Lohmann wrote:
 On Thu, 15 Nov 2012 15:42:40 +0100 Eckehard Berns ecki-suckl...@ecki.to 
 wrote:
  I added some code to make insert mode work in st. I don't know if I
  missed something, but It's Working For Me(tm). Patch attached.
 
 What are you using this insert mode for?

I access some machines remotely and I don't want to install the terminfo
entry on all of them (some of which belong to customers and I wouldn't
even want to temper with their system). So I simply set TERM=vt220 when
on the remote machine. Insert mode is used by nvi and traditional vi
among others.

-- 
Eckehard Berns



Re: [dev] [surf] Disable javascript

2012-11-15 Thread stanio
* Nick suckless-...@njw.me.uk [2012-11-15 15:47]:
 Insert mode? Since when did surf become modal? Why is this needed
 (except for people who like to pretend they're using vim)?

I agree, insert mode is quite special and maybe is worth having it as a
patch rather than in mainline surf. It makes character handling less
readable. 

If you want it, you will know that and will know how to get it working. 

cheers
--s_



Re: [dev] [st] Add insert mode

2012-11-15 Thread Christoph Lohmann
Greetings.

On Thu, 15 Nov 2012 16:21:01 +0100 Eckehard Berns ecki-suckl...@ecki.to wrote:
 On Thu, Nov 15, 2012 at 03:42:40PM +0100, Christoph Lohmann wrote:
  On Thu, 15 Nov 2012 15:42:40 +0100 Eckehard Berns ecki-suckl...@ecki.to 
  wrote:
   I added some code to make insert mode work in st. I don't know if I
   missed something, but It's Working For Me(tm). Patch attached.
  
  What are you using this insert mode for?
 
 I access some machines remotely and I don't want to install the terminfo
 entry on all of them (some of which belong to customers and I wouldn't
 even want to temper with their system). So I simply set TERM=vt220 when
 on the remote machine. Insert mode is used by nvi and traditional vi
 among others.

Ok, that seems like a legit feature. Which applications you encountered are
using this mode? Only nvi and vi?

Your patch is applied to the tip of st. Thanks!


Sincerely,

Christoph Lohmann




Re: [dev] [st] Add insert mode

2012-11-15 Thread Roberto E. Vargas Caballero
 Ok, that seems like a legit feature. Which applications you encountered are
 using this mode? Only nvi and vi?

Theorically all good applications should use this mode, but in these days is
not always true. For example bash repaint the full line each time you write
a line, it is very funny when you run it in a 200bps line.



Re: [dev] [st] Add insert mode

2012-11-15 Thread Eckehard Berns
On Thu, Nov 15, 2012 at 04:21:01PM +0100, Christoph Lohmann wrote:
 On Thu, 15 Nov 2012 16:21:01 +0100 Eckehard Berns ecki-suckl...@ecki.to 
 wrote:
  On Thu, Nov 15, 2012 at 03:42:40PM +0100, Christoph Lohmann wrote:
   What are you using this insert mode for?
  
  I access some machines remotely and I don't want to install the terminfo
  entry on all of them (some of which belong to customers and I wouldn't
  even want to temper with their system). So I simply set TERM=vt220 when
  on the remote machine. Insert mode is used by nvi and traditional vi
  among others.
 
 Ok, that seems like a legit feature. Which applications you encountered are
 using this mode? Only nvi and vi?

I don't use too many term{cap,info} apps on remote machines. But from
the nature of insert mode I would assume that mainly editors would use
it. A quick test on my own system showed no other editor using insert
mode though.

-- 
Eckehard Berns



Re: [dev] [st] Fix the tab key

2012-11-15 Thread Roberto E. Vargas Caballero
On Thu, Nov 15, 2012 at 03:16:26PM +0100, Eckehard Berns wrote:
  Please, if you find some new errors (I am pretty sure something can happen)
  notice me.

 For me Shift+Insert inserts \E[2;2~ just before the selection.


I attach the patch which fix this problem.
From b06832d5f12d75daa8c640d91bc4ee97bad24bc2 Mon Sep 17 00:00:00 2001
From: Roberto E. Vargas Caballero k...@shike2.com
Date: Thu, 15 Nov 2012 18:18:24 +0100
Subject: Fix Shift + Insert shortcut

This patch apply the same code for shortcuts that it is used now for defined
keys. So it is possible use now XK_NO_MOD and XK_ANY_MOD for defining shortcuts.
---
 st.c |   35 ---
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/st.c b/st.c
index ba93f2f..477a8f8 100644
--- a/st.c
+++ b/st.c
@@ -65,7 +65,6 @@
 #define REDRAW_TIMEOUT (80*1000) /* 80 ms */
 
 /* macros */
-#define CLEANMASK(mask) (mask  (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
 #define SERRNO strerror(errno)
 #define MIN(a, b)  ((a)  (b) ? (a) : (b))
 #define MAX(a, b)  ((a)  (b) ? (b) : (a))
@@ -329,6 +328,7 @@ static void tsetmode(bool, bool, int *, int);
 static void tfulldirt(void);
 static void techo(char *, int);
 
+static inline bool match(uint, uint);
 static void ttynew(void);
 static void ttyread(void);
 static void ttyresize(void);
@@ -2696,23 +2696,29 @@ focus(XEvent *ev) {
 	}
 }
 
+inline bool
+match(uint mask, uint state) {
+	if(mask == XK_NO_MOD  state)
+		return false;
+	if(mask != XK_ANY_MOD  mask != XK_NO_MOD  !state)
+		return false;
+	if((state  mask) != state)
+		return false;
+	return true;
+}
+
 char*
 kmap(KeySym k, uint state) {
 	uint mask;
 	Key *kp;
 
-	state = ~Mod2Mask;
 	for(kp = key; kp  key + LEN(key); kp++) {
 		mask = kp-mask;
 
 		if(kp-k != k)
 			continue;
 
-		if(mask == XK_NO_MOD  state)
-			continue;
-		if(mask != XK_ANY_MOD  mask != XK_NO_MOD  !state)
-			continue;
-		if((state  mask) != state)
+		if(!match(mask, state))
 			continue;
 
 		if((kp-appkey  0  IS_SET(MODE_APPKEYPAD)) ||
@@ -2741,21 +2747,20 @@ kpress(XEvent *ev) {
 	XKeyEvent *e = ev-xkey;
 	KeySym ksym;
 	char xstr[31], buf[32], *customkey, *cp = buf;
-	int len, i;
+	int len;
 	Status status;
+	Shortcut *bp;
 
 	if (IS_SET(MODE_KBDLOCK))
 		return;
 
 	len = XmbLookupString(xw.xic, e, xstr, sizeof(xstr), ksym, status);
-
+	e-state = ~Mod2Mask;
 	/* 1. shortcuts */
-	for(i = 0; i  LEN(shortcuts); i++) {
-		if((ksym == shortcuts[i].keysym)
- (CLEANMASK(shortcuts[i].mod) == \
-	CLEANMASK(e-state))
- shortcuts[i].func) {
-			shortcuts[i].func((shortcuts[i].arg));
+	for(bp = shortcuts; bp  shortcuts + LEN(shortcuts); bp++) {
+		if(ksym == bp-keysym  match(bp-mod, e-state)) {
+			bp-func((bp-arg));
+			return;
 		}
 	}
 
-- 
1.7.10.4



Re: [dev] [st] Fix the tab key

2012-11-15 Thread Christoph Lohmann
Greetings.

On Thu, 15 Nov 2012 19:01:36 +0100 Roberto E. Vargas Caballero 
k...@shike2.com wrote:
 On Thu, Nov 15, 2012 at 03:16:26PM +0100, Eckehard Berns wrote:
   Please, if you find some new errors (I am pretty sure something can 
   happen)
   notice me.
 
  For me Shift+Insert inserts \E[2;2~ just before the selection.
 
 
 I attach the patch which fix this problem.

Thanks, applied.


Sincerely,

Christoph




[dev] [st] function keys

2012-11-15 Thread Christoph Lohmann
Greetings.

Anyone  here on this mailinglist is using any of the Function keys above
XK_F12? X11 is defining symbols up to F35 and xterm allows  sending  es‐
cape codes up to F63. The question is how to implement this in st.

Anyone  knows  of  some  application in the past which made use of those
high function keys?


Sincerely,

Christoph Lohmann




[dev] [st] some minor patches

2012-11-15 Thread Roberto E. Vargas Caballero
From fe3fa59836a389992cbf07f63a5007fb1e24f9e6 Mon Sep 17 00:00:00 2001
From: Roberto E. Vargas Caballero k...@shike2.com
Date: Wed, 14 Nov 2012 19:20:28 +0100
Subject: Remove unused fields in cursor_movement

---
 st.c |4 
 1 file changed, 4 deletions(-)

diff --git a/st.c b/st.c
index 0a8382c..db21901 100644
--- a/st.c
+++ b/st.c
@@ -89,10 +89,6 @@ enum glyph_attribute {
 };
 
 enum cursor_movement {
-	CURSOR_UP,
-	CURSOR_DOWN,
-	CURSOR_LEFT,
-	CURSOR_RIGHT,
 	CURSOR_SAVE,
 	CURSOR_LOAD
 };
-- 
1.7.10.4

From fd65d3335331a2a4677494c5a232dfe32f815a23 Mon Sep 17 00:00:00 2001
From: Roberto E. Vargas Caballero k...@shike2.com
Date: Thu, 15 Nov 2012 20:20:04 +0100
Subject: Fix speech error in comment

---
 st.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/st.c b/st.c
index db21901..367ab51 100644
--- a/st.c
+++ b/st.c
@@ -2082,7 +2082,7 @@ tputc(char *c, int len) {
 			}
 		}
 		/*
-		 * All characters which forms part of a sequence are not
+		 * All characters which form part of a sequence are not
 		 * printed
 		 */
 		return;
-- 
1.7.10.4



Re: [dev] [st] function keys

2012-11-15 Thread Raphael Proust
On Thu, Nov 15, 2012 at 6:36 PM, Christoph Lohmann 2...@r-36.net wrote:
 Greetings.

 Anyone  here on this mailinglist is using any of the Function keys above
 XK_F12? X11 is defining symbols up to F35 and xterm allows  sending  es‐
 cape codes up to F63. The question is how to implement this in st.

 Anyone  knows  of  some  application in the past which made use of those
 high function keys?

vim allows mapping for function keys for up to F19. There are no
mappings by default though, and I've never seen them actually mapped…

Not only does it have F1-19, tt also has xF1-4.

(Look for terminal-options or termcap-options in the help.)


Cheers,
-- 
__
Raphaël Proust



Re: [dev] [st] function keys

2012-11-15 Thread Carlos Torres
I've mapped F2-F12 in vim, now that i have a terminal that allows higher
mappings i will probably add further mappings
F1 is help.

--Carlos

On Thu, Nov 15, 2012 at 4:18 PM, Raphael Proust raphla...@gmail.com wrote:

 On Thu, Nov 15, 2012 at 6:36 PM, Christoph Lohmann 2...@r-36.net wrote:
  Greetings.
 
  Anyone  here on this mailinglist is using any of the Function keys above
  XK_F12? X11 is defining symbols up to F35 and xterm allows  sending  es‐
  cape codes up to F63. The question is how to implement this in st.
 
  Anyone  knows  of  some  application in the past which made use of those
  high function keys?

 vim allows mapping for function keys for up to F19. There are no
 mappings by default though, and I've never seen them actually mapped…

 Not only does it have F1-19, tt also has xF1-4.

 (Look for terminal-options or termcap-options in the help.)


 Cheers,
 --
 __
 Raphaël Proust