Implementing buffer as a gap buffer

Integration not nearly finished & no tests done. Will be travelling the next few days, please improve.
Can you explain what this hashmap is for, and why cursor is now a string ?