mittelmark/shtmlview

history implementation

Closed this issue · 2 comments

This is just for your consideration, it may be an improvement or not.

Actually history is held as a list of pathnames (including filenames), but since you are using objects (snit) maybe would be better to consider a more structured representation

I think this would make the code more general, clear and scalable maybe at the cost of a little bit more processing.

One possibility is having an object for each history item, this way the object knows how to handle each item (html, md,...) and can return apropieated text and have specialized methods

A simpler possibility if you don't want to mess with object is to have a list structure to represent histoy item, breaking it down into components: path, filename and fragment. This way your history would be a item list where each item is itself a list:

{ { "c:/users/downloads/" "shtmlview.html" "#example" } { "c:/" "test.md" "" } }

this way handling files, fragments or urls (in case you want) is straight forward and I think all the checking code scattered across the source is also easier.

Indeed there might be certainly more clever ways to handle the history. But I would at this stage not rewrite everything, it seems just to work in most cases and that is OK for me. I would rather focus in bug-fixing than rewriting ;)

ok ;-)