GithubHelp home page GithubHelp logo

Comments (18)

michael-lazar avatar michael-lazar commented on May 28, 2024

Works for me in gnome-terminal, what terminal are you using?

from rtv.

 avatar commented on May 28, 2024

Not working in iterm2 for os x

from rtv.

mishravikas avatar mishravikas commented on May 28, 2024

Not working on xfce4-terminal 0.6.3

from rtv.

michael-lazar avatar michael-lazar commented on May 28, 2024

It actually works for me on a fresh install of xfce4-terminal 0.6.3. Try going to preferences -> compatability and check what the backspace key is set to. curses expects control-h (^h). My guess is that iterm2 has a similar issue, but I'm unable to check because I don't have a Mac.

From the curses documentation

    """Editing widget using the interior of a window object.
     Supports the following Emacs-like key bindings:

    Ctrl-A      Go to left edge of window.
    Ctrl-B      Cursor left, wrapping to previous line if appropriate.
    Ctrl-D      Delete character under cursor.
    Ctrl-E      Go to right edge (stripspaces off) or end of line (stripspaces on).
    Ctrl-F      Cursor right, wrapping to next line when appropriate.
    Ctrl-G      Terminate, returning the window contents.
    Ctrl-H      Delete character backward.
    Ctrl-J      Terminate if the window is 1 line, otherwise insert newline.
    Ctrl-K      If line is blank, delete it, otherwise clear to end of line.
    Ctrl-L      Refresh screen.
    Ctrl-N      Cursor down; move down one line.
    Ctrl-O      Insert a blank line at cursor location.
    Ctrl-P      Cursor up; move up one line.

    Move operations do nothing if the cursor is at an edge where the movement
    is not possible.  The following synonyms are supported where possible:

    KEY_LEFT = Ctrl-B, KEY_RIGHT = Ctrl-F, KEY_UP = Ctrl-P, KEY_DOWN = Ctrl-N
    KEY_BACKSPACE = Ctrl-h

from rtv.

0xr0bert avatar 0xr0bert commented on May 28, 2024

I can confirm it doesn't work on iTerm 2

from rtv.

0xr0bert avatar 0xr0bert commented on May 28, 2024

I think iTerm 2 uses ^? as the backspace key (http://www.macfreek.nl/memory/Backspace_and_Delete_key_reversed#iTerm_.28Mac_OS_X_application.29)

from rtv.

michael-lazar avatar michael-lazar commented on May 28, 2024

So looking through the curses textpad source there are two supported keys for backspace

  • curses.ascii.BS which is mapped to 0x08 (^H)
  • curses.KEY_BACKSPACE which is mapped to 0x107

It's seems very strange that curses.ascii.DEL which is mapped to 0x7F (^?) is not supported. From the link that you posted that seems to be the standard convention. Sure enough, when I type ctrl-v and press the backspace key, it prints ^? in my terminal.

from rtv.

michael-lazar avatar michael-lazar commented on May 28, 2024

I still don't understand exactly what's causing this, but I pushed a patch 7738211 to convert 0x7f to a backspace. Please let me know if this fixes the problem for you.

from rtv.

peterpans01 avatar peterpans01 commented on May 28, 2024

I try on Windows but it didn't work,too. (Tested after the patch 7738211). And all the characters after ''Enter Subreddit: /r/" is invisible (maybe it's black!).

from rtv.

peterpans01 avatar peterpans01 commented on May 28, 2024

Sorry, I'm just beginner of curses. After typing the name of subreddit, how can I access it? ENTER key didn't work.

from rtv.

tobywhughes avatar tobywhughes commented on May 28, 2024

What do you mean by it is invisible? As in, if the text was "/r/python" it shows as "/r/ ython"?

from rtv.

peterpans01 avatar peterpans01 commented on May 28, 2024

No, I mean I can see the cursor change the position but I can't see the text I typed!
Here is the shot after I typed 'python', the small red rectangle is the position of cursors.

screen_shot

from rtv.

michael-lazar avatar michael-lazar commented on May 28, 2024

Hi @peterpans01, thanks for the heads up.

Did you have to do anything special to get this to work in Windows? According to https://docs.python.org/3.3/howto/curses.html, curses is not included in the Windows version of Python. I'm honestly surprised that this is working for you at all.

My guess is that whatever curses build that you're using has different behavior for some functions, namely this one https://docs.python.org/2/library/curses.html#curses.window.addch. I'll try it out on my Windows box when I get home today.

from rtv.

Qu4tro avatar Qu4tro commented on May 28, 2024

Just informing that it works fine on xterm.

from rtv.

peterpans01 avatar peterpans01 commented on May 28, 2024

Hi @michael-lazar, it's not so special. I just need to install curses in windows and it's works. πŸ’ƒ You can try to intall curses here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses. I'm still looking for a solution for that.

from rtv.

tobywhughes avatar tobywhughes commented on May 28, 2024

Is it possible that rtv could install curses automatically if an installation is not found?

from rtv.

peterpans01 avatar peterpans01 commented on May 28, 2024

I confirm that backspace works in Windows 7 and I can fix the errors I show above.

from rtv.

michael-lazar avatar michael-lazar commented on May 28, 2024

Resolved in #31. Thanks again for looking into this @peterpans01. Once things have settled down a bit, I'll add a section in the README with instructions for installing curses on Windows.

from rtv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.