Window/box improvements #18

Closed
opened 2026-10-05 03:16:16 +02:00 by adam · 3 comments
Owner

A few things I'd like to do with the windows / "boxes" for the channel list, message list, and node list.

Issue 1

When converting to pad, I could have gotten rid of these windows completely but I kept them for convenience so we could:

  • Draw a box around the pads
  • Use the box globals as a convenient way to retrieve the x/y/height/width of the drawable area for each of these when we need to draw inside them / wrap text / stuff like that

In collaboration with google search AI, I came up with the following (surprisingly verbose compared to "window_name.box()") to draw a simple box:

def draw_box(stdscr, y, x, height, width):
        """Draws a box using hline and vline in curses."""

        # Draw top and bottom borders
        stdscr.hline(y, x, curses.ACS_HLINE, width)
        stdscr.hline(y + height - 1, x, curses.ACS_HLINE, width)

        # Draw left and right borders
        stdscr.vline(y, x, curses.ACS_VLINE, height)
        stdscr.vline(y, x + width - 1, curses.ACS_VLINE, height)

        # Draw corners
        stdscr.addch(y, x, curses.ACS_ULCORNER)
        stdscr.addch(y, x + width - 1, curses.ACS_URCORNER)
        stdscr.addch(y + height - 1, x, curses.ACS_LLCORNER)
        stdscr.addch(y + height - 1, x + width - 1, curses.ACS_LRCORNER)

You can .box() a pad, but that boxes the ENTIRE contents, some of which are usually offscreen. So that's not what we want.

Having a whole curses window just for each box drawing is unnecessary and probably wastes some resources (?) so I'd like to get rid of them.

We'd need an alternative way to remember the size and placement of each window.

Issue 2

I'm still not in love with how selecting the message window behaves. We indicate the active window for channels / nodes by having something in selected (inverted text/background color). Messages no longer have a (visible) selection. The way to know that messages is the active window is to observe that neither channels nor nodes has a selected item.

I was thinking of changing the box around each of these windows to a different color when they're active to give the user a little more context about what is going on.

A few things I'd like to do with the windows / "boxes" for the channel list, message list, and node list. ### Issue 1 When converting to pad, I could have gotten rid of these windows completely but I kept them for convenience so we could: * Draw a box around the pads * Use the box globals as a convenient way to retrieve the x/y/height/width of the drawable area for each of these when we need to draw inside them / wrap text / stuff like that In collaboration with google search AI, I came up with the following (surprisingly verbose compared to "window_name.box()") to draw a simple box: ``` def draw_box(stdscr, y, x, height, width): """Draws a box using hline and vline in curses.""" # Draw top and bottom borders stdscr.hline(y, x, curses.ACS_HLINE, width) stdscr.hline(y + height - 1, x, curses.ACS_HLINE, width) # Draw left and right borders stdscr.vline(y, x, curses.ACS_VLINE, height) stdscr.vline(y, x + width - 1, curses.ACS_VLINE, height) # Draw corners stdscr.addch(y, x, curses.ACS_ULCORNER) stdscr.addch(y, x + width - 1, curses.ACS_URCORNER) stdscr.addch(y + height - 1, x, curses.ACS_LLCORNER) stdscr.addch(y + height - 1, x + width - 1, curses.ACS_LRCORNER) ``` You can .box() a pad, but that boxes the ENTIRE contents, some of which are usually offscreen. So that's not what we want. Having a whole curses window just for each box drawing is unnecessary and probably wastes some resources (?) so I'd like to get rid of them. We'd need an alternative way to remember the size and placement of each window. ### Issue 2 I'm still not in love with how selecting the message window behaves. We indicate the active window for channels / nodes by having something in selected (inverted text/background color). Messages no longer have a (visible) selection. The way to know that messages is the active window is to observe that neither channels nor nodes has a selected item. I was thinking of changing the box around each of these windows to a different color when they're active to give the user a little more context about what is going on. <!-- github-sync-id:2807690808 -->
adam closed this issue 2026-10-05 03:16:16 +02:00
Author
Owner

Not sure about #1, but I've been thinking about #2 as well and your solution to color the outline of the selected window is brilliant. I'd suggest green. :-)

Not sure about #1, but I've been thinking about #2 as well and your solution to color the outline of the selected window is brilliant. I'd suggest green. :-) <!-- github-comment-id:2610795433 -->
Author
Owner

I like the number 2 Idea. ALso would be nice to have TAB advance through each window since people are used to using it on forms to advance to next field, and it's easier to hit on the kbd.. Unless there are plans for more windows we can remove the left right altogether if decided and just use tab. Hit tab until the window you want highlights? Just a thought...

I like the number 2 Idea. ALso would be nice to have TAB advance through each window since people are used to using it on forms to advance to next field, and it's easier to hit on the kbd.. Unless there are plans for more windows we can remove the left right altogether if decided and just use tab. Hit tab until the window you want highlights? Just a thought... <!-- github-comment-id:2611193855 -->
Author
Owner

I'm not gonna worry about 1 for now - the windows seem to be working fine.

I'm not gonna worry about 1 for now - the windows seem to be working fine. <!-- github-comment-id:2614620353 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/contact#18