Home Download Buy Blog Forum Support

Attach data to text (or make text invisible)

Attach data to text (or make text invisible)

Postby hibbelig on Fri Dec 23, 2011 9:51 pm

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:
Code: Select all
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...
hibbelig
 
Posts: 77
Joined: Wed Dec 21, 2011 11:24 pm

Re: Attach data to text (or make text invisible)

Postby hibbelig on Fri Dec 23, 2011 11:26 pm

I found
Code: Select all
view.settings()
, and right now it's an array of file names, and I'm putting the index of the file into the beginning of each line.
hibbelig
 
Posts: 77
Joined: Wed Dec 21, 2011 11:24 pm


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 7 guests