Skip to content

Commit

Permalink
Disable terminal focus reporting
Browse files Browse the repository at this point in the history
Terminals can be asked to report focus events with

        print("\x1b[?1004h")

For some reason, our use of curses sends a sequence like that (not
exactly that one, but it contains "1004", you can observe it by
running ranger inside "script").

Then the terminal will send ^[[I and ^[[O for "focus in" and "focus
out" events respectively.  This is quite annoying. The proper way
to deal with these is to map them ourselves in all modes (to a nop,
or optionally add some UI feedback).

I do not know how to do that, so turn it off altogether with the
corresponding "l" sequence.

Fixes ranger#2864
  • Loading branch information
krobelus committed Apr 6, 2024
1 parent 38bb890 commit d557b0f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ranger/gui/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def initialize(self):
self.win.addstr("loading...")
self.win.refresh()
self._draw_title = curses.tigetflag('hs') # has_status_line
print("\x1b[?1004l")

self.update_size()
self.is_on = True
Expand Down

0 comments on commit d557b0f

Please sign in to comment.