I would like to implement the Emacs feature "dired": a directory browser. (Basically, we will show the output of "ls -l" and allow the user to open a file by hitting Enter on the corresponding line, or to delete or rename a file, or copy, and so on. If the user hits Enter on a directory, we show that directory in the same way.)
I thought it would be useful if I could somehow hide the exact file name in each line. Or attach the file name to each line in the file.
This way, I don't need to parse the file name from the view. This might be useful in case the right spot on the line is difficult to find, or if the file name contains a newline character (eek), or if I would like to mangle the file name for presentation purposes.
So far I could not find a way to insert invisible text into a view. One idea I had is to just add a Python instance variable to the view:
self.view.list_of_files = some_array
. Then I could replace newlines in file names and Bob would be my uncle... But I'm sure someone has had this type of problem before, so I'd like to just trod the beaten path...