Pull requests

#1 Declined
Repository
Deleted repository
Branch
default (b763a66b5eee)
Repository
mpl/xplor xplor
Branch
default

Added window redraw when toggling Hidden, and function to clear a window.

Author
  1. Juan Fuentes
Reviewers
Description

Modified toggleHidden() to redraw the window, as well as added clearWindow() to clear(blank) the window. Modified doDotDot() to use clearWindow()

I added clearWindow() to avoid code duplication in toggleHidden() and doDotDot().

  • Learn about pull requests

Comments (3)

  1. mpl repo owner

    Thanks, but I'm not sure I want the whole tree to be redrawn when Hidden is toggled. The user might have a big tree, with various directories opened, and I don't like the idea of losing the state the tree is in when Hidden is hit. What I usually do is toggle it on, close and reopen immediately a dir to see if it has hidden files in it, and then toggle it back off right away.

    I have to think about this. Maybe I should add another command to force redraw everything. or maybe middle clicking on "xplor" could trigger that.

  2. mpl repo owner

    Since the state of the tree is simply how it is printed, I don't think there is a way to save it without saving all the tree as it is, as a textual form (string or []char). The fact that I'm using directly the printed text as the tree is both a strength and a weakness.

    A better way of storing the state of the tree would be to use a real data structure, with nodes, having parents and children, etc. which is probably the more usual way of doing a files manager. But then it would be a bit more complicated and not as acme-ish, that's why I didn't do it (after consideration). But it's probably a fun project to do if you feel like it.

    1. Juan Fuentes author

      Sorry for the confusion, when I said saving the state I did not mean to save it in textual form, rather to use a data structure to represent the tree, in a way that would allow to manage the folding/unfolding.

      I plan to work on this in the weekend, if for nothing else than it'll be fun. I'll try and make it so it will fit well with the Acme/Plan9 way, if it's alright with you, I would like to send you a patch for consideration/review.

      Thanks.