nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] Re: sample Python regexes, revisited


From: John M. Gabriele
Subject: [Nano-devel] Re: sample Python regexes, revisited
Date: Sat, 1 Apr 2006 19:00:09 -0800 (PST)

David wrote:

> John M. Gabriele wrote:
> 
> <snip>
> 
> > - I don't like nano's forward-by-word (Ctrl-Space) and back-by-word
> >   (Alt-Space) key combos, and also could never get Alt-Space to work.
> 
> Unfortunately, Ctrl-Space has to be the default for Pico compatibility,
> and Alt-Space seems to be the only intuitive keystroke for the reverse
> function.  The rewrite should have rebindable keys in order to get
> around this, though.
> 
> In the meantime, I'll try to help you get Alt-Space working. 

Very good. 

> You may
> not use nano anymore, but if anyone else has the same problem you do,
> I'd like to know what to tell them (other than "use a different editor"
> ;) I'm somewhat biased in this regard), if possible.  I've searched for
> a solution, and all I've been able to find out is that the behavior can
> be turned off via a configuration option if you're using the PuTTY
> terminal (which doesn't help you, since you're apparently using xterm),
> and that some window managers intercept it for use as a menu key (which
> may help you).  What window manager are you using?

Debian Etch (and Sid) with IceWM and xterm. Same thing happens with aterm.
Same thing with left Alt as with right Alt. Here's some xev output from
hitting Alt-Space (first left Alt, then right).

KeyPress event, serial 30, synthetic NO, window 0x1600001,
    root 0x4c, subw 0x0, time 14054305, (1221,-259), root:(1227,732),
    state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

FocusOut event, serial 30, synthetic NO, window 0x1600001,
    mode NotifyGrab, detail NotifyAncestor

[then that window X11 window menu pops up. When I get rid of it: ]

FocusIn event, serial 30, synthetic NO, window 0x1600001,
    mode NotifyUngrab, detail NotifyNonlinear

KeymapNotify event, serial 30, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0



KeyPress event, serial 30, synthetic NO, window 0x1600001,
    root 0x4c, subw 0x0, time 14090915, (877,-460), root:(883,531),
    state 0x0, keycode 113 (keysym 0xffea, Alt_R), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

FocusOut event, serial 30, synthetic NO, window 0x1600001,
    mode NotifyGrab, detail NotifyAncestor

[same X11 window menu. Then, ]

FocusIn event, serial 30, synthetic NO, window 0x1600001,
    mode NotifyUngrab, detail NotifyNonlinear

KeymapNotify event, serial 30, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0


Funny... I'm not seeing any

KeyPress event, serial 30, synthetic NO, window 0x1600001,
    root 0x4c, subw 0x0, time 17099918, (1429,-25), root:(1435,966),
    state 0x0, keycode 65 (keysym 0x20, space), same_screen YES,
    XLookupString gives 1 bytes: (20) " "
    XmbLookupString gives 1 bytes: (20) " "
    XFilterEvent returns: False

KeyRelease event, serial 30, synthetic NO, window 0x1600001,
    root 0x4c, subw 0x0, time 17100046, (1429,-25), root:(1435,966),
    state 0x0, keycode 65 (keysym 0x20, space), same_screen YES,
    XLookupString gives 1 bytes: (20) " "

in there. Does anyone else have the Alt-Space problem?



> > - nano doesn't have an undo.
> 
> The rewrite will have this.

Very good.


> > I don't really like vim (nor the whole idea of a modal editor), but
> > that smart syntax highlighting is powerful stuff. And also, I use
> > forward-/back-by-word all the time.
> >
> > Regarding key bindings, my favorite are the uber-simple NEdit ones,
> > but they rely on arrow, home, end, page-up, and page-down keys, and I
> > guess the worry is that you shouldn't have a terminal-based editor
> > rely on those keys (?).
> 
> Many terminals have arrow keys, Home, End, PageUp, and PageDown, and
> they can be handled in curses relatively easily.  The problem is with
> modifiers for them.  For example, some word processors use Ctrl-Left
> Arrow and Ctrl-Right Arrow to move backward or forward a word,

Yes, like NEdit. I love those key-combos.

> but some
> terminals can't tell the difference between an arrow key and Ctrl-[arrow
> key]. 

Gah!

> A graphical environment with more advanced keyboard handling,
> such as X11, can handle this, but having some things work only in a
> graphical environment defeats one of the main purposes of nano: to be
> fully useful in text mode.
> 
> <snip>
> 
> > There's some links at the bottom of my nano help sheet
> > http://www.simisen.com/jmg/nano.html showing where I got the Python
> > patterns from.
> 
> Thanks again.  It's in the changelog.  By the way, your nano page is
> very well done. 

Thanks!

> Three suggestions: you might want to add something like
> 
> "cut to end of file    Alt-t"

I didn't put that one in because I never had a use for it.
It doesn't seem very often that someone would need to do that,
so I left it out (after all, nano has pretty good online help
for options that you forget the key-combos to).

> to the "Selecting/Cutting/Copying/Pasting" section, you might want to
> change the "search/replace" key entry to "Ctrl-\ (or Alt-r)" in the
> "Searching" section,

As an aside, I'm not too fond of using *both* the Ctrl key and the
Alt key for various commands. I tend to mix them up. :) Personally,
I'm happier if everything is accessible via Ctrl, so I'm hesitant
to present and try to remember the Alt equivalents unless they're
much more helpful (as in, using Alt-w instead of Ctrl-w Enter to
"find again").

I mean, either you memorize Ctrl-\ as being search an replace, or
else you memorize the difference between Alt-r and Ctrl-r. I'd
rather just stick with the former without getting Alt into the mix.
Just my opinion anyhow. The emacs users in the crowd may
disagree. :)


> and if/when we can work out your Alt-Space problem,
> you might want to mention the solution to it there.

Sure. Although I'm not using nano for anything at the moment, I've
re-subscribed to this list for now, so if you come up with a solution,
just post about it and I'll update my page.

> > Now,.. about the Ruby patterns... ;)
> 
> Argh...

Well, you've already got one for Perl and for Python,... :)

BTW, are the regexes that go into the nanorc PCRE? An older
sed style? Something else? You might mention something in the
nanorc man page about them.

Hm... I seem to recall asking about where you preferred
docs on the nanorc to go: into the sample nanorc, or the
man page. Which do you favor?

> Good luck.  Sorry that some nano inconveniences led you to switch to the
> dark side ;) although I hope that the nano rewrite will eventually pull
> you back.

Oooh, well, as long as you're looking to pull me back, :) I've
got one more feature request: find previous. Possibly, when you
hit Ctrl-w to find the next occurrence, have an option there to
hit Ctrl-w again or something (just like how you can hit Ctrl-c
to cancel the search) to go back to the previous search result.

Hmm... weird. Currently, Ctr-w Ctrl-w moves me up-by-paragraph,
just like Alt-9. (!) So, maybe that makes it a good candidate
for find-previous?

---John


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]