Unexpected output from directional keypress in MacOSKeypress Limit - Anomalous Problem!Command prompt hangs...

Gantt Chart like rectangles with log scale

How do I hide Chekhov's Gun?

Have researchers managed to "reverse time"? If so, what does that mean for physics?

Why doesn't using two cd commands in bash script execute the second command?

How to deal with taxi scam when on vacation?

Are ETF trackers fundamentally better than individual stocks?

Is there a data structure that only stores hash codes and not the actual objects?

Is it normal that my co-workers at a fitness company criticize my food choices?

Do I need life insurance if I can cover my own funeral costs?

Co-worker team leader wants to inject his friend's awful software into our development. What should I say to our common boss?

Employee lack of ownership

Instead of Universal Basic Income, why not Universal Basic NEEDS?

Sailing the cryptic seas

Why did it take so long to abandon sail after steamships were demonstrated?

If I can solve Sudoku can I solve Travelling Salesman Problem(TSP)? If yes, how?

Why would a flight no longer considered airworthy be redirected like this?

What has been your most complicated TikZ drawing?

Is it true that good novels will automatically sell themselves on Amazon (and so on) and there is no need for one to waste time promoting?

A link redirect to http instead of https: how critical is it?

Most cost effective thermostat setting: consistent temperature vs. lowest temperature possible

How to terminate ping <dest> &

compactness of a set where am I going wrong

The difference between「N分で」and「後N分で」

What options are left, if Britain cannot decide?



Unexpected output from directional keypress in MacOS


Keypress Limit - Anomalous Problem!Command prompt hangs until keypress?Play Model M key sound on keypressConvert htop output to HTMLUnexpected BPython console output behaviourxbindkeys wont recognise keypressAltGr key generate spurious Control_L keyPress eventsMultiple keypress not workingpython - macOS terminal ignoring /etc/paths for /usr/local/bin'ls' output doesn't show color anymore in macOS High Sierra













1















I'm using MacOS 10.14.3 and the Python 3.7 curses module to print the values returned when I press the up or down directional keys:



import curses

def main(stdscr):
win = curses.newwin(24, 80, 0, 0)
y = 0
while True:
ch = win.getch()
win.addstr(y, 0, str(ch))
y += 1

curses.wrapper(main)


When I press up, this prints:



27
91
65


When I press down, it prints:



27
91
66


From the docs, getch should be returning 258 (curses.KEY_UP) or 259 (curses.KEY_DOWN), respectively. Any idea what could be causing this behavior? Is my terminal misconfigured?









share





























    1















    I'm using MacOS 10.14.3 and the Python 3.7 curses module to print the values returned when I press the up or down directional keys:



    import curses

    def main(stdscr):
    win = curses.newwin(24, 80, 0, 0)
    y = 0
    while True:
    ch = win.getch()
    win.addstr(y, 0, str(ch))
    y += 1

    curses.wrapper(main)


    When I press up, this prints:



    27
    91
    65


    When I press down, it prints:



    27
    91
    66


    From the docs, getch should be returning 258 (curses.KEY_UP) or 259 (curses.KEY_DOWN), respectively. Any idea what could be causing this behavior? Is my terminal misconfigured?









    share



























      1












      1








      1








      I'm using MacOS 10.14.3 and the Python 3.7 curses module to print the values returned when I press the up or down directional keys:



      import curses

      def main(stdscr):
      win = curses.newwin(24, 80, 0, 0)
      y = 0
      while True:
      ch = win.getch()
      win.addstr(y, 0, str(ch))
      y += 1

      curses.wrapper(main)


      When I press up, this prints:



      27
      91
      65


      When I press down, it prints:



      27
      91
      66


      From the docs, getch should be returning 258 (curses.KEY_UP) or 259 (curses.KEY_DOWN), respectively. Any idea what could be causing this behavior? Is my terminal misconfigured?









      share
















      I'm using MacOS 10.14.3 and the Python 3.7 curses module to print the values returned when I press the up or down directional keys:



      import curses

      def main(stdscr):
      win = curses.newwin(24, 80, 0, 0)
      y = 0
      while True:
      ch = win.getch()
      win.addstr(y, 0, str(ch))
      y += 1

      curses.wrapper(main)


      When I press up, this prints:



      27
      91
      65


      When I press down, it prints:



      27
      91
      66


      From the docs, getch should be returning 258 (curses.KEY_UP) or 259 (curses.KEY_DOWN), respectively. Any idea what could be causing this behavior? Is my terminal misconfigured?







      keyboard terminal python ncurses





      share














      share












      share



      share








      edited 1 min ago







      Lorenz Forvang

















      asked 7 mins ago









      Lorenz ForvangLorenz Forvang

      163




      163






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1414481%2funexpected-output-from-directional-keypress-in-macos%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1414481%2funexpected-output-from-directional-keypress-in-macos%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

          VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

          Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...