Copy All Formats Truncating



  • I mapped my Ctrl-C to “Copy All Formats To Clipboard” method of the NppExport plugin. I’ve noticed that it always misses the last character.

    Example - if I select this entire sentence below and hit Ctrl-C:
    Now is the time for all good men

    When I paste it I get
    Now is the time for all good me

    Is there any way to fix this or a work-around?



  • I fixed this problem by changing the following code in NppExport that I found here https://github.com/chcg/NPP_ExportPlugin.

    TXTExporter::exportData()
    Before:
    int totalBytesNeeded = ed->csd->nrChars;
    After:
    int totalBytesNeeded = ed->csd->nrChars + 1;

    RTFExporter::exportData()
    Before:
    int totalBytesNeeded = 1; //zero terminator
    After:
    int totalBytesNeeded = 2; //zero terminator

    HTMLExporter exportData()
    Before:
    int totalBytesNeeded = 1; //zero terminator
    After:
    int totalBytesNeeded = 2; //zero terminator

    I hope this helps someone.

    Thanks,
    Darren


Log in to reply