ChrisPenner / rasa

Extremely modular text editor built in Haskell
GNU General Public License v3.0
614 stars 42 forks source link

issue #20 #28

Closed clojj closed 7 years ago

clojj commented 7 years ago

introduce BufTextChanged event adresses issue #20

I included the change in Main.hs for testing/demo.. maybe it should not be included (?) The info.log output showed that this new event is working.

clojj commented 7 years ago

everything cleaned up, except the BufRef...

maybe you can give me a hint about the bufRef (?) ...similar to this ? https://github.com/ChrisPenner/rasa/blob/60583361ad01e5773430b9ab1cba301d77200fa8/rasa/src/Rasa/Internal/Scheduler.hs#L166

Tested this in a special configuration, like rasa-example-config.

What do you think of having a folder 'rasa-test-configurations' which contains several minimal configurations for testing various changes ? (people then get the idea how to test things)

How to unittest IO is a different story of course....

ChrisPenner commented 7 years ago

I'll take a look at the BufRef situation (hopefully later today) so I can give some advice on that;

Keeping a few configs around makes sense I think; but I'd rather that each feature we build is actually used inside some core feature (otherwise why are we building it?) and then we can just include that core function in the default config. In this case; we'll be using these features for the Syntax Highlighter; so its functionality will be demonstrated by that.

As far as testing I have a few ideas; Rasa has the nice property that so long as a given Action doesn't use liftIO we can test it purely functionally by dispatching a specific event-stream and asserting that the Editor state matches some result. In reality; I'd love to replace the Action Monad stack with an instance of Free monad; but that's probably unreasonable at this point. I'll start thinking about how we can do it well.

clojj commented 7 years ago

Looking at vim, I don't understand why a additional BufRef is necessary for event listeners of BufTextChanged... isn't any insertText or insertAt operation just changing the focused buffer ? (handleKeypress (Vim.hs) uses focusDo_) Are there any commands which can modify 'unfocused' or 'invisible ' buffers ?

clojj commented 7 years ago

Also.. when I want to send the new changed text with the BufTextChanged event, I have to force evaluation in overRange. Something I need to learn about rasa's internal execution/evaluation order maybe...?

ChrisPenner commented 7 years ago

Hrmm; yeah I think this is related to the pseudo-hack I did to get liftAction in; I have an idea for fixing it; but things I need to do are really piling up haha. If something run in a liftAction causes actions to alter the currently focused buffer (for instance using the BufRef we provide) then behaviour is (currently) undefined.

ChrisPenner commented 7 years ago

@clojj I have a possible idea for a fix to the Buffer issue in https://github.com/ChrisPenner/rasa/issues/31

ChrisPenner commented 7 years ago

I'm going to merge this in; I have changes in the works that will hopefully help this work well!

ChrisPenner commented 7 years ago

Merged with https://github.com/ChrisPenner/rasa/commit/fa72f730ea82797a0d16a9892769e25974577a03 Not really sure why the PR doesn't recognize it haha; maybe the rebase confused it.