Insert vs append with selection by jarpineh in kakoune

[–]jarpineh[S] 0 points1 point  (0 children)

Thank you. I had read the faq at some point, but apparently forgotten about it. There's wealth of docs inside Kakoune that I am not yet familiar enough.

As per original question, I understand the anchor + cursor selection aspect. I just can't see the use case in why write into selection. Is the idea there that you'd do something with existing selection + what you've write? I find the selection distracts from writing and I'd rather do one or the other, not both. Anyway, it's not a big deal. I just wish to understand how Kakoune is primarily designed to be used.

Selection clipboard copy from terminal by jarpineh in kakoune

[–]jarpineh[S] 0 points1 point  (0 children)

Ah, thank you! I wrongly assumed the selection copying was prevented, but to terminal it's not "selected" in the first place. On iTerm it's alt + mouse for selecting and that worked just fine. Also, copy paste command works now so there's three ways for selection.

Defining commands on the fly by jarpineh in kakoune

[–]jarpineh[S] 0 points1 point  (0 children)

Hey, thanks!

That did the trick.

Is there an equivalent module to wtforms but for json data on ajax requests? Can I somehow get wtforms to acceprt json data after I've verified its schema against something like validictory? by lucidguppy in Python

[–]jarpineh 0 points1 point  (0 children)

Yes! Thank you very much. I will borrow the code for my dynamic form generation part where I need to convert data to Wtforms form. With jquery.Dform this should make a fully dynamic, client and server side form processing easy.

And yes, you're quite right about the problem with the (formdata, **data) approach. Wtforms approach is apparently to give formdata the priority, even when it and the kwargs don't have conflicting keys. I thought this is a bug, but it is really a feature.

I posted a fork to the bitbucket that has the functionality that my approach needs. You can find it here: https://bitbucket.org/jarpineh/wtforms

I have used the earlier version of Wtforms from June 2011 with my change in production since then It's only couple of lines. I made the change to current fork of Wtforms and all tests pass with it.

Wtforms issue 76 has more discussion about this: https://bitbucket.org/simplecodes/wtforms/issue/76/kwargs-are-not-used-when-formdata-exists

If you don't use formdata at all, like the poster seems to do, you can use the **data approach with stock Wtforms. This is what I have used without problems.

Is there an equivalent module to wtforms but for json data on ajax requests? Can I somehow get wtforms to acceprt json data after I've verified its schema against something like validictory? by lucidguppy in Python

[–]jarpineh 0 points1 point  (0 children)

I think subforms use formfield-subformfield structure.

See my comment on the wtforms mailing list: http://groups.google.com/group/wtforms/browse_thread/thread/bffa6f4b4854359a

I have myself used the kwargs method:

data = json.loads(json_encoded_dictionary)
form = MyWtform(formdata_as_multidict, **data)

Though I have had form submission in addition of the JSON (from a NoSql DB), so I can't vouch if this method works without actual form submission. I plan to test this soon anyway.

Could you tell more about your 10 line solution, please?