Opened 6 years ago

Closed 6 years ago

#2830 closed defect (fixed)

Arm should redraw on CTRL-L

Reported by: np Owned by: atagar
Priority: Medium Milestone:
Component: Core Tor/Nyx Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

In some conditions arm fails to redraw itself properly. In particular when used in combination with dtach for instance. Being able to simply hit CTRL-L to redraw is the expected improvement.

As a workaround resizing the window fixes the issue most of the time. This is inconvenient in particular in conjunction with a tiling window manager.

Child Tickets

Change History (12)

comment:1 Changed 6 years ago by atagar

Why is ctrl+L expected to redraw an application? Is this dtach specific and do other terminal apps (for instance top) respect it too?

In terms of a fix we just need to issue a ".redraw(True)" call on all the panels (that's what happens during a resize on lines 759-767 of the controller [1]. Triggering this on a keystroke would be simple, but unfortunately recognizing the ctrl modifier with curses is a pita.

[1] https://svn.torproject.org/svn/arm/trunk/src/interface/controller.py

comment:2 Changed 6 years ago by np

While top does not support it: htop, vim, mutt, irssi, more, less, emacs... all support it.

I know that handling CTRL is a bit special. In the mean time using a simple letter like R would be fine, in particular if it is described in the help panel.

comment:3 Changed 6 years ago by atagar

In the mean time using a simple letter like R would be fine, in particular if it is described in the help panel.

I disagree. Considering that over the course of two years this is the first time I've had a manual screen redraw request, providing any arbitrary hotkey probably isn't something that'll really address the issue here.

It sounds to me like the real problem is that dtach (and maybe other terminal rendering apps) expect a ctrl+L keybinding to be available for redrawing by convention, so we'd really need this particular trigger to fulfill their expectations. Besides, no one reads the help menus. :P

I'll look into this more after 1.4.2 has been released and had time to settle. In the meantime, patches welcome. Cheers! -Damian

comment:4 Changed 6 years ago by np

Ok, I hadn't read the man page of dtach since long ago. Indeed it does provides a mean to issue a redraw command when attaching a session. However there is two modes for redrawing: CTRL-L and the WINCH signal. Actually mine is configured to issue a WINCH signal and for some applications I manually issue a CTRL-L.

So the best option IMHO would be to at least support the WINCH signal.

I'm no python coder but I will look into this anyway and I do read the help menu :)

comment:5 Changed 6 years ago by atagar

  • Status changed from new to assigned

comment:6 Changed 6 years ago by atagar

  • Resolution set to fixed
  • Status changed from assigned to closed

Implemented, triggering a manual redraw when the user presses ctrl+L:
https://gitweb.torproject.org/arm.git/commit/38c2f3662ac8858fabc54a5826c1af601590c9b0

Cheers! -Damian

comment:7 Changed 6 years ago by np

  • Resolution fixed deleted
  • Status changed from closed to reopened

I've just tried 1.4.4 and CTRL-L is still unable to redraw all the screen. However I found a workaround that may help to fix this properly. By hitting 'm' the menu appears and all the screen is properly redrawn. In short hitting 'm' twice does the right thing.

comment:8 Changed 6 years ago by atagar

Sorry about that. It was requesting a redraw but not forcing the operation so some unchanged content was being left alone. I've checked in a fix...
https://gitweb.torproject.org/arm.git/commitdiff/ad8741d5f43b0ba441d094bc1dea9aa9a4354254

mind giving it a shot to make sure that it works for you?

comment:9 Changed 6 years ago by np

Sorry I've just tried and the issue is still the same.
However I searched myself a bit and found a solution. There is maybe a cache of the screen in the curses library which discards operations trying to draw something supposed to already be on screen.

Fix is to call stdscr.clear() before calling redraw.

comment:10 Changed 6 years ago by atagar

Weird. When the force flag is included it calls the curses erase() function for all of the panels before redrawing the content.

I'm not able to see a difference when calling clear so it should be safe, but lets first make sure that it addresses the problem on your system. In src/cli/controller.py on line 344 (the redraw method) please try adding the following...

if force:

self._screen.clear()

If that works for you then I'll add the fix. Cheers! -Damian

comment:11 Changed 6 years ago by np

Your change works for me.

comment:12 Changed 6 years ago by atagar

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.