ranger / ranger

A VIM-inspired filemanager for the console
https://ranger.fm
GNU General Public License v3.0
15.62k stars 892 forks source link

There is no cursor in command line (FreeBSD) #2106

Open A1-Triard opened 4 years ago

A1-Triard commented 4 years ago

Runtime Environment

Current Behavior

There is no cursor in command line after after pressing ':' key. I can see cursor: it is stuck in screen top line and don't move then I type command.

Expected Behavior

Cursor appears in command line and react on pressing keys.

A1-Triard commented 4 years ago

If you point me to a direction, I can try to do further investigation.

toonn commented 4 years ago

Hmm, I'd expect this is because of how we use ncurses. Maybe you could ask for help on their tracker or in their IRC channel? Just to help you find out what the issue on our side is/could be.

A1-Triard commented 4 years ago

Also, I gets a warning at every start:

Warning: Subwindow size out of bounds for <ViewMiller> (x = 0, y = 18895760, hei = 39, wid = 136)

Couldn't it be related to the cursor issue?

toonn commented 4 years ago

Do you have a vertically large display? I guess it could be related.

A1-Triard commented 4 years ago

No. 1366x768, 41 lines in maximized console window.

toonn commented 4 years ago

Seems like some sort of initialization problem, because of the y value. That should be the vertical position of the window's upper left corner. I assume your display doesn't have 18 million vertical pixels?

A1-Triard commented 4 years ago

I can try to debug this if you show me some key code points.

toonn commented 4 years ago

Maybe the setup_curses method in ranger/gui/ui.py? I'm not really sure where to start with this.

A1-Triard commented 4 years ago

For now, I have found, that if add the following code after the self.paryx = self.win.getparyx() line in gui/displayable.py

if self.paryx[0] > 30000:
    self.paryx = (0, 0)

it fixes cursor horizontal coordinate: it still stays in top line, but correctly moves in horizontal direction then I type a command.

A1-Triard commented 4 years ago

Workaround

--- ranger/gui/displayable.py.orig  2019-12-31 15:07:45 UTC
+++ ranger/gui/displayable.py
@@ -149,6 +149,7 @@ class Displayable(  # pylint: disable=too-many-instanc
         try:
             maxy, maxx = self.fm.ui.termsize
         except TypeError:
+            maxy = 1
             pass
         else:
             if hei is None:
@@ -204,6 +205,8 @@ class Displayable(  # pylint: disable=too-many-instanc
                     pass

             self.paryx = self.win.getparyx()
+            if self.paryx[0] > 30000:
+                self.paryx = (maxy - 1, self.paryx[1])
             self.y, self.x = self.paryx
             if self.parent:
                 self.y += self.parent.y